Class SimpleNumericVersion
java.lang.Object
io.github.bakedlibs.dough.versions.SimpleNumericVersion
- All Implemented Interfaces:
Version,Comparable<Version>
This
Version implementation consists of only one component, the version number.- Author:
- TheBusyBiscuit
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleNumericVersion(int version) This constructs a newSimpleNumericVersionwith the given version number. -
Method Summary
Modifier and TypeMethodDescriptionbooleanThis method returns thisVersionas a human-readable format.final intThis method returns the version number which this numericVersionrepresents.inthashCode()booleanbooleanisNewerThan(Version version) booleanisOlderThan(Version version) booleantoString()
-
Constructor Details
-
SimpleNumericVersion
public SimpleNumericVersion(int version) This constructs a newSimpleNumericVersionwith the given version number. The version number cannot be negative.- Parameters:
version- The version number
-
-
Method Details
-
isSimilar
This returns whether thisVersionis "similar" to the givenVersion. TwoVersions are considered "similar" when they can be compared to each other without causing anIncomparableVersionsException. -
getAsString
This method returns thisVersionas a human-readable format. Example:1.4.2. -
hashCode
public int hashCode() -
equals
-
toString
-
getVersionNumber
public final int getVersionNumber()This method returns the version number which this numericVersionrepresents.- Returns:
- The version number
-
isNewerThan
This method returns whether thisVersionis newer than the providedVersion. This also implies that the providedVersionis older than thisVersion, seeVersion.isOlderThan(Version).This method may throw an
IncomparableVersionsExceptionif the two versions cannot be compared with each other.- Specified by:
isNewerThanin interfaceVersion- Parameters:
version- TheVersionto compare this to- Returns:
- Whether this
Versionis newer than the provided one.
-
isEqualTo
This method returns whether thisVersionis equal to the givenVersion.This method may throw an
IncomparableVersionsExceptionif the two versions cannot be compared with each other. -
isOlderThan
This method returns whether thisVersionis older than the providedVersion. This also implies that the providedVersionis newer than thisVersion, seeVersion.isNewerThan(Version).This method may throw an
IncomparableVersionsExceptionif the two versions cannot be compared with each other.- Specified by:
isOlderThanin interfaceVersion- Parameters:
version- TheVersionto compare this to- Returns:
- Whether this
Versionis older than the provided one.
-