Package opennlp.tools.util

# Class Version

java.lang.Object
opennlp.tools.util.Version

public class Version extends Object
The `Version` class represents the OpenNLP Tools library version.

The version has three parts:

- Major: OpenNLP Tools libraries with a different major version are not interchangeable.
- Minor: OpenNLP Tools libraries with an identical major version, but different minor version may be interchangeable. See release notes for further details.
- Revision: OpenNLP Tools libraries with same major and minor version, but a different revision, are fully interchangeable.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final Version`
  `DEV_VERSION`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Version(int major, int minor, int revision)`
  Initializes a `Version` instance with the provided version elements.
  `Version(int major, int minor, int revision, boolean snapshot)`
  Initializes a `Version` instance with the provided version elements.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static boolean`
  `between(int version, int minValue, int maxValue)`
  Checks whether a `version` is in between an interval and its boundaries.
  `static Version`
  `currentVersion()`
  `boolean`
  `equals(Object obj)`
  `int`
  `getMajor()`
  `int`
  `getMinor()`
  `int`
  `getRevision()`
  `int`
  `hashCode()`
  `boolean`
  `isSnapshot()`
  `static Version`
  `parse(String version)`
  Return a new `Version` initialized to the value represented by the specified `String`
  `String`
  `toString()`
  The `parse(String)` method can create an instance of `Version` with the returned version value string.

  ### Methods inherited from class java.lang.Object

  `getClass, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### DEV_VERSION

    public static final Version DEV_VERSION

- ## Constructor Details

  - ### Version

    public Version(int major, int minor, int revision, boolean snapshot)
    Initializes a `Version` instance with the provided version elements.
    Parameters:
      `major` - Must not be negative.
      `minor` - Must not be negative.
      `revision` - Must not be negative.
      `snapshot` - `true` if the version represents a snapshot, `false` otherwise.

  - ### Version

    public Version(int major, int minor, int revision)
    Initializes a `Version` instance with the provided version elements. The `Version` will not be a snapshot, yet a release version.
    Parameters:
      `major` - Must not be negative.
      `minor` - Must not be negative.
      `revision` - Must not be negative.

- ## Method Details

  - ### getMajor

    public int getMajor()
    Returns:
      Retrieves the major version, guaranteed to be non-negative.

  - ### getMinor

    public int getMinor()
    Returns:
      Retrieves the minor version, guaranteed to be non-negative.

  - ### getRevision

    public int getRevision()
    Returns:
      Retrieves the revision version, guaranteed to be non-negative.

  - ### isSnapshot

    public boolean isSnapshot()

  - ### toString

    public String toString()
    The `parse(String)` method can create an instance of `Version` with the returned version value string.
    Overrides:
      `toString` in class `Object`
    Returns:
      Retrieves a human-readable version representation.

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### equals

    public boolean equals(Object obj)
    Overrides:
      `equals` in class `Object`

  - ### parse

    public static Version parse(String version)
    Return a new `Version` initialized to the value represented by the specified `String`
    Parameters:
      `version` - The string to be parsed
    Returns:
      The version represented by the string value
    Throws:
      `NumberFormatException` - Thrown if `version` does not adhere to a valid form.

  - ### currentVersion

    public static Version currentVersion()
    Returns:
      Retrieves the current version of the OpenNLP Tools library.

  - ### between

    public static boolean between(int version, int minValue, int maxValue)
    Checks whether a `version` is in between an interval and its boundaries.
    Parameters:
      `version` - The (major) version number to check.
      `minValue` - The inclusive value of the lower interval boundary.
      `maxValue` - The inclusive value of the upper interval boundary.
    Returns:
      `true` if the value is in between the boundary, `false` otherwise.