Package com.pdftools.geometry.units
Class Margin
- java.lang.Object
-
- com.pdftools.geometry.units.Margin
-
public class Margin extends java.lang.ObjectThe margin defines the space around elements.
The class is based on the respective distances left, bottom, right, and top of type
Length.
-
-
Constructor Summary
Constructors Constructor Description Margin(double left, double bottom, double right, double top, Length.Units unit)ConstructMarginobject from values and a common unit.Margin(double margin, Length.Units unit)Construct aMarginobject of equal marginsMargin(Length margin)Construct aMarginobject of equal marginsMargin(Length left, Length bottom, Length right, Length top)ConstructMarginobject from individual values
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)LengthgetBottom()Gets the bottom margin asLengthobject.LengthgetLeft()Gets the left margin asLengthobject.LengthgetRight()Gets the right margin asLengthobject.LengthgetTop()Gets the top margin asLengthobject.inthashCode()static Marginparse(java.lang.String value)Create aMarginobject from a string representation.java.lang.StringtoString()Creates a string representation as left-bottom-right-top-tuple with associated suitable metric units, "m", "cm" or "mm".java.lang.StringtoString(Length.Units unit)Creates a string representation as left-bottom-right-top-tuple with the specified unit.
-
-
-
Constructor Detail
-
Margin
public Margin(Length left, Length bottom, Length right, Length top)
ConstructMarginobject from individual values
-
Margin
public Margin(double left, double bottom, double right, double top, Length.Units unit)ConstructMarginobject from values and a common unit.- Parameters:
left- as numerical valuebottom- as numerical valueright- as numerical valuetop- as numerical valueunit- the unit
-
Margin
public Margin(Length margin)
Construct aMarginobject of equal margins- Parameters:
margin- asLengthtype
-
Margin
public Margin(double margin, Length.Units unit)Construct aMarginobject of equal margins- Parameters:
margin- as numerical valueunit- the unit
-
-
Method Detail
-
parse
public static Margin parse(java.lang.String value)
Create aMarginobject from a string representation.- Parameters:
value- Allowed are value-unit pairs of the form "<left_value><left_unit> <bottom_value><bottom_unit> <right_value><right_unit> <top_value><top_unit>". Example: "12.3cm 23.4mm 34.5mm 45.6mm"- Returns:
-
toString
public java.lang.String toString()
Creates a string representation as left-bottom-right-top-tuple with associated suitable metric units, "m", "cm" or "mm".- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(Length.Units unit)
Creates a string representation as left-bottom-right-top-tuple with the specified unit.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-