Class Version.Iterator

java.lang.Object
org.jboss.modules.Version.Iterator
Enclosing class:
Version

public class Version.Iterator extends Object
An iterator over the parts of a version.
  • 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() returns false), 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

      public String getAlphaPart()
      Get the current alphabetical part. If the iterator is not positioned on an alphabetical part (i.e. isAlphaPart() returns false), then an exception is thrown.
      Returns:
      the current alphabetical part
      Throws:
      IllegalStateException - if the current token is not an alphabetical part
    • getNumberPartAsString

      public String getNumberPartAsString()
      Get the current numeric part, as a String. If the iterator is not positioned on a numeric part (i.e. isNumberPart() returns false), 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 a long. If the iterator is not positioned on a numeric part (i.e. isNumberPart() returns false), then an exception is thrown. If the value overflows the maximum value for a long, 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 an int. If the iterator is not positioned on a numeric part (i.e. isNumberPart() returns false), then an exception is thrown. If the value overflows the maximum value for an int, 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

      public BigInteger getNumberPartAsBigInteger()
      Get the current numeric part, as a BigInteger. If the iterator is not positioned on a numeric part (i.e. isNumberPart() returns false), then an exception is thrown.
      Returns:
      the current numeric part as a BigInteger
      Throws:
      IllegalStateException - if the current token is not a numeric part