Package org.jboss.modules
Class Version.Iterator
java.lang.Object
org.jboss.modules.Version.Iterator
- Enclosing class:
Version
An iterator over the parts of a version.
-
Method Summary
Modifier and TypeMethodDescriptionGet the current alphabetical part.Get the current numeric part, as aBigInteger
.int
Get the current numeric part, as anint
.long
Get the current numeric part, as along
.Get the current numeric part, as aString
.int
Get the code point of the current separator.boolean
hasNext()
Determine whether another token exists in this version.boolean
Determine if the current token is an alphabetical part.boolean
Determine if the current token is an empty (or zero-length alphabetical-to-numeric or numeric-to-alphabetical) separator.boolean
Determine if the current token is a non-empty separator.boolean
Determine if the current token is a numeric part.boolean
isPart()
Determine if the current token is some kind of part (alphabetical or numeric).boolean
Determine if the current token is some kind of separator (a character or a zero-length alphabetical-to-numeric or numeric-to-alphabetical transition).int
length()
Get the length of the current token.void
next()
Move to the next token.
-
Method Details
-
hasNext
public boolean hasNext()Determine whether another token exists in this version.- Returns:
true
if more tokens remain,false
otherwise
-
next
public void next()Move to the next token.- Throws:
NoSuchElementException
- if there are no more tokens to iterate
-
length
public int length()Get the length of the current token. If there is no current token, zero is returned.- Returns:
- the length of the current token
-
isSeparator
public boolean isSeparator()Determine if the current token is some kind of separator (a character or a zero-length alphabetical-to-numeric or numeric-to-alphabetical transition).- Returns:
true
if the token is a separator,false
otherwise
-
isPart
public boolean isPart()Determine if the current token is some kind of part (alphabetical or numeric).- Returns:
true
if the token is a separator,false
otherwise
-
isEmptySeparator
public boolean isEmptySeparator()Determine if the current token is an empty (or zero-length alphabetical-to-numeric or numeric-to-alphabetical) separator.- Returns:
true
if the token is an empty separator,false
otherwise
-
isNonEmptySeparator
public boolean isNonEmptySeparator()Determine if the current token is a non-empty separator.- Returns:
true
if the token is a non-empty separator,false
otherwise
-
getSeparatorCodePoint
public int getSeparatorCodePoint()Get the code point of the current separator. If the iterator is not positioned on a non-empty separator (i.e.isNonEmptySeparator()
returnsfalse
), then an exception is thrown.- Returns:
- the code point of the current separator
- Throws:
IllegalStateException
- if the current token is not a non-empty separator
-
isAlphaPart
public boolean isAlphaPart()Determine if the current token is an alphabetical part.- Returns:
true
if the token is an alphabetical part,false
otherwise
-
isNumberPart
public boolean isNumberPart()Determine if the current token is a numeric part.- Returns:
true
if the token is a numeric part,false
otherwise
-
getAlphaPart
Get the current alphabetical part. If the iterator is not positioned on an alphabetical part (i.e.isAlphaPart()
returnsfalse
), then an exception is thrown.- Returns:
- the current alphabetical part
- Throws:
IllegalStateException
- if the current token is not an alphabetical part
-
getNumberPartAsString
Get the current numeric part, as aString
. If the iterator is not positioned on a numeric part (i.e.isNumberPart()
returnsfalse
), then an exception is thrown.- Returns:
- the current numeric part as a
String
- Throws:
IllegalStateException
- if the current token is not a numeric part
-
getNumberPartAsLong
public long getNumberPartAsLong()Get the current numeric part, as along
. If the iterator is not positioned on a numeric part (i.e.isNumberPart()
returnsfalse
), then an exception is thrown. If the value overflows the maximum value for along
, then only the low-order 64 bits of the version number value are returned.- Returns:
- the current numeric part as a
long
- Throws:
IllegalStateException
- if the current token is not a numeric part
-
getNumberPartAsInt
public int getNumberPartAsInt()Get the current numeric part, as anint
. If the iterator is not positioned on a numeric part (i.e.isNumberPart()
returnsfalse
), then an exception is thrown. If the value overflows the maximum value for anint
, then only the low-order 32 bits of the version number value are returned.- Returns:
- the current numeric part as an
int
- Throws:
IllegalStateException
- if the current token is not a numeric part
-
getNumberPartAsBigInteger
Get the current numeric part, as aBigInteger
. If the iterator is not positioned on a numeric part (i.e.isNumberPart()
returnsfalse
), then an exception is thrown.- Returns:
- the current numeric part as a
BigInteger
- Throws:
IllegalStateException
- if the current token is not a numeric part
-