1 51 package org.apache.fop.datatypes; 52 53 import java.util.ArrayList ; 54 55 public class LinearCombinationLength extends Length { 56 57 protected ArrayList factors; 58 protected ArrayList lengths; 59 60 public LinearCombinationLength() { 61 factors = new ArrayList (); 62 lengths = new ArrayList (); 63 } 64 65 public void addTerm(double factor, Length length) { 66 factors.add(new Double (factor)); 67 lengths.add(length); 68 } 69 70 73 public void computeValue() { 74 int result = 0; 75 int numFactors = factors.size(); 76 for (int i = 0; i < numFactors; ++i) { 77 result += 78 (int)(((Double )factors.get(i)).doubleValue() 79 * (double)((Length)lengths.get(i)).mvalue()); 80 } 81 setComputedValue(result); 82 } 83 84 } 85 | Popular Tags |