Package com.itextpdf.layout.properties
Class UnitValue
- java.lang.Object
-
- com.itextpdf.layout.properties.UnitValue
-
public class UnitValue extends java.lang.ObjectA specialized class that holds a value and the unit it is measured in.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnitValue[]createPercentArray(float[] values)Creates an array of UnitValue PERCENT objects with specified values.static UnitValue[]createPercentArray(int size)Creates an array of UnitValue PERCENT objects with equal values.static UnitValuecreatePercentValue(float value)Creates a UnitValue PERCENT object with a specified value.static UnitValue[]createPointArray(float[] values)Creates an array of UnitValue POINT objects with specified values.static UnitValuecreatePointValue(float value)Creates a UnitValue POINT object with a specified value.booleanequals(java.lang.Object obj)intgetUnitType()Returns the unit this value is stored in, either points (pt) or percent(%)floatgetValue()Gets the measured value stored in this objectinthashCode()booleanisPercentValue()Returns whether or not the value is stored in percent (%)booleanisPointValue()Returns whether or not the value is stored in points (pt)voidsetUnitType(int unitType)Sets the unit this value is stored in, either points (pt) or percent(%)voidsetValue(float value)Sets the measured value stored in this objectjava.lang.StringtoString()
-
-
-
Field Detail
-
POINT
public static final int POINT
- See Also:
- Constant Field Values
-
PERCENT
public static final int PERCENT
- See Also:
- Constant Field Values
-
unitType
protected int unitType
-
value
protected float value
-
-
Constructor Detail
-
UnitValue
public UnitValue(int unitType, float value)Creates a UnitValue object with a specified type and value.
-
UnitValue
public UnitValue(UnitValue unitValue)
Creates a copy of UnitValue object.- Parameters:
unitValue- the value to be stored
-
-
Method Detail
-
createPointValue
public static UnitValue createPointValue(float value)
Creates a UnitValue POINT object with a specified value.
-
createPercentValue
public static UnitValue createPercentValue(float value)
Creates a UnitValue PERCENT object with a specified value.
-
createPercentArray
public static UnitValue[] createPercentArray(float[] values)
Creates an array of UnitValue PERCENT objects with specified values.
-
createPercentArray
public static UnitValue[] createPercentArray(int size)
Creates an array of UnitValue PERCENT objects with equal values.
-
createPointArray
public static UnitValue[] createPointArray(float[] values)
Creates an array of UnitValue POINT objects with specified values.
-
getUnitType
public int getUnitType()
Returns the unit this value is stored in, either points (pt) or percent(%)
-
setUnitType
public void setUnitType(int unitType)
Sets the unit this value is stored in, either points (pt) or percent(%)
-
getValue
public float getValue()
Gets the measured value stored in this object- Returns:
- the value, as a
float
-
setValue
public void setValue(float value)
Sets the measured value stored in this object- Parameters:
value- afloat
-
isPointValue
public boolean isPointValue()
Returns whether or not the value is stored in points (pt)- Returns:
trueif stored in points
-
isPercentValue
public boolean isPercentValue()
Returns whether or not the value is stored in percent (%)- Returns:
trueif stored in percent
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-