Class NTPitch

java.lang.Object
com.io7m.jnoisetype.api.NTPitch
All Implemented Interfaces:
NTPitchType, java.lang.Comparable<NTPitchType>

public final class NTPitch
extends java.lang.Object
implements NTPitchType
The valid values for pitches.
  • Nested Class Summary

    Nested Classes
    Modifier and Type Class Description
    static class  NTPitch.Builder
    Builds instances of type NTPitch.
  • Method Summary

    Modifier and Type Method Description
    static NTPitch.Builder builder()
    Creates a builder for NTPitch.
    static NTPitch copyOf​(NTPitchType instance)
    Creates an immutable copy of a NTPitchType value.
    boolean equals​(java.lang.Object another)
    This instance is equal to all instances of NTPitch that have equal attribute values.
    int hashCode()
    Computes a hash code from attributes: value.
    static NTPitch of​(int value)
    Construct a new immutable NTPitch instance.
    java.lang.String toString()
    Prints the immutable value NTPitch with attribute values.
    int value()  
    NTPitch withValue​(int value)
    Copy the current immutable object by setting a value for the value attribute.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface com.io7m.jnoisetype.api.NTPitchType

    checkPreconditions, compareTo
  • Method Details

    • value

      public int value()
      Specified by:
      value in interface NTPitchType
      Returns:
      The raw value in the range [0, 127]
    • withValue

      public final NTPitch withValue​(int value)
      Copy the current immutable object by setting a value for the value attribute. A value equality check is used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for value
      Returns:
      A modified copy of the this object
    • equals

      public boolean equals​(java.lang.Object another)
      This instance is equal to all instances of NTPitch that have equal attribute values.
      Overrides:
      equals in class java.lang.Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: value.
      Overrides:
      hashCode in class java.lang.Object
      Returns:
      hashCode value
    • toString

      public java.lang.String toString()
      Prints the immutable value NTPitch with attribute values.
      Overrides:
      toString in class java.lang.Object
      Returns:
      A string representation of the value
    • of

      public static NTPitch of​(int value)
      Construct a new immutable NTPitch instance.
      Parameters:
      value - The value for the value attribute
      Returns:
      An immutable NTPitch instance
    • copyOf

      public static NTPitch copyOf​(NTPitchType instance)
      Creates an immutable copy of a NTPitchType value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable NTPitch instance
    • builder

      public static NTPitch.Builder builder()
      Creates a builder for NTPitch.
       NTPitch.builder()
          .setValue(int) // required value
          .build();
       
      Returns:
      A new NTPitch builder