Record Class ZoomValue

java.lang.Object
java.lang.Record
org.jjazz.pianoroll.api.ZoomValue

public record ZoomValue(int hValue, int vValue) extends Record
Zoom value for an editor.

hValue and vValue must be in the range [0;100], 50 is default.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Create a zoom value with 50 / 50.
    ZoomValue(int hValue, int vValue)
    Creates an instance of a ZoomValue record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    int
    Returns the value of the hValue record component.
    float
    hValue as a float.
    static ZoomValue
    Get a ZoomValue instance from the specified string.
    offset(int hDelta, int vDelta)
    Get a copy with the specified parameters added to the existing hValue and vValue.
    Save the object as a string.
    setH(int newHValue)
    Get a copy of this instance with hValue changed.
    setV(int newVValue)
    Get a copy of this instance with vValue changed.
    final String
    Returns a string representation of this record class.
    int
    Returns the value of the vValue record component.
    float
    hValue as a float.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ZoomValue

      public ZoomValue()
      Create a zoom value with 50 / 50.
    • ZoomValue

      public ZoomValue(int hValue, int vValue)
      Creates an instance of a ZoomValue record class.
      Parameters:
      hValue - the value for the hValue record component
      vValue - the value for the vValue record component
  • Method Details

    • setH

      public ZoomValue setH(int newHValue)
      Get a copy of this instance with hValue changed.
      Parameters:
      newHValue -
      Returns:
    • setV

      public ZoomValue setV(int newVValue)
      Get a copy of this instance with vValue changed.
      Parameters:
      newVValue -
      Returns:
    • offset

      public ZoomValue offset(int hDelta, int vDelta)
      Get a copy with the specified parameters added to the existing hValue and vValue.
      Parameters:
      hDelta -
      vDelta -
      Returns:
    • hValueFloat

      public float hValueFloat()
      hValue as a float.
      Returns:
      [0;1]
    • vValueFloat

      public float vValueFloat()
      hValue as a float.
      Returns:
      [0;1]
    • saveAsString

      public String saveAsString()
      Save the object as a string.
      Returns:
      See Also:
    • loadFromString

      public static ZoomValue loadFromString(String s)
      Get a ZoomValue instance from the specified string.
      Parameters:
      s -
      Returns:
      See Also:
    • 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. All components in this record class are compared with the compare method from their corresponding wrapper classes.
      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.
    • hValue

      public int hValue()
      Returns the value of the hValue record component.
      Returns:
      the value of the hValue record component
    • vValue

      public int vValue()
      Returns the value of the vValue record component.
      Returns:
      the value of the vValue record component