Eclipse Platform Release 3.7

## org.eclipse.osgi.service.resolver
Class VersionRange

    java.lang.Object
      org.eclipse.osgi.service.resolver.VersionRange

    public class VersionRange

extends Object

This class represents a version range.

Since:
  3.1
Restriction:
  This class is not intended to be subclassed by clients.

Field Summary
`static VersionRange` `emptyRange` An empty version range: "0.0.0".

Constructor Summary
`VersionRange(String versionRange)` Creates a version range from the specified string.
`VersionRange(Version minVersion, boolean includeMin, Version maxVersion, boolean includeMax)` Constructs a VersionRange with the specified minVersion and maxVersion.

Method Summary
`boolean` `equals(Object object)`
`boolean` `getIncludeMaximum()` Indicates if the maximum version is included in the version range.
`boolean` `getIncludeMinimum()` Indicates if the minimum version is included in the version range.
`Version` `getMaximum()` Returns the maximum Version of this VersionRange.
`Version` `getMinimum()` Returns the minimum Version of this VersionRange.
`int` `hashCode()`
`boolean` `isIncluded(Version version)` Returns whether the given version is included in this VersionRange.
`String` `toString()` Returns the string representation of this version range.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Field Detail

### emptyRange

    public static final VersionRange emptyRange

  An empty version range: "0.0.0". The empty version range includes all valid versions (any version greater than or equal to the version 0.0.0).

Constructor Detail

### VersionRange

    public VersionRange(Version minVersion,
                        boolean includeMin,
                        Version maxVersion,
                        boolean includeMax)

  Constructs a VersionRange with the specified minVersion and maxVersion.

  Parameters:
    `minVersion` - the minimum version of the range. If `null` then `Version.emptyVersion` is used.
    `maxVersion` - the maximum version of the range. If `null` then new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MAX_VALUE) is used.

### VersionRange

    public VersionRange(String versionRange)

  Creates a version range from the specified string.

  Here is the grammar for version range strings.

       version-range ::= interval | atleast
       interval ::= ( include-min | exclude-min ) min-version ',' max-version ( include-max | exclude-max )
       atleast ::= version
       floor ::= version
       ceiling ::= version
       include-min ::= '['
       exclude-min ::= '('
       include-max ::= ']'
       exclude-max ::= ')'

  Parameters:
    `versionRange` - string representation of the version range or `null` for the empty range "0.0.0"
  See Also:
    `definition of `version``

Method Detail

### getMinimum

    public Version getMinimum()

  Returns the minimum Version of this VersionRange.

  Returns:
    the minimum Version of this VersionRange

### getIncludeMinimum

    public boolean getIncludeMinimum()

  Indicates if the minimum version is included in the version range.

  Returns:
    true if the minimum version is included in the version range; otherwise false is returned

### getMaximum

    public Version getMaximum()

  Returns the maximum Version of this VersionRange.

  Returns:
    the maximum Version of this VersionRange

### getIncludeMaximum

    public boolean getIncludeMaximum()

  Indicates if the maximum version is included in the version range.

  Returns:
    true if the maximum version is included in the version range; otherwise false is returned

### isIncluded

    public boolean isIncluded(Version version)

  Returns whether the given version is included in this VersionRange. This will depend on the minimum and maximum versions of this VersionRange and the given version.

  Parameters:
    `version` - a version to be tested for inclusion in this VersionRange. If `null` then `Version.emptyVersion` is used.
  Returns:
    `true` if the version is included, `false` otherwise

### equals

    public boolean equals(Object object)

  Overrides:
    `equals` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### toString

    public String toString()

  Returns the string representation of this version range. The encoded format uses the following grammar:

       version-range ::= interval | atleast
       interval ::= ( include-min | exclude-min ) min-version ',' max-version ( include-max | exclude-max )
       atleast ::= version
       floor ::= version
       ceiling ::= version
       include-min ::= '['
       exclude-min ::= '('
       include-max ::= ']'
       exclude-max ::= ')'

  The following are some examples of version range strings and their predicate equivalent:

       [1.2.3, 4.5.6) -> 1.2.3 <= x < 4.5.6
       [1.2.3, 4.5.6] -> 1.2.3 <= x <= 4.5.6
       (1.2.3, 4.5.6) -> 1.2.3 < x < 4.5.6
       (1.2.3, 4.5.6] -> 1.2.3 < x <= 4.5.6
       1.2.3          -> 1.2.3 <= x

  Note that a simple version (e.g. "1.2.3") indicates a version range which is any version greater than or equal to the specified version.

  Overrides:
    `toString` in class `Object`
  Returns:
    The string representation of this version range.
  See Also:
    `string representation of `version``

Eclipse Platform Release 3.7

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.