public static class StyleParser.ScalarValue
- Object
- StyleParser.ScalarValue
Encapsulates a scalar value with a unit.
Constructors
public ScalarValue(double value, byte unit) | Creates a new scalar value given magnitude and unit. |
public ScalarValue() |
Methods
public byte getUnit() | |
public void setUnit(byte unit) | |
public double getValue() | |
public void setValue(double value) | |
public String toString() | Returns the scalar value in CN1 style string format. |
public String toString(int decimalPlaces) | Formats this scalar value (including units) but rounding to the given number of decimal places. |
public int getPixelValue() | Gets the magnitude of this scalar value in pixels. |
Inherited methods
Constructor details
ScalarValue
public ScalarValue(double value, byte unit)Creates a new scalar value given magnitude and unit.
Parameters
valuedouble- The value to set.
unitbyte- The unit of the value. One of
#UNIT_INHERIT,Style#UNIT_TYPE_DIPS,Style#UNIT_TYPE_PIXELS, orStyle#UNIT_TYPE_SCREEN_PERCENTAGE.
ScalarValue
public ScalarValue()Method details
getUnit
public byte getUnit()Returns
the unit of the value. One of
#UNIT_INHERIT, Style#UNIT_TYPE_DIPS, Style#UNIT_TYPE_PIXELS, or Style#UNIT_TYPE_SCREEN_PERCENTAGE.setUnit
public void setUnit(byte unit)Parameters
unitbyte- the unit of the value. One of
#UNIT_INHERIT,Style#UNIT_TYPE_DIPS,Style#UNIT_TYPE_PIXELS, orStyle#UNIT_TYPE_SCREEN_PERCENTAGE.
getValue
public double getValue()Returns
the value of the scalar.
setValue
public void setValue(double value)Parameters
valuedouble- the value of the scalar.
toString
public String toString()Returns the scalar value in CN1 style string format. E.g. 12mm, 3px, 5%, or inherit
toString
public String toString(int decimalPlaces)Formats this scalar value (including units) but rounding to the given number
of decimal places.
getPixelValue
public int getPixelValue()Gets the magnitude of this scalar value in pixels.