Package megamek

Class Version

java.lang.Object
megamek.Version
All Implemented Interfaces:
Serializable, Comparable<Version>

public final class Version extends Object implements Comparable<Version>, Serializable
This is used for versioning, and to track the current Version the suite is running at.
See Also:
  • Constructor Details

    • Version

      public Version()
      This Constructor is not to be used outside of unit testing
    • Version

      public Version(@Nullable String text)
      Sets the version with Extra data.
      Parameters:
      text - The Version string to parse.
    • Version

      public Version(int major, int minor, int patch)
      Sets the version.
      Parameters:
      major - Major Version
      minor - Minor Version
      patch - Patch Version
    • Version

      public Version(String major, String minor, String patch)
      Sets the version.
      Parameters:
      major - Major Version
      minor - Minor Version
      patch - Patch Version
    • Version

      public Version(String major, String minor, String patch, @Nullable String extra)
      Sets the version with Extra data.
      Parameters:
      major - Major Version
      minor - Minor Version
      patch - Patch Version
      extra - Extra would be PR or nightly with git hash.
  • Method Details

    • getMajor

      public int getMajor()
    • setMajor

      public void setMajor(int major)
    • getMinor

      public int getMinor()
    • setMinor

      public void setMinor(int minor)
    • getPatch

      public int getPatch()
    • setPatch

      public void setPatch(int patch)
    • getExtra

      public String getExtra()
    • setExtra

      public void setExtra(@Nullable String extra)
    • isHigherThan

      @Deprecated(since="0.50.05", forRemoval=true) public boolean isHigherThan(String other)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use this method to determine if this version is higher than the version passed
      Parameters:
      other - The version we want to see if it is lower than this version
      Returns:
      true if this is higher than checkVersion
    • isHigherThan

      public boolean isHigherThan(Version other)
      Use this method to determine if the version passed is less than this Version object.
      Parameters:
      other - The version we want to see if is less than this version
      Returns:
      true if checkVersion is less than this Version object
    • isLowerThan

      @Deprecated(since="0.50.05", forRemoval=true) public boolean isLowerThan(String other)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Use this method to determine if this version is lower than the version passed
      Parameters:
      other - The version we want to see if it is higher than this version.
      Returns:
      true if this is lower than checkVersion
    • isLowerThan

      public boolean isLowerThan(Version other)
      Use this method to determine if this version is lower than the version passed
      Parameters:
      other - The version we want to see if it is higher than this version.
      Returns:
      true if this is lower than checkVersion
    • isBetween

      public boolean isBetween(String lower, String upper)
      Parameters:
      lower - the lower Version bound (exclusive)
      upper - the upper Version bound (exclusive)
      Returns:
      true if the version is between lower and upper versions, both exclusive
    • isBetween

      public boolean isBetween(Version lower, Version upper)
      Parameters:
      lower - the lower Version bound (exclusive)
      upper - the upper Version bound (exclusive)
      Returns:
      true is the version is between lower and upper versions, both exclusive
    • is

      public boolean is(String other)
      Parameters:
      other - The version we want to see if it is the same as this version.
      Returns:
      true if this is same version as the other
    • is

      public boolean is(Version other)
      Parameters:
      other - The version we want to see if it is the same as this version.
      Returns:
      true if this is same version as the other
    • compareTo

      public int compareTo(Version other)
      Specified by:
      compareTo in interface Comparable<Version>
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • writeToXML

      public void writeToXML(PrintWriter pw, int indent)
    • toString

      public String toString()
      Overrides:
      toString in class Object