Package limn.print

Record Class Paper

Record Components:
name - what a person calls it; never blank
width - its width in points, more than zero
height - its height in points, more than zero

public record Paper(String name, float width, float height) extends Record
A sheet of paper: its name and its size in points (1/72 inch), portrait or landscape.

 Document.of(Paper.A4);
 Document.of(Paper.LETTER.landscape());
 Document.of(Paper.of("Receipt", 80, 200));            // millimetres
 Document.of(Paper.forLocale(Locale.getDefault()));
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Paper
    ISO A3, 297 by 420 millimetres.
    static final Paper
    ISO A4, 210 by 297 millimetres.
    static final Paper
    ISO A5, 148 by 210 millimetres.
    static final Paper
    ISO A6, 105 by 148 millimetres.
    static final Paper
    ISO B4, 250 by 353 millimetres.
    static final Paper
    ISO B5, 176 by 250 millimetres.
    static final Paper
    Legal, 8.5 by 14 inches.
    static final Paper
    Letter, 8.5 by 11 inches.
    static final Paper
    Tabloid, 11 by 17 inches.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Paper(String name, float width, float height)
    Creates an instance of a Paper record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    static Paper
    forLocale(Locale locale)
    The paper a region uses: Letter in the regions that use it (the United States, Canada, Mexico, the Philippines and the others the Unicode locale data lists), A4 everywhere else and for a locale that names no region.
    final int
    Returns a hash code value for this object.
    float
    Returns the value of the height record component.
    float
     
    boolean
     
     
    Returns the value of the name record component.
    static Paper
    of(String name, float width, float height)
     
    static Paper
    ofPoints(String name, float width, float height)
     
     
    final String
    Returns a string representation of this record class.
    float
    Returns the value of the width record component.
    float
     

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • A3

      public static final Paper A3
      ISO A3, 297 by 420 millimetres.
    • A4

      public static final Paper A4
      ISO A4, 210 by 297 millimetres.
    • A5

      public static final Paper A5
      ISO A5, 148 by 210 millimetres.
    • A6

      public static final Paper A6
      ISO A6, 105 by 148 millimetres.
    • B4

      public static final Paper B4
      ISO B4, 250 by 353 millimetres.
    • B5

      public static final Paper B5
      ISO B5, 176 by 250 millimetres.
    • LETTER

      public static final Paper LETTER
      Letter, 8.5 by 11 inches.
    • TABLOID

      public static final Paper TABLOID
      Tabloid, 11 by 17 inches.
  • Constructor Details

    • Paper

      public Paper(String name, float width, float height)
      Creates an instance of a Paper record class.
      Parameters:
      name - the value for the name record component
      width - the value for the width record component
      height - the value for the height record component
  • Method Details

    • of

      public static Paper of(String name, float width, float height)
      Parameters:
      name - what a person calls it
      width - its width in millimetres
      height - its height in millimetres
      Returns:
      the paper
    • ofPoints

      public static Paper ofPoints(String name, float width, float height)
      Parameters:
      name - what a person calls it
      width - its width in points
      height - its height in points
      Returns:
      the paper
    • forLocale

      public static Paper forLocale(Locale locale)
      The paper a region uses: Letter in the regions that use it (the United States, Canada, Mexico, the Philippines and the others the Unicode locale data lists), A4 everywhere else and for a locale that names no region.
      Parameters:
      locale - a locale
      Returns:
      Letter or A4
    • landscape

      public Paper landscape()
      Returns:
      this paper turned on its side: the longer side across; itself when it is already
    • portrait

      public Paper portrait()
      Returns:
      this paper upright: the longer side down; itself when it is already
    • isLandscape

      public boolean isLandscape()
      Returns:
      whether the paper is wider than it is tall
    • widthMillimetres

      public float widthMillimetres()
      Returns:
      the width in millimetres
    • heightMillimetres

      public float heightMillimetres()
      Returns:
      the height in millimetres
    • toString

      public final String 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.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • width

      public float width()
      Returns the value of the width record component.
      Returns:
      the value of the width record component
    • height

      public float height()
      Returns the value of the height record component.
      Returns:
      the value of the height record component