Class RelativeNumericProperty
java.lang.Object
org.apache.fop.fo.properties.Property
org.apache.fop.fo.expr.RelativeNumericProperty
This class represent a node in a property expression tree.
It is created when an operation involve relative expression and is used
to delay evaluation of the operation until the time where getNumericValue()
or getValue() is called.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intABSstatic final intADDITIONprivate intThe dimension of the result.static final intDIVIDEstatic final intMAXstatic final intMINstatic final intMODULOstatic final intMULTIPLYstatic final intNEGATEprivate NumericThe first (or only) operand.private NumericThe second operand.private intThe operation identifier.private static Stringstatic final intSUBTRACTION -
Constructor Summary
ConstructorsConstructorDescriptionRelativeNumericProperty(int operation, Numeric op) Constructor for a one argument operation.RelativeNumericProperty(int operation, Numeric op1, Numeric op2) Constructor for a two argument operation. -
Method Summary
Modifier and TypeMethodDescriptionbooleanintReturn the dimension of the expressionCast this numeric as a Length.This method expects to be overridden by subclassesdoubleReturn the resolved (calculated) value of the expression.doublegetNumericValue(PercentBaseContext context) Return the value of this Numericprivate NumericgetResolved(PercentBaseContext context) Return a resolved (calculated) Numeric with the value of the expression.doubleReturn the number of table units which are included in this length specification.intgetValue()Returns the length in 1/1000ths of a point (millipoints)intgetValue(PercentBaseContext context) Returns the length in 1/1000ths of a point (millipoints)inthashCode()booleanReturn false since an expression is only created when there is relative numerics involved.toString()Return a string represention of the expression.Methods inherited from class Property
getCharacter, getColor, getCondLength, getEnum, getKeep, getLengthPair, getLengthRange, getList, getNCname, getNumber, getObject, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue
-
Field Details
-
ADDITION
public static final int ADDITIONADDITION- See Also:
-
SUBTRACTION
public static final int SUBTRACTIONSUBTRACTION- See Also:
-
MULTIPLY
public static final int MULTIPLYMULTIPLY- See Also:
-
DIVIDE
public static final int DIVIDEDIVIDE- See Also:
-
MODULO
public static final int MODULOMODULO- See Also:
-
NEGATE
public static final int NEGATENEGATE- See Also:
-
ABS
public static final int ABSABS- See Also:
-
MAX
public static final int MAXMAX- See Also:
-
MIN
public static final int MINMIN- See Also:
-
operations
-
operation
private int operationThe operation identifier. -
op1
The first (or only) operand. -
op2
The second operand. -
dimension
private int dimensionThe dimension of the result.
-
-
Constructor Details
-
RelativeNumericProperty
-
RelativeNumericProperty
Constructor for a one argument operation.- Parameters:
operation- the operation opcode: NEGATE, ABSop- the operand.
-
-
Method Details
-
getResolved
Return a resolved (calculated) Numeric with the value of the expression.- Parameters:
context- Evaluation context- Returns:
- the resolved
Numericcorresponding to the value of the expression - Throws:
PropertyException- when an exception occur during evaluation.
-
getNumericValue
public double getNumericValue()Return the resolved (calculated) value of the expression. Return the value of this Numeric- Specified by:
getNumericValuein interfaceNumeric- Returns:
- the computed value.
-
getNumericValue
Return the value of this Numeric- Specified by:
getNumericValuein interfaceNumeric- Parameters:
context- The context for the length calculation (for percentage based lengths)- Returns:
- the computed value.
-
getDimension
public int getDimension()Return the dimension of the expression- Specified by:
getDimensionin interfaceNumeric- Returns:
- numeric value as dimension
-
isAbsolute
public boolean isAbsolute()Return false since an expression is only created when there is relative numerics involved.- Specified by:
isAbsolutein interfaceNumeric- Returns:
- true if expression is absolute
-
getLength
-
getNumeric
Description copied from class:PropertyThis method expects to be overridden by subclasses- Overrides:
getNumericin classProperty- Returns:
- numeric value
-
getValue
-
getValue
Returns the length in 1/1000ths of a point (millipoints) -
getTableUnits
public double getTableUnits()Return the number of table units which are included in this length specification. This will always be 0 unless the property specification used the proportional-column-width() function (only on table column FOs).If this value is not 0, the actual value of the Length cannot be known without looking at all of the columns in the table to determine the value of a "table-unit".
- Returns:
- The number of table units which are included in this length specification.
-
toString
-
hashCode
-
equals
-