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:
CSSNumberValue,CSSPrimitiveValue,CSSTypedValue,CSSValue,CSSVal,TypedValue,Value,Serializable,Cloneable,CSSNumericValue,CSSStyleValue,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.CSSNumericTypeNested classes/interfaces inherited from interface io.sf.carte.doc.style.css.CSSValue
CSSValue.CssType, CSSValue.Type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()Create and return a copy of this object.static FloatValuecreateConstant(short unit, float value) Create a constant with the given unit and value.booleanA string representation of the current value.static StringgetCssText(short unit, float value) Returns the CSS text associated with the given type/value pair.floatReturns the float value.The type of the value.getUnit()Gets the unit string.shortGets the css unit as in CSS4J'sCSSUnit.doublegetValue()Gets the numeric value in the units represented by this object.inthashCode()booleanbooleanbooleanvoidvoidsetCalculatedNumber(boolean calculated) Sets whether this number is the result of a calculation.voidsetCssText(String cssText) voidvoidsetValue(double value) Set the numeric value in the units represented by this object.voidConverts this value into one in the given unit.Methods inherited from class io.sf.carte.echosvg.css.engine.value.NumericValue
typeMethods inherited from class io.sf.carte.echosvg.css.engine.value.AbstractValue
createDOMException, getColorValue, getCounterValue, getCssValueType, getIdentifierValue, getLength, getModificationHandler, getRectValue, getStringValue, getURIValue, setFloatValue, setModificationHandler, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface io.sf.carte.doc.style.css.CSSNumberValue
setMaximumFractionDigitsMethods inherited from interface org.w3c.css.om.typed.CSSNumericValue
typeMethods inherited from interface io.sf.carte.doc.style.css.CSSPrimitiveValue
isPrimitiveValueMethods inherited from interface org.w3c.css.om.typed.CSSStyleValue
toStringMethods inherited from interface io.sf.carte.doc.style.css.CSSTypedValue
getStringValue, toRGBColorValueMethods inherited from interface io.sf.carte.echosvg.css.engine.value.CSSVal
getIdentifierValue, getLength, getURIValue, matches, writeCssTextMethods inherited from interface io.sf.carte.doc.style.css.CSSValue
getCssValueType, getMinifiedCssText, getMinifiedCssText, getPrecedingComments, getTrailingCommentsMethods inherited from interface io.sf.carte.echosvg.css.engine.value.TypedValue
getFloatValue, getStringValue, setFloatValue, setStringValue, toRGBColorMethods inherited from interface io.sf.carte.echosvg.css.engine.value.Value
getColorValue, getCounterValue, getIdentifier, getModificationHandler, getRectValue, isComponent, isIdentifier, item, iterator, 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
The type of the value.- Specified by:
getPrimitiveTypein interfaceCSSValue
-
getUnitType
public short getUnitType()Description copied from interface:ValueGets the css unit as in CSS4J'sCSSUnit.If the value has no valid CSS unit, returns
CSSUnit.CSS_INVALID.- Specified by:
getUnitTypein interfaceCSSPrimitiveValue- Specified by:
getUnitTypein interfaceTypedValue- Specified by:
getUnitTypein interfaceValue- Returns:
- the css unit as in CSS4J's
CSSUnit.
-
getFloatValue
public float getFloatValue()Returns the float value.- Specified by:
getFloatValuein interfaceCSSTypedValue- Specified by:
getFloatValuein interfaceCSSVal- Specified by:
getFloatValuein interfaceTypedValue- Overrides:
getFloatValuein classAbstractValue- Returns:
- the float value.
-
getValue
public double getValue()Description copied from interface:CSSUnitValueGets the numeric value in the units represented by this object.- Specified by:
getValuein interfaceCSSUnitValue- Returns:
- the numeric value.
-
setValue
public void setValue(double value) Description copied from interface:CSSUnitValueSet the numeric value in the units represented by this object.- Specified by:
setValuein interfaceCSSUnitValue- Parameters:
value- the numeric value.
-
setValue
- Throws:
DOMException
-
getUnit
Description copied from interface:CSSUnitValueGets the unit string.- Specified by:
getUnitin interfaceCSSUnitValue- Returns:
- the unit string.
-
getCssText
A string representation of the current value.- Specified by:
getCssTextin interfaceCSSValue
-
setCssText
- Specified by:
setCssTextin interfaceCSSValue- Overrides:
setCssTextin classAbstractValue- Throws:
DOMException
-
isCalculatedNumber
public boolean isCalculatedNumber()- Specified by:
isCalculatedNumberin interfaceCSSTypedValue- Specified by:
isCalculatedNumberin interfaceTypedValue
-
setCalculatedNumber
public void setCalculatedNumber(boolean calculated) Sets whether this number is the result of a calculation.- Specified by:
setCalculatedNumberin interfaceCSSNumberValue- Parameters:
calculated-trueif this number was calculated.
-
setExpectInteger
- Specified by:
setExpectIntegerin interfaceCSSPrimitiveValue- Specified by:
setExpectIntegerin interfaceTypedValue- Throws:
DOMException
-
roundToInteger
- Specified by:
roundToIntegerin interfaceCSSNumberValue- Throws:
DOMException
-
isNegativeNumber
public boolean isNegativeNumber()- Specified by:
isNegativeNumberin interfaceCSSPrimitiveValue
-
isNumberZero
public boolean isNumberZero()- Specified by:
isNumberZeroin interfaceCSSTypedValue- Specified by:
isNumberZeroin interfaceTypedValue
-
hashCode
public int hashCode()- Overrides:
hashCodein classAbstractValue
-
equals
- Overrides:
equalsin classAbstractValue
-
to
Description copied from interface:CSSNumericValueConverts this value into one in the given unit.- Specified by:
toin interfaceCSSNumericValue- Parameters:
unit- the unit.- Returns:
- the new converted value,
-
clone
Description copied from interface:ValueCreate and return a copy of this object.If this object is unmodifiable, the clone will be modifiable.
- Specified by:
clonein interfaceCSSTypedValue- Specified by:
clonein interfaceCSSVal- Specified by:
clonein interfaceCSSValue- Specified by:
clonein interfaceTypedValue- Specified by:
clonein interfaceValue- Overrides:
clonein classNumericValue- Returns:
- a modifiable copy of this object.
-