Package org.apache.fop.fo.properties
Class NumberProperty
java.lang.Object
org.apache.fop.fo.properties.Property
org.apache.fop.fo.properties.NumberProperty
- All Implemented Interfaces:
Numeric
Class for handling numeric properties
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class for making NumberProperty objectsstatic classA positive integer property maker. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final PropertyCache<NumberProperty> cache holding all canonical NumberProperty instancesprivate final Number -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateNumberProperty(double num) Constructor for double inputprivateNumberProperty(int num) Constructor for integer input -
Method Summary
Modifier and TypeMethodDescriptionbooleangetColor(FOUserAgent foUserAgent) Convert NumberProperty to a Color.intPlain number always has a dimension of 0.static NumberPropertygetInstance(double num) Returns the canonical NumberProperty instance corresponding to the given doublestatic NumberPropertygetInstance(int num) Returns the canonical NumberProperty instance corresponding to the given intstatic NumberPropertygetInstance(Double num) Returns the canonical NumberProperty instance corresponding to the given Numberstatic NumberPropertygetInstance(Integer num) Returns the canonical NumberProperty instance corresponding to the given IntegerThis method expects to be overridden by subclassesThis method expects to be overridden by subclassesConvert NumberProperty to Numeric objectdoubleReturn the value of this Numeric.doublegetNumericValue(PercentBaseContext context) Return the value of this Numeric.This method expects to be overridden by subclassesintgetValue()Returns the value of this numeric as an int.intgetValue(PercentBaseContext context) Return the valueinthashCode()booleanReturn true because all numbers are absolute.Methods inherited from class org.apache.fop.fo.properties.Property
getCharacter, getCondLength, getEnum, getKeep, getLengthPair, getLengthRange, getList, getNCname, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue, toString
-
Field Details
-
CACHE
cache holding all canonical NumberProperty instances -
number
-
-
Constructor Details
-
NumberProperty
private NumberProperty(double num) Constructor for double input- Parameters:
num- double numeric value for property
-
NumberProperty
private NumberProperty(int num) Constructor for integer input- Parameters:
num- integer numeric value for property
-
-
Method Details
-
getInstance
Returns the canonical NumberProperty instance corresponding to the given Number- Parameters:
num- the base Double- Returns:
- the canonical NumberProperty
-
getInstance
Returns the canonical NumberProperty instance corresponding to the given Integer- Parameters:
num- the base Integer- Returns:
- the canonical NumberProperty
-
getInstance
Returns the canonical NumberProperty instance corresponding to the given double- Parameters:
num- the base double value- Returns:
- the canonical NumberProperty
-
getInstance
Returns the canonical NumberProperty instance corresponding to the given int- Parameters:
num- the base int value- Returns:
- the canonical NumberProperty
-
getDimension
public int getDimension()Plain number always has a dimension of 0.- Specified by:
getDimensionin interfaceNumeric- Returns:
- a dimension of 0.
-
getNumericValue
public double getNumericValue()Return the value of this Numeric.- Specified by:
getNumericValuein interfaceNumeric- Returns:
- The value as a double.
-
getNumericValue
Return the value of this Numeric.- Specified by:
getNumericValuein interfaceNumeric- Parameters:
context- Evaluation context- Returns:
- The value as a double.
-
getValue
public int getValue()Returns the value of this numeric as an int. -
getValue
Return the value -
isAbsolute
public boolean isAbsolute()Return true because all numbers are absolute.- Specified by:
isAbsolutein interfaceNumeric- Returns:
- true.
-
getNumber
Description copied from class:PropertyThis method expects to be overridden by subclasses -
getObject
Description copied from class:PropertyThis method expects to be overridden by subclasses -
getNumeric
Convert NumberProperty to Numeric object- Overrides:
getNumericin classProperty- Returns:
- Numeric object corresponding to this
-
getLength
This method expects to be overridden by subclasses -
getColor
Convert NumberProperty to a Color. Not sure why this is needed. -
equals
-
hashCode
public int hashCode()
-