Eclipse Platform
Release 3.6

org.eclipse.equinox.p2.metadata
Class VersionRange

java.lang.Object
  extended by org.eclipse.equinox.p2.metadata.VersionRange
All Implemented Interfaces:
Serializable

public class VersionRange
extends Object
implements Serializable

This class represents a version range with Omni Version bounds. It is signature equivalent with the OSGi org.eclipse.osgi.service.resolver.VersionRange

Since:
2.0
See Also:
Serialized Form
Restriction:
This class is not intended to be subclassed by clients.

Field Summary
static VersionRange emptyRange
          TODO: This should not be OSGi but it has to be that for now since the resolver creates a filter where the min and max are converted into strings.
 
Constructor Summary
VersionRange(String versionRange)
          Constructs a VersionRange from the given versionRange 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)
           
 IVersionFormat getFormat()
          Returns the version format.
 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()
           
 VersionRange intersect(VersionRange r2)
           
 boolean isIncluded(Version version)
          Returns whether the given version is included in this VersionRange.
 boolean isOSGiCompatible()
          Checks if the versions of this range is in compliance with the OSGi version spec.
 String toString()
           
 void toString(StringBuffer result)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

emptyRange

public static final VersionRange emptyRange
TODO: This should not be OSGi but it has to be that for now since the resolver creates a filter where the min and max are converted into strings. When the filter is evaluated an attempt is made to recreate them as OSGi versions. An empty OSGi Version range.

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
maxVersion - the maximum version of the range

VersionRange

public VersionRange(String versionRange)
Constructs a VersionRange from the given versionRange String.

Parameters:
versionRange - a version range String that specifies a range of versions.
Method Detail

getFormat

public IVersionFormat getFormat()
Returns the version format.


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

intersect

public VersionRange intersect(VersionRange r2)

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. (may be null)
Returns:
true if the version is include, false otherwise

isOSGiCompatible

public boolean isOSGiCompatible()
Checks if the versions of this range is in compliance with the OSGi version spec.

Returns:
A flag indicating whether the range is OSGi compatible or not.

equals

public boolean equals(Object object)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

toString

public void toString(StringBuffer result)

Eclipse Platform
Release 3.6

Guidelines for using Eclipse APIs.

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