Package org.jboss.modules
Class Version.Iterator
- java.lang.Object
-
- org.jboss.modules.Version.Iterator
-
- Enclosing class:
- Version
public class Version.Iterator extends java.lang.ObjectAn iterator over the parts of a version.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetAlphaPart()Get the current alphabetical part.java.math.BigIntegergetNumberPartAsBigInteger()Get the current numeric part, as aBigInteger.intgetNumberPartAsInt()Get the current numeric part, as anint.longgetNumberPartAsLong()Get the current numeric part, as along.java.lang.StringgetNumberPartAsString()Get the current numeric part, as aString.intgetSeparatorCodePoint()Get the code point of the current separator.booleanhasNext()Determine whether another token exists in this version.booleanisAlphaPart()Determine if the current token is an alphabetical part.booleanisEmptySeparator()Determine if the current token is an empty (or zero-length alphabetical-to-numeric or numeric-to-alphabetical) separator.booleanisNonEmptySeparator()Determine if the current token is a non-empty separator.booleanisNumberPart()Determine if the current token is a numeric part.booleanisPart()Determine if the current token is some kind of part (alphabetical or numeric).booleanisSeparator()Determine 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 Detail
-
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:
java.util.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:
java.lang.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
public java.lang.String 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:
java.lang.IllegalStateException- if the current token is not an alphabetical part
-
getNumberPartAsString
public java.lang.String 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:
java.lang.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:
java.lang.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:
java.lang.IllegalStateException- if the current token is not a numeric part
-
getNumberPartAsBigInteger
public java.math.BigInteger 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:
java.lang.IllegalStateException- if the current token is not a numeric part
-
-