|
|||||||||
Home >> All >> javax >> ide >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |
javax.ide.util
Class Version

java.lang.Objectjavax.ide.util.Version
- All Implemented Interfaces:
- java.lang.Comparable
- public final class Version
- extends java.lang.Object
- implements java.lang.Comparable
- extends java.lang.Object
Represents the version number of an extension or component. A version number is an immutable ordered sequence of integer values.
Version numbers can be represented in two forms. When you construct a
new Version object using a String representation of the version number, this
String representation is stored and returned by the toString()
55 method.
This form of the version number will retain any redundant leading zeros in
any of the integer values which make up the version number.
Conversely, in the canonical form, a version number does not retain
leading zeros. The canonical form of new Version( "1.02.03" ) would
be "1.2.3". You can retrieve the canonical form of a Version object
using the toCanonicalString()
55 method.
Field Summary | |
private static java.util.HashMap |
_convertCache
|
private int[] |
_numbers
|
private java.lang.String |
_versionLabel
|
Constructor Summary | |
Version(java.lang.String versionLabel)
Constructs a Version object from a String representation. |
Method Summary | |
int |
compareTo(java.lang.Object other)
Compare this version object with another version object. |
private int[] |
convert(java.lang.String versionLabel)
|
boolean |
equals(java.lang.Object other)
Compare this version object with another version object for equality. |
int |
hashCode()
Get a value that represents this Object, as uniquely as possible within the confines of an int. |
java.lang.String |
toCanonicalString()
Get this version number as a canonicalized string. |
int[] |
toIntArray()
Converts this Version to an int array. |
java.lang.String |
toString()
Get this version number as a string. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
_convertCache
private static final java.util.HashMap _convertCache
_numbers
private final int[] _numbers
_versionLabel
private final java.lang.String _versionLabel
Constructor Detail |
Version
public Version(java.lang.String versionLabel) throws java.lang.NumberFormatException
- Constructs a Version object from a String representation.
Method Detail |
toIntArray
public int[] toIntArray()
- Converts this Version to an int array.
compareTo
public int compareTo(java.lang.Object other)
- Compare this version object with another version object.
Comparison of two version numbers applies to the canonical form of the
version number. For example, the result of evaluating the expression
new Version( "1.05.07" ).compareTo( new Version( "1.5.0006" ) ) is
a positive integer indicating that version 1.5.7 is greater than 1.5.6.
- Specified by:
compareTo
in interfacejava.lang.Comparable
toString
public java.lang.String toString()
- Get this version number as a string. The string returned is equal to the
string provided in the constructor. For example,
new Version( "1.05.06" ).toString(); would return
"1.05.06".
toCanonicalString
public java.lang.String toCanonicalString()
- Get this version number as a canonicalized string. Leading zeros will be
removed from all numerical components of the version. For example,
new Version( "1.05.06" ).toString(); would return
"1.5.6".
equals
public boolean equals(java.lang.Object other)
- Compare this version object with another version object for equality.
Equality of two version numbers applies to the canonical form of the
version number. For example, the result of evaluating the expression
new Version( "1.05.06" ).equals( new Version( "1.5.0006" ) ) is
true.
hashCode
public int hashCode()
- Description copied from class:
java.lang.Object
- Get a value that represents this Object, as uniquely as
possible within the confines of an int.
There are some requirements on this method which subclasses must follow:
- Semantic equality implies identical hashcodes. In other
words, if
a.equals(b)
is true, thena.hashCode() == b.hashCode()
must be as well. However, the reverse is not necessarily true, and two objects may have the same hashcode without being equal. - It must be consistent. Whichever value o.hashCode() returns on the first invocation must be the value returned on all later invocations as long as the object exists. Notice, however, that the result of hashCode may change between separate executions of a Virtual Machine, because it is not invoked on the same object.
Notice that since
hashCode
is used in java.util.Hashtable and other hashing classes, a poor implementation will degrade the performance of hashing (so don't blindly implement it as returning a constant!). Also, if calculating the hash is time-consuming, a class may consider caching the results.The default implementation returns
System.identityHashCode(this)
- Semantic equality implies identical hashcodes. In other
words, if
convert
private int[] convert(java.lang.String versionLabel) throws java.lang.NumberFormatException
|
|||||||||
Home >> All >> javax >> ide >> [ util overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: ![]() ![]() ![]() |
DETAIL: FIELD | CONSTR | METHOD |