Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.ivy.plugins.version
Class VersionRangeMatcher

    java.lang.Object
      org.apache.ivy.plugins.version.AbstractVersionMatcher
          org.apache.ivy.plugins.version.VersionRangeMatcher

All Implemented Interfaces:
  IvySettingsAware, VersionMatcher

    public class VersionRangeMatcher

extends AbstractVersionMatcher

Matches version ranges: [1.0,2.0] matches all versions greater or equal to 1.0 and lower or equal to 2.0 [1.0,2.0[ matches all versions greater or equal to 1.0 and lower than 2.0 ]1.0,2.0] matches all versions greater than 1.0 and lower or equal to 2.0 ]1.0,2.0[ matches all versions greater than 1.0 and lower than 2.0 [1.0,) matches all versions greater or equal to 1.0 ]1.0,) matches all versions greater than 1.0 (,2.0] matches all versions lower or equal to 2.0 (,2.0[ matches all versions lower than 2.0 This class uses a latest strategy to compare revisions. If none is set, it uses the default one of the ivy instance set through setIvy(). If neither a latest strategy nor a ivy instance is set, an IllegalStateException will be thrown when calling accept(). Note that it can't work with latest time strategy, cause no time is known for the limits of the range. Therefore only purely revision based LatestStrategy can be used.

Constructor Summary
`VersionRangeMatcher()`
`VersionRangeMatcher(java.lang.String name)`
`VersionRangeMatcher(java.lang.String name, LatestStrategy strategy)`

Method Summary
`boolean` | `accept(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid)` Indicates if this version matcher considers that the module revision found matches the asked one.
`int` | `compare(ModuleRevisionId askedMrid, ModuleRevisionId foundMrid, java.util.Comparator staticComparator)` This method should be overriden in most cases, because it uses the default contract to return 1 when it's not possible to know which revision is greater.
`LatestStrategy` | `getLatestStrategy()`
`boolean` | `isDynamic(ModuleRevisionId askedMrid)` Indicates if the given asked ModuleRevisionId should be considered as dynamic for the current VersionMatcher or not.
`void` | `setLatest(java.lang.String latestStrategyName)`
`void` | `setLatestStrategy(LatestStrategy latestStrategy)`

Methods inherited from class org.apache.ivy.plugins.version.AbstractVersionMatcher
`accept, getName, getSettings, needModuleDescriptor, setName, setSettings, toString`

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

Constructor Detail

### VersionRangeMatcher

    public VersionRangeMatcher()

### VersionRangeMatcher

    public VersionRangeMatcher(java.lang.String name)

### VersionRangeMatcher

    public VersionRangeMatcher(java.lang.String name,
                               LatestStrategy strategy)

Method Detail

### isDynamic

    public boolean isDynamic(ModuleRevisionId askedMrid)

  Description copied from interface: `VersionMatcher`
  Indicates if the given asked ModuleRevisionId should be considered as dynamic for the current VersionMatcher or not.

  Parameters:
    `askedMrid` - the dependency module revision id as asked by a module
  Returns:
    true if this revision is considered as a dynamic one, false otherwise

### accept

    public boolean accept(ModuleRevisionId askedMrid,
                          ModuleRevisionId foundMrid)

  Description copied from interface: `VersionMatcher`
  Indicates if this version matcher considers that the module revision found matches the asked one.

  Returns:

### compare

    public int compare(ModuleRevisionId askedMrid,
                       ModuleRevisionId foundMrid,
                       java.util.Comparator staticComparator)

  Description copied from class: `AbstractVersionMatcher`
  This method should be overriden in most cases, because it uses the default contract to return 1 when it's not possible to know which revision is greater.

  Specified by:
    `compare` in interface `VersionMatcher`
  Overrides:
    `compare` in class `AbstractVersionMatcher`
  Parameters:
    `askedMrid` - the dynamic revision to compare
    `foundMrid` - the static revision to compare
    `staticComparator` - a comparator which can be used to compare static revisions
  Returns:
    0 if it's not possible to know which one is greater, greater than 0 if askedMrid should be considered greater, lower than 0 if it can't be consider greater

### getLatestStrategy

    public LatestStrategy getLatestStrategy()

### setLatestStrategy

    public void setLatestStrategy(LatestStrategy latestStrategy)

### setLatest

    public void setLatest(java.lang.String latestStrategyName)

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD