java.lang.Object
io.sf.carte.echosvg.css.engine.value.AbstractValue
io.sf.carte.echosvg.css.engine.value.NumericValue
io.sf.carte.echosvg.css.engine.value.FloatValue
- All Implemented Interfaces:
io.sf.carte.doc.style.css.CSSNumberValue
,io.sf.carte.doc.style.css.CSSPrimitiveValue
,io.sf.carte.doc.style.css.CSSTypedValue
,io.sf.carte.doc.style.css.CSSValue
,CSSVal
,TypedValue
,Value
,Serializable
,Cloneable
,CSSNumericValue
,CSSStyleValue
,CSSUnitValue
public class FloatValue
extends NumericValue
implements io.sf.carte.doc.style.css.CSSNumberValue, CSSUnitValue
This class represents float values.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.w3c.css.om.typed.CSSNumericValue
CSSNumericValue.CSSNumericBaseType, CSSNumericValue.CSSNumericType
Nested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSValue
io.sf.carte.doc.style.css.CSSValue.CssType, io.sf.carte.doc.style.css.CSSValue.Type
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()
Create and return a copy of this object.static FloatValue
createConstant
(short unit, float value) Create a constant with the given unit and value.boolean
A string representation of the current value.static String
getCssText
(short unit, float value) Returns the CSS text associated with the given type/value pair.float
Returns the float value.io.sf.carte.doc.style.css.CSSValue.Type
The type of the value.getUnit()
Gets the unit string.short
Gets the css unit as in CSS4J'sCSSUnit
.double
getValue()
Gets the numeric value in the units represented by this object.int
hashCode()
boolean
boolean
boolean
void
void
setCalculatedNumber
(boolean calculated) Sets whether this number is the result of a calculation.void
setCssText
(String cssText) void
void
setValue
(double value) Set the numeric value in the units represented by this object.void
Converts this value into one in the given unit.Methods inherited from class io.sf.carte.echosvg.css.engine.value.NumericValue
type
Methods inherited from class io.sf.carte.echosvg.css.engine.value.AbstractValue
createDOMException, getColorValue, getCounterValue, getCssValueType, getIdentifierValue, getLength, getModificationHandler, getRectValue, getStringValue, getURIValue, setFloatValue, setModificationHandler, toString
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.w3c.css.om.typed.CSSNumericValue
type
Methods inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue
isPrimitiveValue
Methods inherited from interface org.w3c.css.om.typed.CSSStyleValue
toString
Methods inherited from interface io.sf.carte.doc.style.css.CSSTypedValue
getStringValue, toRGBColorValue
Methods inherited from interface io.sf.carte.echosvg.css.engine.value.CSSVal
getIdentifierValue, getLength, getStringValue, getURIValue, matches, writeCssText
Methods inherited from interface io.sf.carte.doc.style.css.CSSValue
getCssValueType, getMinifiedCssText, getMinifiedCssText
Methods inherited from interface io.sf.carte.echosvg.css.engine.value.TypedValue
getFloatValue, setFloatValue, setStringValue, toRGBColor
Methods inherited from interface io.sf.carte.echosvg.css.engine.value.Value
getColorValue, getCounterValue, getIdentifier, getModificationHandler, getRectValue, isComponent, isIdentifier, item, setFloatValue, setModificationHandler
-
Constructor Details
-
FloatValue
public FloatValue(short unitType, float floatValue) Creates a new value.- Parameters:
unitType
- the unit.floatValue
- the value expressed in that unit.
-
-
Method Details
-
getCssText
Returns the CSS text associated with the given type/value pair. -
createConstant
Create a constant with the given unit and value.If you want to have a modifiable copy of the returned value, clone it.
- Parameters:
unit
- the unit.value
- the value expressed in that unit.- Returns:
- the immutable value.
-
getPrimitiveType
public io.sf.carte.doc.style.css.CSSValue.Type getPrimitiveType()The type of the value.- Specified by:
getPrimitiveType
in interfaceio.sf.carte.doc.style.css.CSSValue
-
getUnitType
public short getUnitType()Description copied from interface:Value
Gets the css unit as in CSS4J'sCSSUnit
.If the value has no valid CSS unit, returns
CSSUnit.CSS_INVALID
.- Specified by:
getUnitType
in interfaceio.sf.carte.doc.style.css.CSSPrimitiveValue
- Specified by:
getUnitType
in interfaceTypedValue
- Specified by:
getUnitType
in interfaceValue
- Returns:
- the css unit as in CSS4J's
CSSUnit
.
-
getFloatValue
public float getFloatValue()Returns the float value.- Specified by:
getFloatValue
in interfaceio.sf.carte.doc.style.css.CSSTypedValue
- Specified by:
getFloatValue
in interfaceCSSVal
- Specified by:
getFloatValue
in interfaceTypedValue
- Overrides:
getFloatValue
in classAbstractValue
- Returns:
- the float value.
-
getValue
public double getValue()Description copied from interface:CSSUnitValue
Gets the numeric value in the units represented by this object.- Specified by:
getValue
in interfaceCSSUnitValue
- Returns:
- the numeric value.
-
setValue
public void setValue(double value) Description copied from interface:CSSUnitValue
Set the numeric value in the units represented by this object.- Specified by:
setValue
in interfaceCSSUnitValue
- Parameters:
value
- the numeric value.
-
setValue
- Throws:
DOMException
-
getUnit
Description copied from interface:CSSUnitValue
Gets the unit string.- Specified by:
getUnit
in interfaceCSSUnitValue
- Returns:
- the unit string.
-
getCssText
A string representation of the current value.- Specified by:
getCssText
in interfaceio.sf.carte.doc.style.css.CSSValue
-
setCssText
- Specified by:
setCssText
in interfaceio.sf.carte.doc.style.css.CSSValue
- Overrides:
setCssText
in classAbstractValue
- Throws:
DOMException
-
isCalculatedNumber
public boolean isCalculatedNumber()- Specified by:
isCalculatedNumber
in interfaceio.sf.carte.doc.style.css.CSSTypedValue
- Specified by:
isCalculatedNumber
in interfaceTypedValue
-
setCalculatedNumber
public void setCalculatedNumber(boolean calculated) Sets whether this number is the result of a calculation.- Specified by:
setCalculatedNumber
in interfaceio.sf.carte.doc.style.css.CSSNumberValue
- Parameters:
calculated
-true
if this number was calculated.
-
setExpectInteger
- Specified by:
setExpectInteger
in interfaceio.sf.carte.doc.style.css.CSSPrimitiveValue
- Specified by:
setExpectInteger
in interfaceTypedValue
- Throws:
DOMException
-
roundToInteger
- Specified by:
roundToInteger
in interfaceio.sf.carte.doc.style.css.CSSNumberValue
- Throws:
DOMException
-
isNegativeNumber
public boolean isNegativeNumber()- Specified by:
isNegativeNumber
in interfaceio.sf.carte.doc.style.css.CSSPrimitiveValue
-
isNumberZero
public boolean isNumberZero()- Specified by:
isNumberZero
in interfaceio.sf.carte.doc.style.css.CSSTypedValue
- Specified by:
isNumberZero
in interfaceTypedValue
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAbstractValue
-
equals
- Overrides:
equals
in classAbstractValue
-
to
Description copied from interface:CSSNumericValue
Converts this value into one in the given unit.- Specified by:
to
in interfaceCSSNumericValue
- Parameters:
unit
- the unit.- Returns:
- the new converted value,
-
clone
Description copied from interface:Value
Create and return a copy of this object.If this object is unmodifiable, the clone will be modifiable.
- Specified by:
clone
in interfaceio.sf.carte.doc.style.css.CSSTypedValue
- Specified by:
clone
in interfaceCSSVal
- Specified by:
clone
in interfaceio.sf.carte.doc.style.css.CSSValue
- Specified by:
clone
in interfaceTypedValue
- Specified by:
clone
in interfaceValue
- Overrides:
clone
in classNumericValue
- Returns:
- a modifiable copy of this object.
-