org.apache.fop.fo.properties

Class NumberProperty

Implemented Interfaces:
Numeric
Known Direct Subclasses:
EnumNumber

public class NumberProperty
extends Property
implements Numeric

Class for handling numeric properties

Nested Class Summary

static class
NumberProperty.Maker
Inner class for making NumberProperty objects

Field Summary

Fields inherited from class org.apache.fop.fo.properties.Property

log

Constructor Summary

NumberProperty(Number num)
Constructor for Number input
NumberProperty(double num)
Constructor for double input
NumberProperty(int num)
Constructor for integer input

Method Summary

boolean
equals(Object o)
Color
getColor(FOUserAgent foUserAgent)
Convert NumberProperty to a Color.
int
getDimension()
Plain number always has a dimension of 0.
static NumberProperty
getInstance(Number num)
Returns the canonical NumberProperty instance corresponding to the given Number
static NumberProperty
getInstance(double num)
Returns the canonical NumberProperty instance corresponding to the given double
static NumberProperty
getInstance(int num)
Returns the canonical NumberProperty instance corresponding to the given int
Length
getLength()
Number
getNumber()
Numeric
getNumeric()
Convert NumberProperty to Numeric object
double
getNumericValue()
Return the value of this Numeric.
double
getNumericValue(PercentBaseContext context)
Return the value of this Numeric.
Object
getObject()
int
getValue()
int
getValue(PercentBaseContext context)
Return the value
int
hashCode()
boolean
isAbsolute()
Return true because all numbers are absolute.

Methods inherited from class org.apache.fop.fo.properties.Property

getCharacter, getColor, getCondLength, getEnum, getKeep, getLength, getLengthPair, getLengthRange, getList, getNCname, getNumber, getNumeric, getObject, getSpace, getSpecifiedValue, getString, isAuto, setSpecifiedValue, toString

Constructor Details

NumberProperty

protected NumberProperty(Number num)
Constructor for Number input
Parameters:
num - Number object value for property

NumberProperty

protected NumberProperty(double num)
Constructor for double input
Parameters:
num - double numeric value for property

NumberProperty

protected NumberProperty(int num)
Constructor for integer input
Parameters:
num - integer numeric value for property

Method Details

equals

public boolean equals(Object o)

getColor

public Color getColor(FOUserAgent foUserAgent)
Convert NumberProperty to a Color. Not sure why this is needed.
Overrides:
getColor in interface Property
Parameters:
foUserAgent - FOUserAgent
Returns:
Color that corresponds to black

getDimension

public int getDimension()
Plain number always has a dimension of 0.
Specified by:
getDimension in interface Numeric
Returns:
a dimension of 0.

getInstance

public static NumberProperty getInstance(Number num)
Returns the canonical NumberProperty instance corresponding to the given Number
Parameters:
num - the base Number
Returns:
the canonical NumberProperty

getInstance

public static NumberProperty getInstance(double num)
Returns the canonical NumberProperty instance corresponding to the given double
Parameters:
num - the base double value
Returns:
the canonical NumberProperty

getInstance

public static NumberProperty getInstance(int num)
Returns the canonical NumberProperty instance corresponding to the given int
Parameters:
num - the base int value
Returns:
the canonical NumberProperty

getLength

public Length getLength()
Overrides:
getLength in interface Property

getNumber

public Number getNumber()
Overrides:
getNumber in interface Property
Returns:
this.number cast as a Number

getNumeric

public Numeric getNumeric()
Convert NumberProperty to Numeric object
Overrides:
getNumeric in interface Property
Returns:
Numeric object corresponding to this

getNumericValue

public double getNumericValue()
Return the value of this Numeric.
Specified by:
getNumericValue in interface Numeric
Returns:
The value as a double.

getNumericValue

public double getNumericValue(PercentBaseContext context)
Return the value of this Numeric.
Specified by:
getNumericValue in interface Numeric
Parameters:
context - Evaluation context
Returns:
The value as a double.

getObject

public Object getObject()
Overrides:
getObject in interface Property
Returns:
this.number cast as an Object

getValue

public int getValue()
Specified by:
getValue in interface Numeric

getValue

public int getValue(PercentBaseContext context)
Return the value
Specified by:
getValue in interface Numeric
Parameters:
context - Evaluation context
Returns:
The value as an int.

hashCode

public int hashCode()

isAbsolute

public boolean isAbsolute()
Return true because all numbers are absolute.
Specified by:
isAbsolute in interface Numeric
Returns:
true.

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.