Package VASSAL.tools.version
Class VassalVersionTokenizer
java.lang.Object
VASSAL.tools.version.VassalVersionTokenizer
- All Implemented Interfaces:
VersionTokenizer
public class VassalVersionTokenizer extends Object implements VersionTokenizer
A finite-state machine for converting VASSAL version numbers into
a series of integers. The integers thus returned from two different
tokenizers may be compared to determine the temporal ordering of two
VASSAL versions.
Valid version strings are dotted decimal digits, followed optionally
by a tag, followed optionally by a build number. Anything beyond the
build nubmer is ignored.
Old version numbers which are not valid by current standards (e.g., 3.0b6)
may be successfully parsed far enough to determine their ordering with
respect to post-3.1.0 versions.
- Since:
- 3.1.0
- Author:
- Joel Uckelman
- See Also:
VersionFormatException
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classVassalVersionTokenizer.State -
Field Summary
-
Constructor Summary
Constructors Constructor Description VassalVersionTokenizer(String version)Constructs aVersionTokenizerwhich operates on a versionString. -
Method Summary
-
Field Details
-
Constructor Details
-
VassalVersionTokenizer
Constructs aVersionTokenizerwhich operates on a versionString.- Parameters:
version- the versionStringto parse- Throws:
IllegalArgumentException- ifversion == null.
-
-
Method Details
-
hasNext
public boolean hasNext()Returnstrueif the versionStringis not fully parsed.- Specified by:
hasNextin interfaceVersionTokenizer- Returns:
trueifVersionTokenizer.next()will return more integers
-
next
Returns an integer representing the next token.- Specified by:
nextin interfaceVersionTokenizer- Returns:
- the integer representing the next token
- Throws:
VersionFormatException- if the string deviates from the current version formatting rules at the next token.
-