myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lof...@apache.org
Subject svn commit: r801704 - in /myfaces/tobago/trunk/core/src: main/java/org/apache/myfaces/tobago/layout/math/ test/java/org/apache/myfaces/tobago/component/ test/java/org/apache/myfaces/tobago/layout/math/
Date Thu, 06 Aug 2009 16:25:02 GMT
Author: lofwyr
Date: Thu Aug  6 16:25:01 2009
New Revision: 801704

URL: http://svn.apache.org/viewvc?rev=801704&view=rev
Log:
TOBAGO-606: Layout-Manager
 - Add remainder of a partition to fix problems when the sizes can't be solved exactly.

Added:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java
      - copied, changed from r801603, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
Modified:
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
    myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
    myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/CombinationEquation.java
Thu Aug  6 16:25:01 2009
@@ -47,10 +47,12 @@
     this.component = component;
   }
 
-  public void fillRow(double[] row) {
+  public double[] fillRow(int length) {
     assert newIndex >= 0 && parent >= 0 && span > 0;
     assert parent + span <= newIndex || parent > newIndex;
 
+    double[] row = new double[length];
+
     int i = 0;
     for (; i < newIndex; i++) {
       row[i] = 0.0;
@@ -67,6 +69,8 @@
     for (i = parent; i < parent + span; i++) {
       row[i] = -1.0;
     }
+
+    return row;
   }
 
   public int priority() {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/Equation.java
Thu Aug  6 16:25:01 2009
@@ -21,9 +21,9 @@
 
   /**
    * The row has the format: index 0 to n-2 are the factors and index n-1 is the result.
-   * @param row array to fill in the factors of the equation.
+   * @param length The length of the array which has to be created.
    */
-  void fillRow(double[] row);
+  double[] fillRow(int length);
 
   /**
    * Priority for sorting.

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/EquationManager.java
Thu Aug  6 16:25:01 2009
@@ -52,9 +52,11 @@
 
     assert number > 0;
 
-    int[] newIndices = equations.addVariables(number);
+    int[] newIndices = equations.addVariables(number + 1);
     equations.addEqualsEquation(
         new PartitionEquation(newIndices[0], number, index, spacing, beginOffset, endOffset,
component));
+    equations.addEqualsEquation(
+        new RemainderEquation(newIndices[number], component));
     LOG.info(equations);
     return newIndices;
   }

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
Thu Aug  6 16:25:01 2009
@@ -33,10 +33,12 @@
     this.component = component;
   }
 
-  public void fillRow(double[] row) {
+  public double[] fillRow(int length) {
+    double[] row = new double[length];
     Arrays.fill(row, 0.0);
     row[index] = 1.0;
     row[row.length - 1] = result.getPixel();
+    return row;
   }
 
   public int priority() {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/PartitionEquation.java
Thu Aug  6 16:25:01 2009
@@ -69,23 +69,29 @@
     assert parent <= begin;
   }
 
-  public void fillRow(double[] row) {
+  public double[] fillRow(int length) {
+    double[] row = new double[length];
     int i = 0;
     for (; i < begin; i++) {
       row[i] = 0.0;
     }
+    // these variables are the cells from the partition
     for (; i < begin + count; i++) {
       row[i] = 1.0;
     }
+    // this variable is for the rest (overfull (scrollbar?) or underfull).
+    row[i++] = 1.0;
+
     for (; i < row.length - 1; i++) {
       row[i] = 0.0;
     }
     // the last variable contains a constant, this is here the sum of spaces between cells.
     row[row.length - 1] = -((count - 1) * spacing.getPixel() + beginOffset.getPixel() + endOffset.getPixel());
 
-    for (i = parent; i < parent + 1; i++) {
-      row[i] = -1.0;
-    }
+    // the variable for parent
+    row[parent] = -1.0;
+
+    return row;
   }
 
   public int priority() {
@@ -142,6 +148,9 @@
         builder.append(" + ");
         builder.append(endOffset);
     }
+    // rest
+    builder.append(" + x_");
+    builder.append(begin + count);
 
     builder.append(" (");
     builder.append(component);

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ProportionEquation.java
Thu Aug  6 16:25:01 2009
@@ -33,7 +33,8 @@
     this.component = component;
   }
 
-  public void fillRow(double[] row) {
+  public double[] fillRow(int length) {
+    double[] row = new double[length];
     for (int i = 0; i < row.length; i++) {
       row[i]
           = i == index1
@@ -42,6 +43,7 @@
           ? -factor1
           : 0.0;
     }
+    return row;
   }
 
   public int priority() {

Copied: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java
(from r801603, myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java)
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java?p2=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java&p1=myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java&r1=801603&r2=801704&rev=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/FixedEquation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/RemainderEquation.java
Thu Aug  6 16:25:01 2009
@@ -17,34 +17,31 @@
  * limitations under the License.
  */
 
-import org.apache.myfaces.tobago.layout.Measure;
-
 import java.util.Arrays;
 
-public final class FixedEquation implements Equation {
+public final class RemainderEquation implements Equation {
 
   private int index;
-  private Measure result;
   private String component;
 
-  public FixedEquation(int index, Measure result, String component) {
+  public RemainderEquation(int index, String component) {
     this.index = index;
-    this.result = result;
     this.component = component;
   }
 
-  public void fillRow(double[] row) {
+  public double[] fillRow(int length) {
+    double[] row = new double[length];
     Arrays.fill(row, 0.0);
     row[index] = 1.0;
-    row[row.length - 1] = result.getPixel();
+    return row;
   }
 
   public int priority() {
-    return 40;
+    return 0;
   }
 
   @Override
   public String toString() {
-    return "FixedEquation:        x_" + index + " = " + result + " (" + component + ")";
+    return "RemainderEquation:    x_" + index + " = 0 (" + component + ")";
   }
-}
+}
\ No newline at end of file

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/SystemOfEquations.java
Thu Aug  6 16:25:01 2009
@@ -96,25 +96,7 @@
     this.step = Step.NEW;
   }
 
-  public void addEqualsEquation(FixedEquation equation) {
-    assert step == Step.NEW;
-
-    equations.add(equation);
-  }
-
-  public void addEqualsEquation(PartitionEquation equation) {
-    assert step == Step.NEW;
-
-    equations.add(equation);
-  }
-
-  public void addEqualsEquation(CombinationEquation equation) {
-    assert step == Step.NEW;
-
-    equations.add(equation);
-  }
-
-  public void addEqualsEquation(ProportionEquation equation) {
+  public void addEqualsEquation(Equation equation) {
     assert step == Step.NEW;
 
     equations.add(equation);
@@ -160,8 +142,7 @@
 
     data = new double[equations.size()][];
     for (int i = 0; i < equations.size(); i++) {
-      data[i] = new double[numberOfVariables + 1];
-      equations.get(i).fillRow(data[i]);
+      data[i] = equations.get(i).fillRow(numberOfVariables + 1);
     }
     /*
     for (int i = 0; i < equalEquations.size(); i++) {

Modified: myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
(original)
+++ myfaces/tobago/trunk/core/src/main/java/org/apache/myfaces/tobago/layout/math/ZeroEquation.java
Thu Aug  6 16:25:01 2009
@@ -21,12 +21,14 @@
 
 public final class ZeroEquation implements Equation {
 
-  public void fillRow(double[] row) {
+  public double[] fillRow(int length) {
+    double[] row = new double[length];
     Arrays.fill(row, 0.0);
+    return row;
   }
 
   public int priority() {
-    return 0;
+    return -10;
   }
 
   @Override

Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/component/GridLayoutManagerUnitTest.java
Thu Aug  6 16:25:01 2009
@@ -71,13 +71,14 @@
     Measure[] result = layoutContext.getHorizontal().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(200),
+        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(200), PixelMeasure.ZERO,
         new PixelMeasure(100), new PixelMeasure(200)}, result);
 
     result = layoutContext.getVertical().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(20), new PixelMeasure(20), new PixelMeasure(20), new PixelMeasure(20)},
result);
+        new PixelMeasure(20), new PixelMeasure(20), PixelMeasure.ZERO, new PixelMeasure(20),
new PixelMeasure(20)},
+        result);
 
     Assert.assertEquals("width of container", 300, container.getWidth().getPixel());
     Assert.assertEquals("width of component 1", 100, c1.getWidth().getPixel());
@@ -123,13 +124,14 @@
     Measure[] result = layoutContext.getHorizontal().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),
+        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),
PixelMeasure.ZERO,
         new PixelMeasure(100), new PixelMeasure(200)}, result);
 
     result = layoutContext.getVertical().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(20), new PixelMeasure(20), new PixelMeasure(20), new PixelMeasure(20)},
result);
+        new PixelMeasure(20), new PixelMeasure(20), PixelMeasure.ZERO, new PixelMeasure(20),
new PixelMeasure(20)},
+        result);
 
     Assert.assertEquals("width of container", 300, container.getWidth().getPixel());
     Assert.assertEquals("width of component", 100, c.getWidth().getPixel());
@@ -203,9 +205,9 @@
     Measure[] result = layoutContext.getHorizontal().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(800), new PixelMeasure(100), new PixelMeasure(200), new PixelMeasure(500),
+        new PixelMeasure(800), new PixelMeasure(100), new PixelMeasure(200), new PixelMeasure(500),
PixelMeasure.ZERO,
         new PixelMeasure(100), new PixelMeasure(700), new PixelMeasure(100), new PixelMeasure(200),
-        new PixelMeasure(500), new PixelMeasure(350), new PixelMeasure(150), new PixelMeasure(350),
+        new PixelMeasure(500), new PixelMeasure(350), new PixelMeasure(150), PixelMeasure.ZERO,
new PixelMeasure(350),
         new PixelMeasure(150), new PixelMeasure(350), new PixelMeasure(150)
     }, result);
 
@@ -213,9 +215,11 @@
     result = layoutContext.getVertical().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(800), new PixelMeasure(200), new PixelMeasure(600), new PixelMeasure(200),
-        new PixelMeasure(200), new PixelMeasure(600), new PixelMeasure(600), new PixelMeasure(600),
-        new PixelMeasure(300), new PixelMeasure(300), new PixelMeasure(300), new PixelMeasure(300),
+        new PixelMeasure(800), new PixelMeasure(200), new PixelMeasure(600), PixelMeasure.ZERO,
+        new PixelMeasure(200), new PixelMeasure(200),
+        new PixelMeasure(600), new PixelMeasure(600), new PixelMeasure(600),
+        new PixelMeasure(300), new PixelMeasure(300), PixelMeasure.ZERO,
+        new PixelMeasure(300), new PixelMeasure(300),
         new PixelMeasure(300), new PixelMeasure(300)
     }, result);
 
@@ -284,18 +288,19 @@
     Measure[] result = layoutContext.getHorizontal().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(900), new PixelMeasure(300), new PixelMeasure(300), new PixelMeasure(300),
+        new PixelMeasure(900), new PixelMeasure(300), new PixelMeasure(300), new PixelMeasure(300),
PixelMeasure.ZERO,
         new PixelMeasure(300), new PixelMeasure(600), new PixelMeasure(200), new PixelMeasure(200),
-        new PixelMeasure(200), new PixelMeasure(600), new PixelMeasure(200), new PixelMeasure(200),
-        new PixelMeasure(200), new PixelMeasure(300)
+        new PixelMeasure(200), PixelMeasure.ZERO, new PixelMeasure(600), new PixelMeasure(200),
new PixelMeasure(200),
+        new PixelMeasure(200), PixelMeasure.ZERO, new PixelMeasure(300)
     }, result);
 
     result = layoutContext.getVertical().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(200), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),
-        new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),
-        new PixelMeasure(100)}, result);
+        new PixelMeasure(200), new PixelMeasure(100), new PixelMeasure(100), PixelMeasure.ZERO,
+        new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),PixelMeasure.ZERO,
+        new PixelMeasure(100), new PixelMeasure(100), PixelMeasure.ZERO,new PixelMeasure(100)},
+        result);
 
     Assert.assertEquals("width of container", 900, container.getWidth().getPixel());
     Assert.assertEquals("width of span 1", 600, span1.getWidth().getPixel());
@@ -349,15 +354,15 @@
     Measure[] result = layoutContext.getHorizontal().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(800), new PixelMeasure(400), new PixelMeasure(400), new PixelMeasure(400),
-        new PixelMeasure(400), new PixelMeasure(400)}, result);
+        new PixelMeasure(800), new PixelMeasure(400), new PixelMeasure(400), PixelMeasure.ZERO,
+        new PixelMeasure(400), new PixelMeasure(400), new PixelMeasure(400)}, result);
 
 
     result = layoutContext.getVertical().getResult();
     LOG.info("result: " + Arrays.toString(result));
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(800), new PixelMeasure(400), new PixelMeasure(400), new PixelMeasure(800),
-        new PixelMeasure(400), new PixelMeasure(400)}, result);
+        new PixelMeasure(800), new PixelMeasure(400), new PixelMeasure(400), PixelMeasure.ZERO,
+        new PixelMeasure(800), new PixelMeasure(400), new PixelMeasure(400)}, result);
 
     Assert.assertEquals("width of container", 800, container.getWidth().getPixel());
     Assert.assertEquals("height of container", 800, container.getHeight().getPixel());

Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/CombinationEquationUnitTest.java
Thu Aug  6 16:25:01 2009
@@ -43,20 +43,21 @@
 
   @Test
   public void testFillRow() {
-    double[] row = new double[8];
+    int length = 8;
+    double[] row;
 
-    new CombinationEquation(4, 0, 1, PixelMeasure.ZERO, "test").fillRow(row);
+    row = new CombinationEquation(4, 0, 1, PixelMeasure.ZERO, "test").fillRow(length);
     Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 0, 0, 0}, row, MathUtils.EPSILON);
-    new CombinationEquation(4, 0, 2, PixelMeasure.ZERO, "test").fillRow(row);
+    row = new CombinationEquation(4, 0, 2, PixelMeasure.ZERO, "test").fillRow(length);
     Assert.assertArrayEquals(new double[] {-1, -1, 0, 0, 1, 0, 0, 0}, row, MathUtils.EPSILON);
-    new CombinationEquation(4, 0, 3, PixelMeasure.ZERO, "test").fillRow(row);
+    row = new CombinationEquation(4, 0, 3, PixelMeasure.ZERO, "test").fillRow(length);
     Assert.assertArrayEquals(new double[] {-1, -1, -1, 0, 1, 0, 0, 0}, row, MathUtils.EPSILON);
 
-    new CombinationEquation(4, 0, 1, new PixelMeasure(5), "test").fillRow(row);
+    row = new CombinationEquation(4, 0, 1, new PixelMeasure(5), "test").fillRow(length);
     Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 0, 0, 0}, row, MathUtils.EPSILON);
-    new CombinationEquation(4, 0, 2, new PixelMeasure(5), "test").fillRow(row);
+    row = new CombinationEquation(4, 0, 2, new PixelMeasure(5), "test").fillRow(length);
     Assert.assertArrayEquals(new double[] {-1, -1, 0, 0, 1, 0, 0, 5}, row, MathUtils.EPSILON);
-    new CombinationEquation(4, 0, 3, new PixelMeasure(5), "test").fillRow(row);
+    row = new CombinationEquation(4, 0, 3, new PixelMeasure(5), "test").fillRow(length);
     Assert.assertArrayEquals(new double[] {-1, -1, -1, 0, 1, 0, 0, 10}, row, MathUtils.EPSILON);
   }
 

Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/EquationManagerUnitTest.java
Thu Aug  6 16:25:01 2009
@@ -257,51 +257,51 @@
     Assert.assertEquals(0, index);
     equationManager.setFixedLength(index, new PixelMeasure(630), "test");        // the first
(current) index has a fix size of 600
     indices = equationManager.partition(index, 4, PixelMeasure.ZERO, "test");           
         // this index is divided into 4 parts
-    Assert.assertArrayEquals(new int[]{1, 2, 3, 4}, indices);
+    Assert.assertArrayEquals(new int[]{1, 2, 3, 4, 5}, indices);
     equationManager.proportionate(indices[2], indices[3], 1, 2, "test");     // the value
on index 2 has factor 1,
     //                                                the value on position 3 has factor
2
     {
       equationManager.setFixedLength(indices[0], new PixelMeasure(100), "test");        //
the first one has a fix size of 100
       index = equationManager.combine(indices[0], 1, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(5, index);
+      Assert.assertEquals(6, index);
     }
     {
       equationManager.setFixedLength(indices[1], new PixelMeasure(200), "test");        //
the second one has a fix size of 200
       index = equationManager.combine(indices[1], 1, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(6, index);
+      Assert.assertEquals(7, index);
 
       index = equationManager.combine(indices[1], 1, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(7, index);
-      int[] i7 = equationManager.partition(7, 2, PixelMeasure.ZERO, "test");
-      Assert.assertArrayEquals(new int[]{8, 9}, i7);
+      Assert.assertEquals(8, index);
+      int[] i7 = equationManager.partition(8, 2, PixelMeasure.ZERO, "test");
+      Assert.assertArrayEquals(new int[]{9, 10,11}, i7);
       equationManager.proportionate(i7[0], i7[1], 1, 2, "test");
 
       index = equationManager.combine(indices[1], 1, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(10, index);
-      int[] i10 = equationManager.partition(10, 2, PixelMeasure.ZERO, "test");
-      Assert.assertArrayEquals(new int[]{11, 12}, i10);
+      Assert.assertEquals(12, index);
+      int[] i10 = equationManager.partition(12, 2, PixelMeasure.ZERO, "test");
+      Assert.assertArrayEquals(new int[]{13, 14, 15}, i10);
       equationManager.proportionate(i10[0], i10[1], 4, 1, "test");
     }
     {
       index = equationManager.combine(indices[2], 1, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(13, index);
+      Assert.assertEquals(16, index);
     }
     {
       index = equationManager.combine(indices[3], 1, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(14, index);
-      int[] i14 = equationManager.partition(14, 2, PixelMeasure.ZERO, "test");
-      Assert.assertArrayEquals(new int[]{15, 16}, i14);
+      Assert.assertEquals(17, index);
+      int[] i14 = equationManager.partition(17, 2, PixelMeasure.ZERO, "test");
+      Assert.assertArrayEquals(new int[]{18, 19, 20}, i14);
       equationManager.setFixedLength(i14[0], new PixelMeasure(130), "test");        // the
second one has a fix size of 200
     }
     {
       int iSpan2 = equationManager.combine(indices[2], 2, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(17, iSpan2);
+      Assert.assertEquals(21, iSpan2);
     }
     {
       int iSpan4 = equationManager.combine(indices[0], 4, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(18, iSpan4);
-      int[] i18 = equationManager.partition(18, 6, PixelMeasure.ZERO, "test");
-      Assert.assertArrayEquals(new int[]{19, 20, 21, 22, 23, 24}, i18);
+      Assert.assertEquals(22, iSpan4);
+      int[] i18 = equationManager.partition(22, 6, PixelMeasure.ZERO, "test");
+      Assert.assertArrayEquals(new int[]{23, 24, 25, 26, 27, 28, 29}, i18);
       equationManager.proportionate(i18[0], i18[1], 1, 2, "test");
       equationManager.proportionate(i18[0], i18[2], 1, 3, "test");
       equationManager.proportionate(i18[0], i18[3], 1, 4, "test");
@@ -309,12 +309,12 @@
       equationManager.proportionate(i18[0], i18[5], 1, 6, "test");
     }
     {
-      int i19_1 = equationManager.combine(19, 6, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(25, i19_1);
-      int i19_2 = equationManager.combine(19, 3, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(26, i19_2);
-      int i22 = equationManager.combine(22, 3, PixelMeasure.ZERO, "test");
-      Assert.assertEquals(27, i22);
+      int i19_1 = equationManager.combine(23, 6, PixelMeasure.ZERO, "test");
+      Assert.assertEquals(30, i19_1);
+      int i19_2 = equationManager.combine(23, 3, PixelMeasure.ZERO, "test");
+      Assert.assertEquals(31, i19_2);
+      int i22 = equationManager.combine(26, 3, PixelMeasure.ZERO, "test");
+      Assert.assertEquals(32, i22);
     }
 
     LOG.info("tree: " + equationManager.toString());
@@ -330,29 +330,35 @@
         new PixelMeasure(200),        // x_2
         new PixelMeasure(110),        // x_3
         new PixelMeasure(220),        // x_4
-        new PixelMeasure(100),        // x_5
-        new PixelMeasure(200),        // x_6
+        new PixelMeasure(0),          // x_5
+        new PixelMeasure(100),        // x_6
         new PixelMeasure(200),        // x_7
-        new PixelMeasure(67),         // x_8
-        new PixelMeasure(133),        // x_9
-        new PixelMeasure(200),        // x_10
-        new PixelMeasure(160),        // x_11
-        new PixelMeasure(40),         // x_12
-        new PixelMeasure(110),        // x_13
-        new PixelMeasure(220),        // x_14
-        new PixelMeasure(130),        // x_15
-        new PixelMeasure(90),         // x_16
-        new PixelMeasure(330),        // x_17
-        new PixelMeasure(630),        // x_18
-        new PixelMeasure(30),         // x_19
-        new PixelMeasure(60),         // x_20
-        new PixelMeasure(90),         // x_21
-        new PixelMeasure(120),        // x_22
-        new PixelMeasure(150),        // x_23
-        new PixelMeasure(180),        // x_24
-        new PixelMeasure(630),        // x_25
-        new PixelMeasure(180),        // x_26
-        new PixelMeasure(450),        // x_27
+        new PixelMeasure(200),        // x_8
+        new PixelMeasure(67),         // x_9
+        new PixelMeasure(133),        // x_10
+        new PixelMeasure(0),          // x_11
+        new PixelMeasure(200),        // x_12
+        new PixelMeasure(160),        // x_13
+        new PixelMeasure(40),         // x_14
+        new PixelMeasure(0),          // x_15
+        new PixelMeasure(110),        // x_16
+        new PixelMeasure(220),        // x_17
+        new PixelMeasure(130),        // x_18
+        new PixelMeasure(90),         // x_19
+        new PixelMeasure(0),          // x_20
+        new PixelMeasure(330),        // x_21
+        new PixelMeasure(630),        // x_22
+        new PixelMeasure(30),         // x_23
+        new PixelMeasure(60),         // x_24
+        new PixelMeasure(90),         // x_25
+        new PixelMeasure(120),        // x_26
+        new PixelMeasure(150),        // x_27
+        new PixelMeasure(180),        // x_28
+        new PixelMeasure(0),          // x_29
+        new PixelMeasure(630),        // x_30
+        new PixelMeasure(180),        // x_31
+        new PixelMeasure(450),        // x_32
     }, result);
   }
+
 }

Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/PartitionEquationUnitTest.java
Thu Aug  6 16:25:01 2009
@@ -25,37 +25,39 @@
 
   @Test
   public void testToString() {
-    Assert.assertEquals("PartitionEquation:    x_0 = x_4 (test)",
-        new PartitionEquation(4, 1, 0, PixelMeasure.ZERO, "test").toString());
     Assert.assertEquals("PartitionEquation:    x_0 = x_4 + x_5 (test)",
+        new PartitionEquation(4, 1, 0, PixelMeasure.ZERO, "test").toString());
+    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + x_5 + x_6 (test)",
         new PartitionEquation(4, 2, 0, PixelMeasure.ZERO, "test").toString());
-    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + ... + x_6 (test)",
+    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + ... + x_6 + x_7 (test)",
         new PartitionEquation(4, 3, 0, PixelMeasure.ZERO, "test").toString());
 
-    Assert.assertEquals("PartitionEquation:    x_0 = x_4 (test)",
+    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + x_5 (test)",
         new PartitionEquation(4, 1, 0, new PixelMeasure(5), "test").toString());
-    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + x_5 + 5px (test)",
+    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + x_5 + 5px + x_6 (test)",
         new PartitionEquation(4, 2, 0, new PixelMeasure(5), "test").toString());
-    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + ... + x_6 + 2 * 5px (test)",
+    Assert.assertEquals("PartitionEquation:    x_0 = x_4 + ... + x_6 + 2 * 5px + x_7 (test)",
         new PartitionEquation(4, 3, 0, new PixelMeasure(5), "test").toString());
   }
 
   @Test
   public void testFillRow() {
-    double[] row = new double[8];
 
-    new PartitionEquation(4, 1, 0, PixelMeasure.ZERO, "test").fillRow(row);
-    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 0, 0, 0}, row, MathUtils.EPSILON);
-    new PartitionEquation(4, 2, 0, PixelMeasure.ZERO, "test").fillRow(row);
-    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 0, 0}, row, MathUtils.EPSILON);
-    new PartitionEquation(4, 3, 0, PixelMeasure.ZERO, "test").fillRow(row);
-    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 1, 0}, row, MathUtils.EPSILON);
-
-    new PartitionEquation(4, 1, 0, new PixelMeasure(5), "test").fillRow(row);
-    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 0, 0, 0}, row, MathUtils.EPSILON);
-    new PartitionEquation(4, 2, 0, new PixelMeasure(5), "test").fillRow(row);
-    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 0, -5}, row, MathUtils.EPSILON);
-    new PartitionEquation(4, 3, 0, new PixelMeasure(5), "test").fillRow(row);
-    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 1, -10}, row, MathUtils.EPSILON);
+    int length = 9;
+    double[] row;
+
+    row = new PartitionEquation(4, 1, 0, PixelMeasure.ZERO, "test").fillRow(length);
+    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 0, 0, 0}, row, MathUtils.EPSILON);
+    row = new PartitionEquation(4, 2, 0, PixelMeasure.ZERO, "test").fillRow(length);
+    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 1, 0, 0}, row, MathUtils.EPSILON);
+    row = new PartitionEquation(4, 3, 0, PixelMeasure.ZERO, "test").fillRow(length);
+    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 1, 1, 0}, row, MathUtils.EPSILON);
+
+    row = new PartitionEquation(4, 1, 0, new PixelMeasure(5), "test").fillRow(length);
+    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 0, 0, 0}, row, MathUtils.EPSILON);
+    row = new PartitionEquation(4, 2, 0, new PixelMeasure(5), "test").fillRow(length);
+    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 1, 0, -5}, row, MathUtils.EPSILON);
+    row = new PartitionEquation(4, 3, 0, new PixelMeasure(5), "test").fillRow(length);
+    Assert.assertArrayEquals(new double[] {-1, 0, 0, 0, 1, 1, 1, 1, -10}, row, MathUtils.EPSILON);
   }
 }
\ No newline at end of file

Modified: myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java?rev=801704&r1=801703&r2=801704&view=diff
==============================================================================
--- myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
(original)
+++ myfaces/tobago/trunk/core/src/test/java/org/apache/myfaces/tobago/layout/math/SystemOfEquationsUnitTest.java
Thu Aug  6 16:25:01 2009
@@ -144,15 +144,17 @@
 
     long begin = System.nanoTime();
 
-    SystemOfEquations system = new SystemOfEquations(8);
+    SystemOfEquations system = new SystemOfEquations(10);
     system.addEqualsEquation(new FixedEquation(0, new PixelMeasure(900), "test"));
     system.addEqualsEquation(new PartitionEquation(1, 3, 0, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new CombinationEquation(4, 2, 2, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new PartitionEquation(5, 3, 4, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new CombinationEquation(5, 2, 2, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new PartitionEquation(6, 3, 5, PixelMeasure.ZERO, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 2, 1, 1, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 3, 1, 1, "test"));
-    system.addEqualsEquation(new ProportionEquation(5, 6, 1, 1, "test"));
-    system.addEqualsEquation(new ProportionEquation(5, 7, 1, 1, "test"));
+    system.addEqualsEquation(new ProportionEquation(6, 7, 1, 1, "test"));
+    system.addEqualsEquation(new ProportionEquation(6, 8, 1, 1, "test"));
+    system.addEqualsEquation(new RemainderEquation(4, "test"));
+    system.addEqualsEquation(new RemainderEquation(9, "test"));
     Measure[] result = system.solve();
 
     long end = System.nanoTime();
@@ -161,8 +163,9 @@
     LOG.info("Duration: " + new DecimalFormat().format(end - begin) + " ns");
 
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(900), new PixelMeasure(300), new PixelMeasure(300), new PixelMeasure(300),
-        new PixelMeasure(600), new PixelMeasure(200), new PixelMeasure(200), new PixelMeasure(200)},
result);
+        new PixelMeasure(900), new PixelMeasure(300), new PixelMeasure(300), new PixelMeasure(300),
PixelMeasure.ZERO,
+        new PixelMeasure(600), new PixelMeasure(200), new PixelMeasure(200), new PixelMeasure(200),
PixelMeasure.ZERO},
+        result);
   }
 
   @Test
@@ -188,15 +191,17 @@
 
     long begin = System.nanoTime();
 
-    SystemOfEquations system = new SystemOfEquations(8);
+    SystemOfEquations system = new SystemOfEquations(10);
 //    system.addEqualsEquation(new FixedEquation(0, 900));
     system.addEqualsEquation(new PartitionEquation(1, 3, 0, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new CombinationEquation(4, 2, 2, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new PartitionEquation(5, 3, 4, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new CombinationEquation(5, 2, 2, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new PartitionEquation(6, 3, 5, PixelMeasure.ZERO, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 2, 1, 1, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 3, 1, 1, "test"));
-    system.addEqualsEquation(new ProportionEquation(5, 6, 1, 1, "test"));
-    system.addEqualsEquation(new ProportionEquation(5, 7, 1, 1, "test"));
+    system.addEqualsEquation(new ProportionEquation(6, 7, 1, 1, "test"));
+    system.addEqualsEquation(new ProportionEquation(6, 8, 1, 1, "test"));
+    system.addEqualsEquation(new RemainderEquation(4, "test"));
+    system.addEqualsEquation(new RemainderEquation(9, "test"));
     Measure[] result = system.solve();
 
     long end = System.nanoTime();
@@ -205,8 +210,9 @@
     LOG.info("Duration: " + new DecimalFormat().format(end - begin) + " ns");
 
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(450), new PixelMeasure(150), new PixelMeasure(150), new PixelMeasure(150),
-        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100)},
result);
+        new PixelMeasure(450), new PixelMeasure(150), new PixelMeasure(150), new PixelMeasure(150),
PixelMeasure.ZERO,
+        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),
PixelMeasure.ZERO},
+        result);
   }
 
   /**
@@ -250,15 +256,17 @@
 
     long begin = System.nanoTime();
 
-    SystemOfEquations system = new SystemOfEquations(8);
+    SystemOfEquations system = new SystemOfEquations(10);
 //    system.addEqualsEquation(new FixedEquation(0, 900));
     system.addEqualsEquation(new PartitionEquation(1, 3, 0, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new CombinationEquation(4, 2, 2, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new PartitionEquation(5, 3, 4, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new CombinationEquation(5, 2, 2, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new PartitionEquation(6, 3, 5, PixelMeasure.ZERO, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 2, 1, 1, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 3, 1, 1, "test"));
-    system.addEqualsEquation(new ProportionEquation(5, 6, 1, 1, "test"));
-    system.addEqualsEquation(new ProportionEquation(5, 7, 1, 1, "test"));
+    system.addEqualsEquation(new ProportionEquation(6, 7, 1, 1, "test"));
+    system.addEqualsEquation(new ProportionEquation(6, 8, 1, 1, "test"));
+    system.addEqualsEquation(new RemainderEquation(4, "test"));
+    system.addEqualsEquation(new RemainderEquation(9, "test"));
     Measure[] result = system.solve();
 
     long end = System.nanoTime();
@@ -267,8 +275,9 @@
     LOG.info("Duration: " + new DecimalFormat().format(end - begin) + " ns");
 
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(450), new PixelMeasure(150), new PixelMeasure(150), new PixelMeasure(150),
-        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100)},
result);
+        new PixelMeasure(450), new PixelMeasure(150), new PixelMeasure(150), new PixelMeasure(150),
PixelMeasure.ZERO,
+        new PixelMeasure(300), new PixelMeasure(100), new PixelMeasure(100), new PixelMeasure(100),
PixelMeasure.ZERO},
+        result);
   }
 
   @Test
@@ -297,14 +306,15 @@
 
     long begin = System.nanoTime();
 
-    SystemOfEquations system = new SystemOfEquations(7);
+    SystemOfEquations system = new SystemOfEquations(8);
     system.addEqualsEquation(new FixedEquation(0, new PixelMeasure(310), "test"));
     system.addEqualsEquation(new PartitionEquation(1, 2, 0, new PixelMeasure(5), "test"));
     system.addEqualsEquation(new ProportionEquation(1, 2, 1, 1, "test"));
-    system.addEqualsEquation(new CombinationEquation(3, 1, 1, PixelMeasure.ZERO, "test"));
     system.addEqualsEquation(new CombinationEquation(4, 1, 1, PixelMeasure.ZERO, "test"));
-    system.addEqualsEquation(new CombinationEquation(5, 2, 1, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new CombinationEquation(5, 1, 1, PixelMeasure.ZERO, "test"));
     system.addEqualsEquation(new CombinationEquation(6, 2, 1, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new CombinationEquation(7, 2, 1, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new RemainderEquation(3, "test"));
     Measure[] result = system.solve();
 
     long end = System.nanoTime();
@@ -313,7 +323,7 @@
     LOG.info("Duration: " + new DecimalFormat().format(end - begin) + " ns");
 
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(310), new PixelMeasure(152), new PixelMeasure(153),
+        new PixelMeasure(310), new PixelMeasure(152), new PixelMeasure(153), PixelMeasure.ZERO,
         new PixelMeasure(152), new PixelMeasure(152), new PixelMeasure(153), new PixelMeasure(153)},
result);
   }
 
@@ -322,11 +332,13 @@
 
     long begin = System.nanoTime();
 
-    SystemOfEquations system = new SystemOfEquations(4);
+    SystemOfEquations system = new SystemOfEquations(6);
     system.addEqualsEquation(new FixedEquation(0, new PixelMeasure(11), "test"));
     system.addEqualsEquation(new PartitionEquation(1, 2, 0, PixelMeasure.ZERO, "test"));
     system.addEqualsEquation(new ProportionEquation(1, 2, 1, 1, "test"));
-    system.addEqualsEquation(new PartitionEquation(3, 1, 1, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new PartitionEquation(4, 1, 1, PixelMeasure.ZERO, "test"));
+    system.addEqualsEquation(new RemainderEquation(3, "test"));
+    system.addEqualsEquation(new RemainderEquation(5, "test"));
     Measure[] result = system.solve();
 
     long end = System.nanoTime();
@@ -335,7 +347,8 @@
     LOG.info("Duration: " + new DecimalFormat().format(end - begin) + " ns");
 
     Assert.assertArrayEquals(new Measure[]{
-        new PixelMeasure(11), new PixelMeasure(5), new PixelMeasure(6), new PixelMeasure(5)},
result);
+        new PixelMeasure(11), new PixelMeasure(5), new PixelMeasure(6), PixelMeasure.ZERO,
new PixelMeasure(5),
+        PixelMeasure.ZERO}, result);
   }
 
   /**



Mime
View raw message