aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/expr/MinFunction.java
diff options
context:
space:
mode:
authorFinn Bock <bckfnn@apache.org>2004-02-26 15:33:42 +0000
committerFinn Bock <bckfnn@apache.org>2004-02-26 15:33:42 +0000
commit4da95ec834623cd0927311fb92243815156efd2b (patch)
treefbd3ef400749b45c7c413cb19ee609a027e97052 /src/java/org/apache/fop/fo/expr/MinFunction.java
parent527ca4bef01d01d759eb0a3eb10e019fb8048b7a (diff)
downloadxmlgraphics-fop-4da95ec834623cd0927311fb92243815156efd2b.tar.gz
xmlgraphics-fop-4da95ec834623cd0927311fb92243815156efd2b.zip
Support for percentages in property expression.
The different length properties all implement a Length interface and all clients of the property subsystem must use the Length interface when retrieving lengths. The two different numerics (absolute and relative) both implement a Numeric interface and all property calculations are done in terms of the Numeric interface. Lengths can be cast to numeric and can thus participate in expresions and numerics can be cast to length (when dimension is 1) and can thus be used as a length by the clients. The call to Length.getValue() will cause relative lengths to be resolved against their base length, and care must be taken to ensure that getLength() is only called after all baselength has been assigned to the FO elements. PR: 26778 (first part). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197380 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/expr/MinFunction.java')
-rw-r--r--src/java/org/apache/fop/fo/expr/MinFunction.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/java/org/apache/fop/fo/expr/MinFunction.java b/src/java/org/apache/fop/fo/expr/MinFunction.java
index 6ddaa0ba3..e0cfaca8d 100644
--- a/src/java/org/apache/fop/fo/expr/MinFunction.java
+++ b/src/java/org/apache/fop/fo/expr/MinFunction.java
@@ -50,6 +50,7 @@
*/
package org.apache.fop.fo.expr;
+import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.properties.Property;
/**
@@ -74,13 +75,13 @@ public class MinFunction extends FunctionBase {
*/
public Property eval(Property[] args,
PropertyInfo pInfo) throws PropertyException {
- NumericProperty n1 = args[0].getNumeric();
- NumericProperty n2 = args[1].getNumeric();
+ Numeric n1 = args[0].getNumeric();
+ Numeric n2 = args[1].getNumeric();
if (n1 == null || n2 == null) {
throw new PropertyException("Non numeric operands to min function");
}
- return n1.min(n2);
- }
+ return (Property) NumericOp.min(n1, n2);
+ }
}