|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.mit.jverbnet.data.Version
public class Version
Default, concrete implementation of the IVersion interface. This
class, much like the Integer class, caches instances, which should be
created via the createVersion methods.
This version object takes an optional bugfix version number and string qualifier. The qualifier may only contain characters are that are valid Java
| Field Summary | |
|---|---|
static java.util.regex.Pattern |
regex
Regular expression pattern for matching a version string. |
static Version |
ver31
|
static Version |
ver32
|
| Fields inherited from interface edu.mit.jverbnet.data.IVersion |
|---|
UNKNOWN |
| Constructor Summary | |
|---|---|
Version(int major,
int minor,
int bugfix)
Creates a new version object with the specified version numbers. |
|
Version(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Creates a new version object with the specified version numbers. |
|
| Method Summary | |
|---|---|
static java.lang.String |
checkQualifier(java.lang.String qualifier)
Checks the specified qualifier for legality. |
static java.lang.String |
checkVersion(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Checks the supplied version numbers. |
static void |
checkVersionNumber(int major,
int minor,
int bugfix)
Checks the supplied version numbers. |
static int |
compare(IVersion one,
IVersion two)
Compares the versions for order. |
int |
compareTo(IVersion o)
|
boolean |
equals(java.lang.Object obj)
|
int |
getBugfixVersion()
Returns the bugfix version number, i.e., the '2' in '1.7.2'. |
int |
getMajorVersion()
Returns the major version number, i.e., the '1' in '1.7.2'. |
int |
getMinorVersion()
Returns the minor version number, i.e., the '7' in '1.7.2'. |
java.lang.String |
getQualifier()
Returns the version qualifier, i.e., the 'abc' in '1.7.2.abc'. |
static Version |
getVersion(int major,
int minor,
int bugfix)
Creates and caches, or retrieves from the cache, a version object corresponding to the specified numbers. |
static Version |
getVersion(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Creates and caches, or retrieves from the cache, a version object corresponding to the specified numbers. |
int |
hashCode()
|
static int |
hashCode(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Calculates the hash code for a version object with the specified version numbers. |
static boolean |
isIllegalQualifier(java.lang.String qualifier)
Returns falseif the specified qualifier is legal, namely, if
the string is either the empty string, or contains only characters that
are found in valid java identifiers. |
static boolean |
isIllegalVersion(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Returns true if the arguments identify a legal version;
false otherwise. |
static boolean |
isIllegalVersionNumber(int major,
int minor,
int bugfix)
Returns true if any of three numbers are negative |
static java.lang.String |
makeVersionString(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Creates a version string for the specified version numbers. |
static Version |
parseVersion(java.lang.CharSequence verStr)
Tries to transform the specified character sequence into a version object. |
static Version |
parseVersionProtected(java.lang.CharSequence verStr)
Tries to transform the specified character sequence into a version object. |
java.lang.String |
toString()
|
static java.util.List<Version> |
values()
Emulates the Enum.values() function. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Version ver31
public static final Version ver32
public static final java.util.regex.Pattern regex
| Constructor Detail |
|---|
public Version(int major,
int minor,
int bugfix)
Clients should normally obtain instances of this class via the static
getVersion methods.
major - the major version number, i.e., the '1' in 1.2.3minor - the minor version number, i.e., the '2' in 1.2.3bugfix - the bugfix version number, i.e., the '3' in 1.2.3
java.lang.IllegalArgumentException - if any of the version numbers are negative
public Version(int major,
int minor,
int bugfix,
java.lang.String qualifier)
Clients should normally obtain instances of this class via the static
getVersion methods.
major - the major version number, i.e., the '1' in 1.2.3.qminor - the minor version number, i.e., the '2' in 1.2.3.qbugfix - the bugfix version number, i.e., the '3' in 1.2.3.qqualifier - the version qualifier, i.e., the 'q' in 1.2.3.q
java.lang.IllegalArgumentException - if any of the version numbers are negative, or the qualifier
is not a legal qualifier| Method Detail |
|---|
public int getMajorVersion()
IVersion
getMajorVersion in interface IVersionpublic int getMinorVersion()
IVersion
getMinorVersion in interface IVersionpublic int getBugfixVersion()
IVersion
getBugfixVersion in interface IVersionpublic java.lang.String getQualifier()
IVersionnull, but may be empty.
getQualifier in interface IVersionnull, potentially emptypublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(IVersion o)
compareTo in interface java.lang.Comparable<IVersion>
public static int compare(IVersion one,
IVersion two)
public static java.lang.String checkVersion(int major,
int minor,
int bugfix,
java.lang.String qualifier)
IllegalArgumentException if they do not define a legal version.,
major - the major version numberminor - the minor version numberbugfix - the bugfix version numberqualifier - the qualifier to check
null-masked qualifier
java.lang.IllegalArgumentException - if the supplied arguments do not identify a legal version
public static void checkVersionNumber(int major,
int minor,
int bugfix)
IllegalArgumentException if the version numbers are not valid
(that is, any are below zero).
major - the major version numberminor - the minor version numberbugfix - the bugfix version number
java.lang.IllegalArgumentException - if any of the supplied numbers are negativepublic static java.lang.String checkQualifier(java.lang.String qualifier)
IllegalArgumentException if it is not a legal qualifier.
qualifier - the qualifier to check
null-masked qualifierisIllegalQualifier(String)
public static boolean isIllegalVersion(int major,
int minor,
int bugfix,
java.lang.String qualifier)
true if the arguments identify a legal version;
false otherwise.
major - the major version numberminor - the minor version numberbugfix - the bugfix version numberqualifier - the version qualifier
true if the arguments identify a legal version;
false otherwise.
public static boolean isIllegalVersionNumber(int major,
int minor,
int bugfix)
major - the major version numberminor - the minor version numberbugfix - the bugfix version number
true if all the numbers are non-negative;
false otherwisepublic static boolean isIllegalQualifier(java.lang.String qualifier)
falseif the specified qualifier is legal, namely, if
the string is either the empty string, or contains only characters that
are found in valid java identifiers.
qualifier - the qualifier to check
true if not a legal qualifier; false
otherwise
java.lang.NullPointerException - if the specified string is nullCharacter.isJavaIdentifierPart(char)
public static Version getVersion(int major,
int minor,
int bugfix)
major - the major version numberminor - the minor version numberbugfix - the bugfix version number
public static Version getVersion(int major,
int minor,
int bugfix,
java.lang.String qualifier)
major - the major version numberminor - the minor version numberbugfix - the bugfix version numberqualifier - the version qualifier
java.lang.IllegalArgumentException - if the version numbers and qualifier are not legal
public static java.lang.String makeVersionString(int major,
int minor,
int bugfix,
java.lang.String qualifier)
major - the major version number, i.e., the '1' in 1.2.3.qminor - the minor version number, i.e., the '2' in 1.2.3.qbugfix - the bugfix version number, i.e., the '3' in 1.2.3.qqualifier - the version qualifier, i.e., the 'q' in 1.2.3.q
java.lang.IllegalArgumentException
public static int hashCode(int major,
int minor,
int bugfix,
java.lang.String qualifier)
major - the major version number, i.e., the '1' in 1.2.3.qminor - the minor version number, i.e., the '2' in 1.2.3.qbugfix - the bugfix version number, i.e., the '3' in 1.2.3.qqualifier - the version qualifier, i.e., the 'q' in 1.2.3.q
java.lang.IllegalArgumentException - if the specified parameters do not identify a legal versionpublic static Version parseVersionProtected(java.lang.CharSequence verStr)
null
verStr - the sequence of characters to be transformed
null if the character sequence is
not a valid versionpublic static Version parseVersion(java.lang.CharSequence verStr)
verStr - the sequence of characters to be transformed
java.lang.NullPointerException - if the character sequence is null
java.lang.IllegalArgumentException - if the character sequence does not correspond to a legal
versionpublic static java.util.List<Version> values()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||