Class NumericProperty

  • All Implemented Interfaces:
    Length, Numeric

    public class NumericProperty
    extends Property
    implements Numeric, Length
    A numeric property which hold the final absolute result of an expression calculations.
    • Constructor Detail

      • NumericProperty

        protected NumericProperty​(double value,
                                  int dim)
        Construct a Numeric object by specifying one or more components, including absolute length, percent length, table units.
        Parameters:
        value - The value of the numeric.
        dim - The dimension of the value. 0 for a Number, 1 for a Length (any type), >1, <0 if Lengths have been multiplied or divided.
    • Method Detail

      • getDimension

        public int getDimension()
        Return the dimension. 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.
        Specified by:
        getDimension in interface Numeric
        Returns:
        the dimension.
      • getNumericValue

        public double getNumericValue()
        Return the value. Return the value of this Numeric
        Specified by:
        getNumericValue in interface Numeric
        Returns:
        the computed value.
      • getNumericValue

        public double getNumericValue​(PercentBaseContext context)
        Return the value of this Numeric
        Specified by:
        getNumericValue in interface Numeric
        Parameters:
        context - The context for the length calculation (for percentage based lengths)
        Returns:
        the computed value.
      • isAbsolute

        public boolean isAbsolute()
        Return true of the numeric is absolute. Return true if the numeric is an absolute value. Relative values are percentages and table-column-units. All other numerics are absolute.
        Specified by:
        isAbsolute in interface Numeric
        Returns:
        true when the numeric is absolute.
      • getNumeric

        public Numeric getNumeric()
        This method expects to be overridden by subclasses
        Overrides:
        getNumeric in class Property
        Returns:
        Numeric property value
      • getNumber

        public java.lang.Number getNumber()
        This method expects to be overridden by subclasses
        Overrides:
        getNumber in class Property
        Returns:
        Number property value
      • getValue

        public int getValue()
        Returns the value of this numeric as an int.
        Specified by:
        getValue in interface Length
        Specified by:
        getValue in interface Numeric
        Returns:
        the value as an integer.
      • getValue

        public int getValue​(PercentBaseContext context)
        Returns the value of this numeric as an int.
        Specified by:
        getValue in interface Length
        Specified by:
        getValue in interface Numeric
        Parameters:
        context - the context for the length calculation (for percentage based lengths)
        Returns:
        the value as an integer.
      • getLength

        public Length getLength()
        This method expects to be overridden by subclasses
        Overrides:
        getLength in class Property
        Returns:
        Length property value
      • getColor

        public java.awt.Color getColor​(FOUserAgent foUserAgent)
        This method expects to be overridden by subclasses
        Overrides:
        getColor in class Property
        Parameters:
        foUserAgent - FOP user agent
        Returns:
        ColorType property value
      • getObject

        public java.lang.Object getObject()
        This method expects to be overridden by subclasses
        Overrides:
        getObject in class Property
        Returns:
        Object property value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class Property
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object