Class NTVersion

  • All Implemented Interfaces:
    NTVersionType, java.lang.Comparable<NTVersionType>

    public final class NTVersion
    extends java.lang.Object
    implements NTVersionType
    A version number.
    See Also:
    "SoundFontⓡ Technical Specification 2.04, §5.1, sfVersionTag"
    • Method Detail

      • major

        public int major()
        Specified by:
        major in interface NTVersionType
        Returns:
        The major version number
      • minor

        public int minor()
        Specified by:
        minor in interface NTVersionType
        Returns:
        The minor version number
      • withMajor

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

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

        public boolean equals​(java.lang.Object another)
        This instance is equal to all instances of NTVersion 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: major, minor.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        hashCode value
      • toString

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

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

        public static NTVersion copyOf​(NTVersionType instance)
        Creates an immutable copy of a NTVersionType 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 NTVersion instance
      • builder

        public static NTVersion.Builder builder()
        Creates a builder for NTVersion.
         NTVersion.builder()
            .setMajor(int) // required major
            .setMinor(int) // required minor
            .build();
         
        Returns:
        A new NTVersion builder