org.foray.fotree.value
Class PropertyValueStatic

java.lang.Object
  extended by org.foray.fotree.value.PropertyValueStatic
All Implemented Interfaces:
PropertyValue
Direct Known Subclasses:
PropertyCollection, PvKeyword, ValueCollection

public abstract class PropertyValueStatic
extends Object
implements PropertyValue

Abstract superclass for static property values, that is, property values that are not expressions.


Constructor Summary
PropertyValueStatic()
           
 
Method Summary
 boolean canEvalColor()
          Indicates whether this property value has the ability to express itself as a Color.
 boolean canEvalInteger()
          Indicates whether this property value has the ability to express itself as an integer Numeric item.
 boolean canEvalLength()
          Indicates whether this expression can be evaluated to a unit power = 1 (length) or not.
 boolean canEvalNumeric()
          Indicates whether this property value has the ability to express itself as a Numeric item.
 boolean canEvalPercentage()
          Indicates whether this property value can evaluate to a percentage.
 Color evalColor()
          Return the color value of "this".
 int evalInteger()
          Return this value as an int.
 IllegalStateException evalIntegerException()
          Standard exception when trying to evaluate to an Integer for a value that cannot do so.
 IllegalStateException evalKeywordException()
          Standard exception when trying to evaluate to a Keyword for a value that cannot do so.
 int evalLength(int pointSize)
          Evaluates the expression to a unit power of 1 (length).
 IllegalStateException evalLengthException()
          Standard exception when trying to evaluate to a Length for a value that cannot do so.
 double evalNumeric()
          Return the raw numeric value of "this", without regard to unit power.
 float evalPercentage()
          Returns the percentage value of this property value.
 IllegalStateException evalPercentageException()
          Standard exception when trying to evaluate to a Percentage for a value that cannot do so.
 byte getUnitPower()
          Each numeric has a "unit power".
 boolean lengthRequiresFontSize()
          Indicates whether the computation of the length will require an accurate font-size parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.foray.fotree.value.PropertyValue
canEvalKeyword, evalKeyword
 

Constructor Detail

PropertyValueStatic

public PropertyValueStatic()
Method Detail

canEvalNumeric

public boolean canEvalNumeric()
Description copied from interface: PropertyValue
Indicates whether this property value has the ability to express itself as a Numeric item.

Specified by:
canEvalNumeric in interface PropertyValue
Returns:
True iff this property value is a numeric.

evalNumeric

public double evalNumeric()
Description copied from interface: PropertyValue
Return the raw numeric value of "this", without regard to unit power.

Specified by:
evalNumeric in interface PropertyValue
Returns:
A double representation of the value of "this". Type "double" is assumed to be the lowest-common-denominator of all numeric values.

canEvalLength

public boolean canEvalLength()
Description copied from interface: PropertyValue
Indicates whether this expression can be evaluated to a unit power = 1 (length) or not.

Specified by:
canEvalLength in interface PropertyValue
Returns:
True if the expression can be evaluated to a unit power of 1 (length).

canEvalColor

public boolean canEvalColor()
Description copied from interface: PropertyValue
Indicates whether this property value has the ability to express itself as a Color.

Specified by:
canEvalColor in interface PropertyValue
Returns:
True iff this property value is a color.

evalColor

public Color evalColor()
Description copied from interface: PropertyValue
Return the color value of "this".

Specified by:
evalColor in interface PropertyValue
Returns:
The color representation of the value of "this".

getUnitPower

public byte getUnitPower()
Description copied from interface: PropertyValue
Each numeric has a "unit power". This number refers to the number of spatial dimensions in which the number operates. So, a number that has no relationship to space or refers to a point, has a length power of 0. A number that refers to length has a length power of 1 (1 dimension). Although there are none yet in XSL-FO, a number that referred to area (e.g. square inches) would, we suppose, have a length power of 2, and one referring to volume (e.g. cubic feet) would, we suppose have a length power of 3.

Specified by:
getUnitPower in interface PropertyValue
Returns:
The number of spatial dimensions in which this numeric item operates. For XSL-FO items, this should be either Expr.UNIT_POWER_NUMERIC or Expr.UNIT_POWER_LENGTH.

evalLengthException

public IllegalStateException evalLengthException()
Standard exception when trying to evaluate to a Length for a value that cannot do so.

Returns:
An appropriate Exception.

evalIntegerException

public IllegalStateException evalIntegerException()
Standard exception when trying to evaluate to an Integer for a value that cannot do so.

Returns:
An appropriate Exception.

evalKeywordException

public IllegalStateException evalKeywordException()
Standard exception when trying to evaluate to a Keyword for a value that cannot do so.

Returns:
An appropriate Exception.

evalPercentageException

public IllegalStateException evalPercentageException()
Standard exception when trying to evaluate to a Percentage for a value that cannot do so.

Returns:
An appropriate Exception.

evalLength

public int evalLength(int pointSize)
Description copied from interface: PropertyValue
Evaluates the expression to a unit power of 1 (length).

Specified by:
evalLength in interface PropertyValue
Parameters:
pointSize - The point size, in millipoints, of the font. This is used in calculations that are relative to the point size. In cases where the computation of the font-size is expensive, check PropertyValue.lengthRequiresFontSize() first. If that method returns false, zero or some other constant can safely be passed, as it will be ignored anyway.
Returns:
The unit power 1 value (length) of this expression if the expression can be so evaluated, or Integer.MIN_VALUE otherwise. The value is expressed in millipoints.

lengthRequiresFontSize

public boolean lengthRequiresFontSize()
Description copied from interface: PropertyValue
Indicates whether the computation of the length will require an accurate font-size parameter.

Specified by:
lengthRequiresFontSize in interface PropertyValue
Returns:
True iff the computation of the length will require an accurate font-size parameter.

canEvalInteger

public boolean canEvalInteger()
Description copied from interface: PropertyValue
Indicates whether this property value has the ability to express itself as an integer Numeric item.

Specified by:
canEvalInteger in interface PropertyValue
Returns:
True iff this property value is an integer.

evalInteger

public int evalInteger()
Description copied from interface: PropertyValue
Return this value as an int. This method should only be executed on instances where PropertyValue.canEvalInteger() returns true. Doing so on other instances may result in an IllegalStateException.

Specified by:
evalInteger in interface PropertyValue
Returns:
This value as an int.

canEvalPercentage

public boolean canEvalPercentage()
Description copied from interface: PropertyValue
Indicates whether this property value can evaluate to a percentage.

Specified by:
canEvalPercentage in interface PropertyValue
Returns:
True iff this property value can evaluate to a percentage.

evalPercentage

public float evalPercentage()
Description copied from interface: PropertyValue
Returns the percentage value of this property value. This method should only be executed on instances where PropertyValue.canEvalPercentage() returns true. Doing so on other instances may result in an IllegalStateException.

Specified by:
evalPercentage in interface PropertyValue
Returns:
The percentage value of this property value.


Copyright © 2017. All rights reserved.