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.intGet the current numeric part, as anint.longGet the current numeric part, as along.Get the current numeric part, as aString.intGet the code point of the current separator.booleanhasNext()Determine whether another token exists in this version.booleanDetermine if the current token is an alphabetical part.booleanDetermine if the current token is an empty (or zero-length alphabetical-to-numeric or numeric-to-alphabetical) separator.booleanDetermine if the current token is a non-empty separator.booleanDetermine if the current token is a numeric part.booleanisPart()Determine if the current token is some kind of part (alphabetical or numeric).booleanDetermine if the current token is some kind of separator (a character or a zero-length alphabetical-to-numeric or numeric-to-alphabetical transition).intlength()Get the length of the current token.voidnext()Move to the next token.
-
Method Details
-
hasNext
public boolean hasNext()Determine whether another token exists in this version.- Returns:
trueif more tokens remain,falseotherwise
-
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:
trueif the token is a separator,falseotherwise
-
isPart
public boolean isPart()Determine if the current token is some kind of part (alphabetical or numeric).- Returns:
trueif the token is a separator,falseotherwise
-
isEmptySeparator
public boolean isEmptySeparator()Determine if the current token is an empty (or zero-length alphabetical-to-numeric or numeric-to-alphabetical) separator.- Returns:
trueif the token is an empty separator,falseotherwise
-
isNonEmptySeparator
public boolean isNonEmptySeparator()Determine if the current token is a non-empty separator.- Returns:
trueif the token is a non-empty separator,falseotherwise
-
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:
trueif the token is an alphabetical part,falseotherwise
-
isNumberPart
public boolean isNumberPart()Determine if the current token is a numeric part.- Returns:
trueif the token is a numeric part,falseotherwise
-
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
-