Class DisplayAspectRatio

java.lang.Object
de.powerstat.validation.values.DisplayAspectRatio
All Implemented Interfaces:
IValueObject, Comparable<DisplayAspectRatio>

public final class DisplayAspectRatio extends Object implements Comparable<DisplayAspectRatio>, IValueObject
Display aspect ratio. 1:1 2.1:1 3:1 3:2 4:3 5:3 5:4 8:5 9:5 10:6 15:9 16:9 16:10 17:10 25:12 25:16 60:29 64:35 72:35
  • Field Details

    • x

      private final int x
      Display x size (1-72).
    • y

      private final int y
      Display y size (1-35).
  • Constructor Details

    • DisplayAspectRatio

      private DisplayAspectRatio(int x, int y)
      Constructor.
      Parameters:
      x - Display x site (1-72)
      y - Display y size (1-35)
  • Method Details

    • of

      public static DisplayAspectRatio of(int x, int y)
      Display aspect ration factory.
      Parameters:
      x - Display x site (1-72)
      y - Display y size (1-35)
      Returns:
      DisplayAspectRatio object
    • of

      public static DisplayAspectRatio of(String value)
      Display aspect ration factory.
      Parameters:
      value - String value of type x:y
      Returns:
      DisplayAspectRatio object
      Throws:
      IllegalArgumentException - If not of correct format
    • getX

      public int getX()
      Get display x size.
      Returns:
      X size
    • getY

      public int getY()
      Get display y size.
      Returns:
      Y size
    • stringValue

      public String stringValue()
      Returns the value of this DisplayAspectRatio as a string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String toString()
      Returns the string representation of this DisplayAspectRatio. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "DisplayAspectRatio[x=1, y=1]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this DisplayAspectRatio
      See Also:
    • compareTo

      public int compareTo(DisplayAspectRatio obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<DisplayAspectRatio>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also: