org.apache.batik.css.value
Class ImmutableFloat

java.lang.Object
  |
  +--org.apache.batik.css.value.AbstractImmutableValue
        |
        +--org.apache.batik.css.value.AbstractImmutablePrimitiveValue
              |
              +--org.apache.batik.css.value.ImmutableFloat
All Implemented Interfaces:
ImmutableValue

public class ImmutableFloat
extends AbstractImmutablePrimitiveValue

This class represents immutable CSS float values


Field Summary
protected  float floatValue
          The float value
protected static java.lang.String[] UNITS
          The unit types representations
protected  short unitType
          The unit type
 
Constructor Summary
ImmutableFloat(short unitType, float floatValue)
          Creates a new value.
 
Method Summary
 ImmutableValue createReadOnlyCopy()
          Returns a deep read-only copy of this object.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this one.
 java.lang.String getCssText()
          A string representation of the current value.
 float getFloatValue(short unitType)
          This method is used to get a float value in a specified unit.
 short getPrimitiveType()
          The type of the value as defined by the constants specified in CSSPrimitiveValue.
protected static java.lang.String getUnitRepresentation(short unitType)
          Returns the representation for the given unit type.
protected  float toCentimeters()
          Converts the current value into centimeters.
protected  float toDegrees()
          Converts the current value into degrees.
protected  float toGradians()
          Converts the current value into gradians.
protected  float toHertz()
          Converts the current value into Hertz.
protected  float toInches()
          Converts the current value into inches.
protected  float tokHertz()
          Converts the current value into kHertz.
protected  float toMillimeters()
          Converts the current value into millimeters.
protected  float toMilliseconds()
          Converts the current value into milliseconds.
protected  float toPicas()
          Converts the current value into picas.
protected  float toPoints()
          Converts the current value into points.
protected  float toRadians()
          Converts the current value into radians.
protected  float toSeconds()
          Converts the current value into seconds.
 
Methods inherited from class org.apache.batik.css.value.AbstractImmutablePrimitiveValue
getCssValueType
 
Methods inherited from class org.apache.batik.css.value.AbstractImmutableValue
getCounterValue, getLength, getRectValue, getRGBColorValue, getStringValue, item
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNITS

protected static final java.lang.String[] UNITS
The unit types representations

floatValue

protected float floatValue
The float value

unitType

protected short unitType
The unit type
Constructor Detail

ImmutableFloat

public ImmutableFloat(short unitType,
                      float floatValue)
Creates a new value.
Method Detail

equals

public boolean equals(java.lang.Object obj)
Indicates whether some other object is "equal to" this one.
Overrides:
equals in class java.lang.Object
Parameters:
obj - the reference object with which to compare.

createReadOnlyCopy

public ImmutableValue createReadOnlyCopy()
Returns a deep read-only copy of this object.

getPrimitiveType

public short getPrimitiveType()
The type of the value as defined by the constants specified in CSSPrimitiveValue.
Overrides:
getPrimitiveType in class AbstractImmutablePrimitiveValue

getCssText

public java.lang.String getCssText()
A string representation of the current value.

getFloatValue

public float getFloatValue(short unitType)
                    throws DOMException
This method is used to get a float value in a specified unit.
Overrides:
getFloatValue in class AbstractImmutableValue
Following copied from class: org.apache.batik.css.value.AbstractImmutableValue
Throws:
DOMException - INVALID_ACCESS_ERR: Raised if the attached property doesn't support the float value or the unit type.

getUnitRepresentation

protected static java.lang.String getUnitRepresentation(short unitType)
                                                 throws DOMException
Returns the representation for the given unit type.
Parameters:
unitType - The unit type like specified in the CSSPrimitiveValue interface.

toCentimeters

protected float toCentimeters()
Converts the current value into centimeters.

toInches

protected float toInches()
Converts the current value into inches.

toMillimeters

protected float toMillimeters()
Converts the current value into millimeters.

toPoints

protected float toPoints()
Converts the current value into points.

toPicas

protected float toPicas()
Converts the current value into picas.

toDegrees

protected float toDegrees()
Converts the current value into degrees.

toRadians

protected float toRadians()
Converts the current value into radians.

toGradians

protected float toGradians()
Converts the current value into gradians.

toMilliseconds

protected float toMilliseconds()
Converts the current value into milliseconds.

toSeconds

protected float toSeconds()
Converts the current value into seconds.

toHertz

protected float toHertz()
Converts the current value into Hertz.

tokHertz

protected float tokHertz()
Converts the current value into kHertz.


Copyright © 2001 Apache Software Foundation. All Rights Reserved.