1 51 package org.apache.fop.datatypes; 52 53 import org.apache.fop.fo.expr.Numeric; 54 55 58 public class PercentLength extends Length { 59 60 private double factor; 61 private PercentBase lbase = null; 62 63 68 public PercentLength(double factor) { 69 this(factor, null); 70 } 71 72 public PercentLength(double factor, PercentBase lbase) { 73 this.factor = factor; 74 this.lbase = lbase; 75 } 76 77 public void setBaseLength(PercentBase lbase) { 78 this.lbase = lbase; 79 } 80 81 public PercentBase getBaseLength() { 82 return this.lbase; 83 } 84 85 89 protected void computeValue() { 90 setComputedValue((int)(factor * (double)lbase.getBaseLength())); 91 } 92 93 public double value() { 94 return factor; 95 } 96 97 public String toString() { 98 return (new Double (factor * 100.0).toString()) + "%"; 101 } 102 103 public Numeric asNumeric() { 104 return new Numeric(this); 105 } 106 107 } 108 | Popular Tags |