|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.mit.jwi.item.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 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. |
Fields inherited from interface edu.mit.jwi.item.IVersion |
---|
NO_VERSION |
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. |
boolean |
equals(java.lang.Object obj)
|
static Version |
extractVersion(IContentType<?> type,
java.nio.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'. |
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 false if 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. |
protected java.lang.Object |
readResolve()
This utility method implements the appropriate deserialization for this 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 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
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 negativepublic 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 qualifierMethod Detail |
---|
public int getMajorVersion()
IVersion
getMajorVersion
in interface IVersion
public int getMinorVersion()
IVersion
getMinorVersion
in interface IVersion
public int getBugfixVersion()
IVersion
getBugfixVersion
in interface IVersion
public java.lang.String getQualifier()
IVersion
null
, but may be empty.
getQualifier
in interface IVersion
null
, potentially emptypublic int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
protected java.lang.Object readResolve()
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 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 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)
false
if 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 null
Character.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 legalpublic 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 extractVersion(IContentType<?> type, java.nio.ByteBuffer buffer)
null
.
type
- the content type of the data in the bufferbuffer
- the buffer containing the data
null
if nonepublic 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 |