Package org.apache.fop.datatypes
Interface Numeric
-
- All Known Subinterfaces:
Length
- All Known Implementing Classes:
EnumLength,EnumNumber,FixedLength,LengthProperty,NumberProperty,NumericProperty,PercentLength,RelativeNumericProperty,TableColLength
public interface NumericAn interface for classes that can participate in numeric operations. All the numeric operation (+, -, *, ...) are expressed in terms of this Numeric interface. Numerics has a value (getNumericValue) and a dimension (getDimension). Numerics can be either absolute or relative. Relative numerics must be resolved against base value before the value can be used.To support relative numerics internally in the expression parser and during evaluation one additional methods exists: isAbsolute() which return true for absolute numerics and false for relative numerics.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetDimension()Return the dimension of this numeric.intgetEnum()Return the enum value that is stored in this numeric.doublegetNumericValue()Return the value of this NumericdoublegetNumericValue(PercentBaseContext context)Return the value of this NumericintgetValue()Returns the value of this numeric as an int.intgetValue(PercentBaseContext context)Returns the value of this numeric as an int.booleanisAbsolute()Return true if the numeric is an absolute value.
-
-
-
Method Detail
-
getNumericValue
double getNumericValue()
Return the value of this Numeric- Returns:
- the computed value.
-
getNumericValue
double getNumericValue(PercentBaseContext context)
Return the value of this Numeric- Parameters:
context- The context for the length calculation (for percentage based lengths)- Returns:
- the computed value.
-
getDimension
int getDimension()
Return the dimension of this numeric. Plain numbers has a dimension of 0 and length has a dimension of 1. Other dimension can occur as a result of multiplications and divisions.- Returns:
- the dimension.
-
isAbsolute
boolean isAbsolute()
Return true if the numeric is an absolute value. Relative values are percentages and table-column-units. All other numerics are absolute.- Returns:
- true when the numeric is absolute.
-
getValue
int getValue()
Returns the value of this numeric as an int.- Returns:
- the value as an integer.
-
getValue
int getValue(PercentBaseContext context)
Returns the value of this numeric as an int.- Parameters:
context- the context for the length calculation (for percentage based lengths)- Returns:
- the value as an integer.
-
getEnum
int getEnum()
Return the enum value that is stored in this numeric.- Returns:
- the enum value
-
-