]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
Update for new matrix.xml format with external="yes" attribute.
authorBruno Haible <bruno@clisp.org>
Wed, 12 Dec 2001 13:06:20 +0000 (13:06 +0000)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Jun 2009 21:43:12 +0000 (23:43 +0200)
Admin/Matrix.java

index 9512ca68751521490ad6e6a89c6fcd9fc7e64043..51f6615b9c1af18a6379a0d222a427ae577fe4f8 100644 (file)
@@ -39,6 +39,10 @@ public class Matrix {
     List /* of PoFile */ po_files = new Vector();
   }
 
+  public static final int FALSE = 0;
+  public static final int TRUE = 1;
+  public static final int EXTERNAL = 2;
+
   public static void spaces (PrintWriter stream, int n) {
     for (int i = n; i > 0; i--)
       stream.print(' ');
@@ -78,11 +82,12 @@ public class Matrix {
       Iterator i = po_files.getChildren("po").iterator();
       while (i.hasNext()) {
         Element po = (Element)i.next();
+        String value = po.getText();
         data.po_files.add(
             new PoFile(
                 po.getAttribute("domain").getValue(),
                 po.getAttribute("team").getValue(),
-                Integer.parseInt(po.getText())));
+                value.equals("") ? -1 : Integer.parseInt(value)));
       }
     }
 
@@ -108,9 +113,9 @@ public class Matrix {
       int ndomains = domains.length;
       int nteams = teams.length;
 
-      boolean[][] matrix = new boolean[ndomains][];
+      int[][] matrix = new int[ndomains][];
       for (int d = 0; d < ndomains; d++)
-        matrix[d] = new boolean[nteams];
+        matrix[d] = new int[nteams];
       int[] total_per_domain = new int[ndomains];
       int[] total_per_team = new int[nteams];
       int total = 0;
@@ -125,10 +130,18 @@ public class Matrix {
             int t = Arrays.binarySearch(teams,po.team);
             if (t < 0)
               throw new Error("didn't find team \""+po.team+"\"");
-            matrix[d][t] = true;
+            matrix[d][t] = TRUE;
             total_per_domain[d]++;
             total_per_team[t]++;
             total++;
+          } else if (po.percentage < 0) {
+            int d = Arrays.binarySearch(domains,po.domain);
+            if (d < 0)
+              throw new Error("didn't find domain \""+po.domain+"\"");
+            int t = Arrays.binarySearch(teams,po.team);
+            if (t < 0)
+              throw new Error("didn't find team \""+po.team+"\"");
+            matrix[d][t] = EXTERNAL;
           }
         }
       }
@@ -174,11 +187,16 @@ public class Matrix {
           stream.print('|');
           for (int t = groups[group][0]; t < groups[group][1]; t++) {
             stream.print(' ');
-            if (matrix[d][t]) {
+            if (matrix[d][t] == TRUE) {
               int i = teams[t].length()-2;
               spaces(stream,i/2);
               stream.print("[]");
               spaces(stream,(i+1)/2);
+            } else if (matrix[d][t] == EXTERNAL) {
+              int i = teams[t].length()-2;
+              spaces(stream,i/2);
+              stream.print("()");
+              spaces(stream,(i+1)/2);
             } else {
               spaces(stream,teams[t].length());
             }