gate.util
Class VersionComparator

java.lang.Object
  extended by gate.util.VersionComparator
All Implemented Interfaces:
Comparator<String>

public class VersionComparator
extends Object
implements Comparator<String>

A comparator that can be used for comparing GATE version strings. This includes comparing SNAPSHOT versions as well as releases. This is needed to be able to determine if a CREOLE plugin is compatible with a specific GATE version.

Author:
Mark A. Greenwood

Constructor Summary
VersionComparator()
           
 
Method Summary
 int compare(String v1, String v2)
           
static int compareVersions(String v1, String v2)
           
static boolean isCompatible(String min, String max)
          Checks to see if the version of GATE falls between the two specified versions (this is an inclusive check).
static boolean isGATENewEnough(String version)
          Returns true if the specified version is the same or newer than the version of GATE being used.
static boolean isGATEOldEnough(String version)
          Returns true if the specified version is the same or older than the version of GATE being used.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

VersionComparator

public VersionComparator()
Method Detail

compare

public int compare(String v1,
                   String v2)
Specified by:
compare in interface Comparator<String>

compareVersions

public static int compareVersions(String v1,
                                  String v2)

isGATENewEnough

public static boolean isGATENewEnough(String version)
Returns true if the specified version is the same or newer than the version of GATE being used.

Parameters:
version - the version number to check
Returns:
true if the specified version is the same or newer than the version of GATE being used, false otherwise

isGATEOldEnough

public static boolean isGATEOldEnough(String version)
Returns true if the specified version is the same or older than the version of GATE being used.

Parameters:
version - the version number to check
Returns:
true if the specified version is the same or older than the version of GATE being used, false otherwise

isCompatible

public static boolean isCompatible(String min,
                                   String max)
Checks to see if the version of GATE falls between the two specified versions (this is an inclusive check).

Parameters:
min - the minimum compatible GATE version
max - the maximum compatible GATE version
Returns:
if the version of GATE falls between the two specified versions (this is an inclusive check), false otherwise