From b24f1ddc41ee373a07a43eb8dc6d526bd3a90a7a Mon Sep 17 00:00:00 2001 From: Peter Bernard West Date: Sun, 15 Sep 2002 05:35:17 +0000 Subject: [PATCH] Removed String expression. Removed getComputedOrSpecified(). git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/FOP_0-20-0_Alt-Design@195186 13f79535-47bb-0310-9956-ffa450edef68 --- .../apache/fop/fo/expr/PropertyTriplet.java | 133 ++++++++++-------- 1 file changed, 73 insertions(+), 60 deletions(-) diff --git a/src/org/apache/fop/fo/expr/PropertyTriplet.java b/src/org/apache/fop/fo/expr/PropertyTriplet.java index e39553730..e89cd3276 100644 --- a/src/org/apache/fop/fo/expr/PropertyTriplet.java +++ b/src/org/apache/fop/fo/expr/PropertyTriplet.java @@ -20,25 +20,49 @@ import org.apache.fop.fo.expr.PropertyException; * A PropertyTriplet is a set of possible values of an * instance of a property at a given point in the FO tree. The three * possible values are specified, computed and actual. All three values - * are represented by a subclass of PropertyValue. In addition - * the object may contain a string with the specified expression. + * are represented by a subclass of PropertyValue. *

* Values may, and frequently will be, null, especially specified and actual. */ public class PropertyTriplet { + /** The property with which this triplet is associated. */ private int property; + /** + * The specified property value. Note that this may be a + * reference to a value associated with another property, so its + * property index may be different from property. + * TODO - ensure that whenever a value is derived from another property, + * that the value is cloned and the property correctly set, rather than + * simply held here as a reference. This will render the above note + * obsolete. Same for computed and actual. + */ private PropertyValue specified; + /** + * The computed property value. Note that this may be a + * reference to a value associated with another property, so its + * property index may be different from property. + */ private PropertyValue computed; + /** + * The actual property value. Note that this may be a + * reference to a value associated with another property, so its + * property index may be different from property. + */ private PropertyValue actual; - private String expression; private boolean wasSpecified; + /** + * The FONode that stacked this triplet. This is required in + * event that later a triplet is overriden by a higher priority property + * within the same FO; e.g. when the expansion of a shorthand is + * overriden by a direct assignment. + */ private FONode stackedBy = null; public PropertyTriplet() { - // PropertyValues and expression are null + // PropertyValues are null } /** @@ -46,13 +70,11 @@ public class PropertyTriplet { * @param specified a PropertyValue. * @param computed a PropertyValue. * @param actual a PropertyValue. - * @param expression a String. * @exception PropertyException if property is not within the * range of valid property indices. */ public PropertyTriplet(int property, PropertyValue specified, - PropertyValue computed, PropertyValue actual, - String expression) + PropertyValue computed, PropertyValue actual) throws PropertyException { if (property < 0 || property > PropNames.LAST_PROPERTY_INDEX) @@ -62,7 +84,6 @@ public class PropertyTriplet { this.specified = specified; this.computed = computed; this.actual = actual; - this.expression = expression; } /** @@ -70,17 +91,15 @@ public class PropertyTriplet { * @param specified a PropertyValue. * @param computed a PropertyValue. * @param actual a PropertyValue. - * @param expression a String. * @exception PropertyException if property is not within the * range of valid property indices. */ public PropertyTriplet(String propertyName, PropertyValue specified, - PropertyValue computed, PropertyValue actual, - String expression) + PropertyValue computed, PropertyValue actual) throws PropertyException { this(PropertyConsts.getPropertyIndex(propertyName), - specified, computed, actual, expression); + specified, computed, actual); } /** @@ -90,19 +109,7 @@ public class PropertyTriplet { public PropertyTriplet(int property, PropertyValue specified) throws PropertyException { - this(property, specified, null, null, null); - } - - /** - * @param property an int property index. - * @param expression a String. - * @param specified a PropertyValue. - */ - public PropertyTriplet(int property, PropertyValue specified, - String expression) - throws PropertyException - { - this(property, specified, null, null, expression); + this(property, specified, null, null); } /** @@ -114,90 +121,99 @@ public class PropertyTriplet { (int property, PropertyValue specified, PropertyValue computed) throws PropertyException { - this(property, specified, computed, null, null); - } - - /** - * @param property an int property index. - * @param specified a PropertyValue. - * @param computed a PropertyValue. - * @param expression a String. - */ - public PropertyTriplet - (int property, PropertyValue specified, PropertyValue computed, - String expression) - throws PropertyException - { - this(property, specified, computed, null, expression); + this(property, specified, computed, null); } /** - * N.B. This sets expression to null as a side-effect. + * Set the specified value. * @param value a PropertyValue. */ public void setSpecified(PropertyValue value) { specified = value; - expression = null; } /** + * Set the computed value. * @param value a PropertyValue. - * @param expr a String, the specified expression. */ - public void setSpecified(PropertyValue value, String expr) { - specified = value; - expression = expr; - } - public void setComputed(PropertyValue value) { computed = value; } + /** + * Set the actual value. + * @param value a PropertyValue. + */ public void setActual(PropertyValue value) { actual = value; } - public String getExpression() { - return expression; - } - + /** + * Get the specified value. + * @return the specified PropertyValue. + */ public PropertyValue getSpecified() { return specified; } + /** + * Get the computed value. + * @return the computed PropertyValue. + */ public PropertyValue getComputed() { return computed; } + /** + * Get the actual value. + * @return the actual PropertyValue. + */ public PropertyValue getActual() { return actual; } - public PropertyValue getComputedOrSpecified() { - return computed != null ? computed - : specified != null ? specified : null; - } - + /** + * Get the property index associated with this triplet. + * @return the property index. + */ public int getProperty() { return property; } + /** + * Get the property index associated with the specified value. + * @return the property index. + */ public int getSpecifiedProperty() { return specified.getProperty(); } + /** + * Get the property index associated with the computed value. + * @return the property index. + */ public int getComputedProperty() { return computed.getProperty(); } + /** + * Get the property index associated with the actual value. + * @return the property index. + */ public int getActualProperty() { return actual.getProperty(); } + /** + * Retrieve the FONode that stacked this PropertyTriplet. + */ public FONode getStackedBy() { return stackedBy; } + /** + * Record the FONode that stacked this PropertyTriplet. + */ public void setStackedBy(FONode stackedBy) { this.stackedBy = stackedBy; } @@ -206,9 +222,6 @@ public class PropertyTriplet { String tmpstr = "Specified: "; if (specified != null) tmpstr += specified.toString(); else tmpstr += "null"; - tmpstr += "\nExpression: "; - if (expression != null) tmpstr += expression; - else tmpstr += "null"; tmpstr += "\nComputed: "; if (computed != null) tmpstr += computed.toString(); else tmpstr += "null"; -- 2.39.5