Record Class Margins
java.lang.Object
java.lang.Record
com.nsdev.lettergenerator.model.layout.Margins
- Record Components:
top- inset from the physical page's top edge, in millimetersright- inset from the physical page's right edge, in millimetersbottom- inset from the physical page's bottom edge, in millimetersleft- inset from the physical page's left edge, in millimeters
Physical-page insets in millimeters, outside both the body and reserved zones. Construction
stores values unchanged; generation requires finite nonnegative margins and usable page width and
height after margins and zones are removed.
-
Constructor Summary
ConstructorsConstructorDescriptionMargins(double top, double right, double bottom, double left) Creates an instance of aMarginsrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoublebottom()Returns the value of thebottomrecord component.static Marginsdefaults()Creates the default margins of 20 millimeters on each side.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.doubleleft()Returns the value of theleftrecord component.doubleright()Returns the value of therightrecord component.doubletop()Returns the value of thetoprecord component.final StringtoString()Returns a string representation of this record class.static Marginsuniform(double millimeters) Creates equal margins without validating their value.
-
Constructor Details
-
Margins
public Margins(double top, double right, double bottom, double left) Creates an instance of aMarginsrecord class.
-
-
Method Details
-
defaults
Creates the default margins of 20 millimeters on each side.- Returns:
- equal 20 mm margins
-
uniform
Creates equal margins without validating their value.- Parameters:
millimeters- inset to use on all four sides- Returns:
- margins carrying the supplied value on each side
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
top
public double top()Returns the value of thetoprecord component.- Returns:
- the value of the
toprecord component
-
right
public double right()Returns the value of therightrecord component.- Returns:
- the value of the
rightrecord component
-
bottom
public double bottom()Returns the value of thebottomrecord component.- Returns:
- the value of the
bottomrecord component
-
left
public double left()Returns the value of theleftrecord component.- Returns:
- the value of the
leftrecord component
-