java.lang.Object
de.uni_hildesheim.sse.easy.loader.framework.Version

public class Version extends Object
Represents a version number.
Author:
Holger Eichelberger
  • Field Details

  • Constructor Details

    • Version

      public Version(String version) throws BundleException
      Creates a new version by parsing a string.
      Parameters:
      version - the version string in form i(.i)* with i integer numbers
      Throws:
      BundleException - in case of format problems
  • Method Details

    • toString

      public String toString()
      Returns a textual representation of this instance.
      Overrides:
      toString in class Object
      Returns:
      a textual representation
    • getSegmentCount

      public int getSegmentCount()
      Returns the number of the segments.
      Returns:
      the number of segments
    • getSegment

      public int getSegment(int index)
      Returns the version segment specified by index.
      Parameters:
      index - a 0-based index specifying the segment to be returned
      Returns:
      the specified segment
      Throws:
      IndexOutOfBoundsException - if index<0 || index>=getSegmentCount()
    • compareTo

      public int compareTo(Version version)
      Compares two versions and results in: -1 : this is smaller <=> given version and this is bigger. 0 : given version and this are equal. +1 : this is bigger <=> given version is smaller.
      Parameters:
      version - version to compare.
      Returns:
      result in {-1, 0, 1}.
    • isInRange

      public boolean isInRange(Version min, Version max)
      Checks whether the version is within a certain range of versions.
      Parameters:
      min - Minimal version that is allowed. Can be null to represent no minimum.
      max - Maximal version that is allowed. Can be null to represent no maximum.
      Returns:
      boolean True if version is within the range.