Barcode-Lib4J requires Java 9+

Java Class «TwoDSize»

java.lang.Object
de.vwsoft.barcodelib4j.twod.TwoDSize
All Implemented Interfaces:
Comparable<TwoDSize>

public class TwoDSize extends Object implements Comparable<TwoDSize>
Immutable pair of width and height.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int
    The height value.
    final int
    The width value.
  • Constructor Summary

    Constructors
    Constructor
    Description
    TwoDSize(int width, int height)
    Creates a new instance with the specified width and height.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Compares this object with another TwoDSize object.
    boolean
    Indicates whether some other object is "equal to" this one.
    int
    Returns the hash code calculated from the width and height values.
    Returns a string representation of this instance.

    Methods inherited from class java.lang.Object

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

    • width

      public final int width
      The width value.
    • height

      public final int height
      The height value.
  • Constructor Details

    • TwoDSize

      public TwoDSize(int width, int height)
      Creates a new instance with the specified width and height.
      Parameters:
      width - the width
      height - the height
  • Method Details

    • compareTo

      public int compareTo(TwoDSize other)
      Compares this object with another TwoDSize object. First, widths are compared; if they are equal, heights are compared.
      Specified by:
      compareTo in interface Comparable<TwoDSize>
      Parameters:
      other - the TwoDSize to be compared
      Returns:
      a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object
    • equals

      public boolean equals(Object obj)
      Indicates whether some other object is "equal to" this one. Returns true if and only if the parameter is also an instance of this class and both instances have the same width and height values.
      Overrides:
      equals in class Object
      Parameters:
      obj - the reference object with which to compare
      Returns:
      true if this object equals to obj, false otherwise
    • hashCode

      public int hashCode()
      Returns the hash code calculated from the width and height values.
      Overrides:
      hashCode in class Object
      Returns:
      the hash code calculated from the width and height values
    • toString

      public String toString()
      Returns a string representation of this instance. This method is intended to be used only for debugging purposes.
      Overrides:
      toString in class Object
      Returns:
      a string representation of this instance