public class Version extends Object implements IVersion
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
| Modifier and Type | Field and Description |
|---|---|
static Version |
ver16 |
static Version |
ver17 |
static Version |
ver171 |
static Version |
ver20 |
static Version |
ver21 |
static Version |
ver21swn_10k |
static Version |
ver21swn_20k |
static Version |
ver21swn_30k |
static Version |
ver21swn_400k_cropped |
static Version |
ver21swn_400k_full |
static Version |
ver21swn_40k |
static Version |
ver30 |
static Version |
ver31 |
static int |
versionOffset
The byte offset of the version indicator in the standard Wordnet file headers.
|
NO_VERSION| Constructor and Description |
|---|
Version(int major,
int minor,
int bugfix)
Creates a new version object with the specified version numbers.
|
Version(int major,
int minor,
int bugfix,
String qualifier)
Creates a new version object with the specified version numbers.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
checkQualifier(String qualifier)
Checks the specified qualifier for legality.
|
static String |
checkVersion(int major,
int minor,
int bugfix,
String qualifier)
Checks the supplied version numbers.
|
static void |
checkVersionNumber(int major,
int minor,
int bugfix)
Checks the supplied version numbers.
|
boolean |
equals(Object obj) |
static Version |
extractVersion(IContentType<?> type,
ByteBuffer buffer)
Extracts a version object from a byte buffer that contains data with the
specified content type.
|
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'.
|
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,
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,
String qualifier)
Calculates the hash code for a version object with the specified version
numbers.
|
static boolean |
isIllegalQualifier(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,
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 String |
makeVersionString(int major,
int minor,
int bugfix,
String qualifier)
Creates a version string for the specified version numbers.
|
static Version |
parseVersion(CharSequence verStr)
Tries to transform the specified character sequence into a version
object.
|
static Version |
parseVersionProtected(CharSequence verStr)
Tries to transform the specified character sequence into a version
object.
|
protected Object |
readResolve()
This utility method implements the appropriate deserialization for this
object.
|
String |
toString() |
static List<Version> |
values()
Emulates the Enum.values() function.
|
public static final Version ver16
public static final Version ver17
public static final Version ver171
public static final Version ver20
public static final Version ver21
public static final Version ver30
public static final Version ver31
public static final Version ver21swn_10k
public static final Version ver21swn_20k
public static final Version ver21swn_30k
public static final Version ver21swn_40k
public static final Version ver21swn_400k_cropped
public static final Version ver21swn_400k_full
public static final int versionOffset
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.3IllegalArgumentException - if any of the version numbers are negativepublic Version(int major,
int minor,
int bugfix,
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.qIllegalArgumentException - if any of the version numbers are negative, or the qualifier
is not a legal qualifierpublic int getMajorVersion()
IVersiongetMajorVersion in interface IVersionpublic int getMinorVersion()
IVersiongetMinorVersion in interface IVersionpublic int getBugfixVersion()
IVersiongetBugfixVersion in interface IVersionpublic String getQualifier()
IVersionnull, but may be empty.getQualifier in interface IVersionnull, potentially emptyprotected Object readResolve()
public static String checkVersion(int major, int minor, int bugfix, 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 checknull-masked qualifierIllegalArgumentException - if the supplied arguments do not identify a legal versionpublic 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 numberIllegalArgumentException - if any of the supplied numbers are negativepublic static String checkQualifier(String qualifier)
IllegalArgumentException if it is not a legal qualifier.qualifier - the qualifier to checknull-masked qualifierisIllegalQualifier(String)public static boolean isIllegalVersion(int major,
int minor,
int bugfix,
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 qualifiertrue 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 numbertrue if all the numbers are non-negative;
false otherwisepublic static boolean isIllegalQualifier(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 checktrue if not a legal qualifier; false
otherwiseNullPointerException - 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 numberpublic static Version getVersion(int major, int minor, int bugfix, String qualifier)
major - the major version numberminor - the minor version numberbugfix - the bugfix version numberqualifier - the version qualifierIllegalArgumentException - if the version numbers and qualifier are not legalpublic static String makeVersionString(int major, int minor, int bugfix, 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.qIllegalArgumentExceptionpublic static int hashCode(int major,
int minor,
int bugfix,
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.qIllegalArgumentException - if the specified parameters do not identify a legal versionpublic static Version extractVersion(IContentType<?> type, ByteBuffer buffer)
null.type - the content type of the data in the bufferbuffer - the buffer containing the datanull if nonepublic static Version parseVersionProtected(CharSequence verStr)
nullverStr - the sequence of characters to be transformednull if the character sequence is
not a valid versionpublic static Version parseVersion(CharSequence verStr)
verStr - the sequence of characters to be transformedNullPointerException - if the character sequence is nullIllegalArgumentException - if the character sequence does not correspond to a legal
versionCopyright © 2018. All rights reserved.