Interface Version

All Superinterfaces:
Comparable<Version>, OsidPrimitive, Serializable
All Known Subinterfaces:
Version

public interface Version extends OsidPrimitive, Comparable<Version>
Supplements the OSID Version interface for Java.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    compareTo(Version version)
    Compares this Version with the specified Version to determine the natural order.
    boolean
    Determines if the given Version is equal to this one.
    int
    Returns a hash code value for this Version based on the schema and components.
    boolean
    Tests if this Version excludes the given version.
    boolean
    Tests if this Version includes the given version.
    boolean
    isNewer(Version version)
    Tests if this Version is more recent than the given Version.
    boolean
    isOlder(Version version)
    Tests if this Version is older than the given Version.

    Methods inherited from interface OsidPrimitive

    toString
    Modifier and Type
    Method
    Description
    Returns a string representation of this OsidPrimitive.
  • Method Details

    • isNewer

      boolean isNewer(Version version)
      Tests if this Version is more recent than the given Version.
      Parameters:
      version - the version to compare
      Returns:
      true if this version is more recent, false otherwise
      Throws:
      NullArgumentException - version is null
      UnsupportedException - version scheme types not compatible
    • isOlder

      boolean isOlder(Version version)
      Tests if this Version is older than the given Version.
      Parameters:
      version - the version to compare
      Returns:
      true if this version is older, false otherwise
      Throws:
      NullArgumentException - version is null
      UnsupportedException - version scheme types not compatible
    • isInclusive

      boolean isInclusive(Version version)
      Tests if this Version includes the given version. A version 3.2 may include version 3.2.5 but not include version 3.0.
      Parameters:
      version - the version to compare
      Returns:
      true if this version includes the given version, false otherwise
      Throws:
      NullArgumentException - version is null
      UnsupportedException - version scheme types not compatible
    • isExclusive

      boolean isExclusive(Version version)
      Tests if this Version excludes the given version. Two versions are exclusive if a.isInclusive(b) and b.isInclusive(c) are both false.
      Parameters:
      version - the version to compare
      Returns:
      true if this version excludes the given version, false otherwise
      Throws:
      NullArgumentException - version is null
      UnsupportedException - version scheme types not compatible
    • compareTo

      int compareTo(Version version)
      Compares this Version with the specified Version to determine the natural order. Returns a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version. The natural ordering is determined first by the natural ordering of the version scheme, then by its components. If compareTo an version is zero, then equals() must be true and their hash codes must also be equal for consistent behavior. For orderings that may yield inconsistent behavior, an external Comparator should be used.
      Specified by:
      compareTo in interface Comparable<Version>
      Parameters:
      version - the version to be compared
      Returns:
      a negative integer, zero, or a positive integer as this version is less than, equal to, or greater than the specified version
      Throws:
      ClassCastException - if the specified version's type prevents it from being compared to this version
    • equals

      boolean equals(Object obj)
      Determines if the given Version is equal to this one. Two versions are equal if their schema and components are equal. If equals() is true, then compareTo() must be zero and their hash codes must also be equal for consistent behavior. For orderings that may yield inconsistent behavior, an external Comparator should be used. If obj is null or if a different interface, this method returns false.
      Overrides:
      equals in class Object
      Parameters:
      obj - an object to compare
      Returns:
      true if the given object is equal to this Version, false otherwise
    • hashCode

      int hashCode()
      Returns a hash code value for this Version based on the schema and components.
      Overrides:
      hashCode in class Object
      Returns:
      a hash code value for this object