| java.lang.Object org.geotools.util.Version
Version | public class Version implements CharSequence,Comparable,Serializable(Code) | | Holds a version number. Versions are often of the form
.
.
, but
are not required to. For example an EPSG database version is
"6.11.2" . The
separator character is the dot.
This class provides convenience methods for fetching the major, minor and reversion
numbers, and for performing comparaisons.
since: 2.4 version: $Id: Version.java 25193 2007-04-18 13:37:38Z desruisseaux $ author: Martin Desruisseaux See Also: org.geotools.factory.GeoTools.getVersion |
Field Summary | |
final public static char | SEPARATOR The separator character between
,
and
components. |
Constructor Summary | |
public | Version(String version) Creates a new version object from the supplied string. |
Method Summary | |
public char | charAt(int index) Returns the
char value at the specified index. | public int | compareTo(Version other, int limit) Compares this version with an other version object, up to the specified limit. | public int | compareTo(Object other) Compares this version with an other version object. | public boolean | equals(Object other) Compare this version string with the specified object for equality. | public synchronized Comparable | getComponent(int index) Returns the specified components of this version string. | public Comparable | getMajor() Returns the major version number. | public Comparable | getMinor() Returns the minor version number. | public Comparable | getRevision() Returns the revision number. | public int | hashCode() Returns a hash code value for this version. | public int | length() Returns the length of the version string. | public CharSequence | subSequence(int start, int end) Returns a new version string that is a subsequence of this sequence. | public String | toString() Returns the version string. |
SEPARATOR | final public static char SEPARATOR(Code) | | The separator character between
,
and
components.
|
Version | public Version(String version)(Code) | | Creates a new version object from the supplied string.
|
charAt | public char charAt(int index)(Code) | | Returns the
char value at the specified index.
|
compareTo | public int compareTo(Version other, int limit)(Code) | | Compares this version with an other version object, up to the specified limit. A limit
of 1 compares only the
version number. A limit of 2 compares
the major and
version numbers, etc. The
comparaisons are performed as
Integer object if possible, or as
String otherwise.
Parameters: other - The other version object to compare with. Parameters: limit - The maximum number of components to compare. A negative value if this version is lower than the supplied version, a positivevalue if it is higher, or 0 if they are equal. |
compareTo | public int compareTo(Object other)(Code) | | Compares this version with an other version object. This method performs the same
comparaison than
Version.compareTo(Version,int) with no limit.
Parameters: other - The other version object to compare with. A negative value if this version is lower than the supplied version, a positivevalue if it is higher, or 0 if they are equal. |
equals | public boolean equals(Object other)(Code) | | Compare this version string with the specified object for equality. Two version are
considered equal if
(other) == 0 .
|
getComponent | public synchronized Comparable getComponent(int index)(Code) | | Returns the specified components of this version string. For a version of the
major.minor.revision form, index 0 stands for the major version number,
1 stands for the minor version number and 2 stands for the revision number.
The return value is an
Integer if the component is parsable as an integer,
or a
String otherwise. If there is no component at the specified index,
then this method returns
null .
Parameters: index - The index of the component to fetch. The value at the specified index, or null if none. throws: IndexOutOfBoundsException - if index is negative. |
getMinor | public Comparable getMinor()(Code) | | Returns the minor version number. This method returns an
Integer if possible,
or a
String otherwise. If there is no minor version number, then this method
returns
null .
|
getRevision | public Comparable getRevision()(Code) | | Returns the revision number. This method returns an
Integer if possible,
or a
String otherwise. If there is no revision number, then this method
returns
null .
|
hashCode | public int hashCode()(Code) | | Returns a hash code value for this version.
|
length | public int length()(Code) | | Returns the length of the version string.
|
subSequence | public CharSequence subSequence(int start, int end)(Code) | | Returns a new version string that is a subsequence of this sequence.
|
toString | public String toString()(Code) | | Returns the version string. This is the string specified at construction time.
|
|
|