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
Fields -
Constructor Summary
Constructors -
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 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.booleanintReturns the unit this value is stored in, either points (pt) or percent(%)floatgetValue()Gets the measured value stored in this objectinthashCode()booleanReturns whether or not the value is stored in percent (%)booleanReturns 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 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:
-
trueif stored in points
-
isPercentValue
public boolean isPercentValue()Returns whether or not the value is stored in percent (%)- Returns:
-
trueif stored in percent
-
equals
-
hashCode
public int hashCode() -
toString
-