Package com.itextpdf.layout.properties
Class UnitValue
java.lang.Object
com.itextpdf.layout.properties.UnitValue
A specialized class that holds a value and the unit it is measured in.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic 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
int
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
Returns whether or not the value is stored in percent (%)boolean
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 objecttoString()
-
Field Details
-
POINT
public static final int POINT- See Also:
-
PERCENT
public static final int PERCENT- See Also:
-
unitType
protected int unitType -
value
protected float value
-
-
Constructor Details
-
Method Details
-
createPointValue
Creates a UnitValue POINT object with a specified value. -
createPercentValue
Creates a UnitValue PERCENT object with a specified value. -
createPercentArray
Creates an array of UnitValue PERCENT objects with specified values. -
createPercentArray
Creates an array of UnitValue PERCENT objects with equal values. -
createPointArray
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
-
hashCode
public int hashCode() -
toString
-