Package com.io7m.jnoisetype.api
Class NTVersion
- java.lang.Object
-
- com.io7m.jnoisetype.api.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"
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNTVersion.BuilderBuilds instances of typeNTVersion.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NTVersion.Builderbuilder()Creates a builder forNTVersion.static NTVersioncopyOf(NTVersionType instance)Creates an immutable copy of aNTVersionTypevalue.booleanequals(java.lang.Object another)This instance is equal to all instances ofNTVersionthat have equal attribute values.inthashCode()Computes a hash code from attributes:major,minor.intmajor()intminor()static NTVersionof(int major, int minor)Construct a new immutableNTVersioninstance.java.lang.StringtoString()Prints the immutable valueNTVersionwith attribute values.NTVersionwithMajor(int value)Copy the current immutable object by setting a value for themajorattribute.NTVersionwithMinor(int value)Copy the current immutable object by setting a value for theminorattribute.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.jnoisetype.api.NTVersionType
checkPreconditions, compareTo
-
-
-
-
Method Detail
-
major
public int major()
- Specified by:
majorin interfaceNTVersionType- Returns:
- The major version number
-
minor
public int minor()
- Specified by:
minorin interfaceNTVersionType- Returns:
- The minor version number
-
withMajor
public final NTVersion withMajor(int value)
Copy the current immutable object by setting a value for themajorattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for major- Returns:
- A modified copy of the
thisobject
-
withMinor
public final NTVersion withMinor(int value)
Copy the current immutable object by setting a value for theminorattribute. A value equality check is used to prevent copying of the same value by returningthis.- Parameters:
value- A new value for minor- Returns:
- A modified copy of the
thisobject
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofNTVersionthat have equal attribute values.- Overrides:
equalsin classjava.lang.Object- Returns:
trueifthisis equal toanotherinstance
-
hashCode
public int hashCode()
Computes a hash code from attributes:major,minor.- Overrides:
hashCodein classjava.lang.Object- Returns:
- hashCode value
-
toString
public java.lang.String toString()
Prints the immutable valueNTVersionwith attribute values.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation of the value
-
of
public static NTVersion of(int major, int minor)
Construct a new immutableNTVersioninstance.- Parameters:
major- The value for themajorattributeminor- The value for theminorattribute- Returns:
- An immutable NTVersion instance
-
copyOf
public static NTVersion copyOf(NTVersionType instance)
Creates an immutable copy of aNTVersionTypevalue. 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 forNTVersion.NTVersion.builder() .setMajor(int) // requiredmajor.setMinor(int) // requiredminor.build();- Returns:
- A new NTVersion builder
-
-