Package com.io7m.smfj.core
Class SMFFormatVersionMutable
- java.lang.Object
-
- com.io7m.smfj.core.SMFFormatVersionMutable
-
- All Implemented Interfaces:
SMFFormatVersionType,java.lang.Comparable<SMFFormatVersionType>
public final class SMFFormatVersionMutable extends java.lang.Object implements SMFFormatVersionType
A modifiable implementation of theSMFFormatVersionTypetype.Use the
create()static factory methods to create new instances. Use thetoImmutable()method to convert to canonical immutable instances.SMFFormatVersionMutable is not thread-safe
- See Also:
SMFFormatVersion
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description SMFFormatVersionMutableclear()Clears the object by setting all attributes to their initial values.static SMFFormatVersionMutablecreate()Construct a modifiable instance ofSMFFormatVersionType.static SMFFormatVersionMutablecreate(int major, int minor)Construct a modifiable instance ofSMFFormatVersionType.booleanequals(java.lang.Object another)This instance is equal to all instances ofSMFFormatVersionMutablethat have equal attribute values.SMFFormatVersionMutablefrom(SMFFormatVersionMutable instance)Fill this modifiable instance with attribute values from the providedSMFFormatVersionTypeinstance.SMFFormatVersionMutablefrom(SMFFormatVersionType instance)Fill this modifiable instance with attribute values from the providedSMFFormatVersionTypeinstance.inthashCode()Computes a hash code from attributes:major,minor.booleanisInitialized()Returnstrueif all required attributes are set, indicating that the object is initialized.intmajor()booleanmajorIsSet()Returnstrueif the required attributemajoris set.intminor()booleanminorIsSet()Returnstrueif the required attributeminoris set.SMFFormatVersionMutablesetMajor(int major)Assigns a value to themajorattribute.SMFFormatVersionMutablesetMinor(int minor)Assigns a value to theminorattribute.SMFFormatVersiontoImmutable()Converts toSMFFormatVersion.java.lang.StringtoString()Generates a string representation of thisSMFFormatVersionType.SMFFormatVersionMutableunsetMajor()Reset an attribute to its initial value.SMFFormatVersionMutableunsetMinor()Reset an attribute to its initial value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.io7m.smfj.core.SMFFormatVersionType
compareTo, toHumanString
-
-
-
-
Method Detail
-
create
public static SMFFormatVersionMutable create(int major, int minor)
Construct a modifiable instance ofSMFFormatVersionType.
-
create
public static SMFFormatVersionMutable create()
Construct a modifiable instance ofSMFFormatVersionType.- Returns:
- A new modifiable instance
-
major
public final int major()
- Specified by:
majorin interfaceSMFFormatVersionType- Returns:
- The major number for a format
-
minor
public final int minor()
- Specified by:
minorin interfaceSMFFormatVersionType- Returns:
- The minor number for a format
-
clear
public SMFFormatVersionMutable clear()
Clears the object by setting all attributes to their initial values.- Returns:
thisfor use in a chained invocation
-
from
public SMFFormatVersionMutable from(SMFFormatVersionType instance)
Fill this modifiable instance with attribute values from the providedSMFFormatVersionTypeinstance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values).- Parameters:
instance- The instance from which to copy values- Returns:
thisfor use in a chained invocation
-
from
public SMFFormatVersionMutable from(SMFFormatVersionMutable instance)
Fill this modifiable instance with attribute values from the providedSMFFormatVersionTypeinstance. Regular attribute values will be overridden, i.e. replaced with ones of an instance. Any of the instance's absent optional values will not be copied (will not override current values).- Parameters:
instance- The instance from which to copy values- Returns:
thisfor use in a chained invocation
-
setMajor
public SMFFormatVersionMutable setMajor(int major)
Assigns a value to themajorattribute.- Parameters:
major- The value for major- Returns:
thisfor use in a chained invocation
-
setMinor
public SMFFormatVersionMutable setMinor(int minor)
Assigns a value to theminorattribute.- Parameters:
minor- The value for minor- Returns:
thisfor use in a chained invocation
-
majorIsSet
public final boolean majorIsSet()
Returnstrueif the required attributemajoris set.- Returns:
trueif set
-
minorIsSet
public final boolean minorIsSet()
Returnstrueif the required attributeminoris set.- Returns:
trueif set
-
unsetMajor
public final SMFFormatVersionMutable unsetMajor()
Reset an attribute to its initial value.- Returns:
thisfor use in a chained invocation
-
unsetMinor
public final SMFFormatVersionMutable unsetMinor()
Reset an attribute to its initial value.- Returns:
thisfor use in a chained invocation
-
isInitialized
public final boolean isInitialized()
Returnstrueif all required attributes are set, indicating that the object is initialized.- Returns:
trueif set
-
toImmutable
public final SMFFormatVersion toImmutable()
Converts toSMFFormatVersion.- Returns:
- An immutable instance of SMFFormatVersion
-
equals
public boolean equals(java.lang.Object another)
This instance is equal to all instances ofSMFFormatVersionMutablethat have equal attribute values. An uninitialized instance is equal only to itself.- 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()
Generates a string representation of thisSMFFormatVersionType. If uninitialized, some attribute values may appear as question marks.- Overrides:
toStringin classjava.lang.Object- Returns:
- A string representation
-
-