Package com.itextpdf.layout.properties
Class UnitValue
- java.lang.Object
-
- com.itextpdf.layout.properties.UnitValue
-
public class UnitValue extends java.lang.Object
A 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 UnitValue
createPercentValue(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 UnitValue
createPointValue(float value)
Creates a UnitValue POINT object with a specified value.boolean
equals(java.lang.Object obj)
int
getUnitType()
Returns the unit this value is stored in, either points (pt) or percent(%)float
getValue()
Gets the measured value stored in this objectint
hashCode()
boolean
isPercentValue()
Returns whether or not the value is stored in percent (%)boolean
isPointValue()
Returns whether or not the value is stored in points (pt)void
setUnitType(int unitType)
Sets the unit this value is stored in, either points (pt) or percent(%)void
setValue(float value)
Sets the measured value stored in this objectjava.lang.String
toString()
-
-
-
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:
true
if stored in points
-
isPercentValue
public boolean isPercentValue()
Returns whether or not the value is stored in percent (%)- Returns:
true
if stored in percent
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-