Class AGServerVersion

java.lang.Object
com.franz.agraph.repository.AGServerVersion
All Implemented Interfaces:
Comparable<AGServerVersion>

public final class AGServerVersion extends Object implements Comparable<AGServerVersion>
AllegroGraph server version number. A version is constructed from string containing a sequence of numbers separated by non-digit characters. The main purpose of this class is to allow version numbers to be compared. Note that only numeric components are compared, all other characters are ignored. All trailing zeros are stripped, so version "6.0.0" is considered to be equal to "6" and "6.0".
  • Constructor Details

    • AGServerVersion

      public AGServerVersion(String versionString)
      Parses a version string and constructs a version object.
      Parameters:
      versionString - String to be parsed, must consist of a sequence of numbers separated by non-digit characters,
  • Method Details

    • compareTo

      public int compareTo(AGServerVersion other)
      Performs a lexicographic comparison with another version number. Note that only numerical components are considered, all other characters from the original version strings are ignored. Any trailing zeros are also ignored, so "6.0" will be considered equal to "6.0.0" and "6".
      Specified by:
      compareTo in interface Comparable<AGServerVersion>
      Parameters:
      other - The version to compare with.
      Returns:
      See Comparable.compareTo(Object)
      Throws:
      NullPointerException - if the other version is null.
    • equals

      public boolean equals(Object other)
      Checks if another object represents the same version number. Note that only numerical components are considered, all other characters from the original version strings are ignored. Any trailing zeros are also ignored, so "6.0" will be considered equal to "6.0.0" and "6". If the other object is null or not an AGServerVersion false will be returned.
      Overrides:
      equals in class Object
      Parameters:
      other - The object to compare to.
      Returns:
      True if the other object represents the same version, false otherwise.
    • hashCode

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

      public String toString()
      Overrides:
      toString in class Object