Class Version.Iterator

  • Enclosing class:
    Version

    public class Version.Iterator
    extends java.lang.Object
    An iterator over the parts of a version.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getAlphaPart()
      Get the current alphabetical part.
      java.math.BigInteger getNumberPartAsBigInteger()
      Get the current numeric part, as a BigInteger.
      int getNumberPartAsInt()
      Get the current numeric part, as an int.
      long getNumberPartAsLong()
      Get the current numeric part, as a long.
      java.lang.String getNumberPartAsString()
      Get the current numeric part, as a String.
      int getSeparatorCodePoint()
      Get the code point of the current separator.
      boolean hasNext()
      Determine whether another token exists in this version.
      boolean isAlphaPart()
      Determine if the current token is an alphabetical part.
      boolean isEmptySeparator()
      Determine if the current token is an empty (or zero-length alphabetical-to-numeric or numeric-to-alphabetical) separator.
      boolean isNonEmptySeparator()
      Determine if the current token is a non-empty separator.
      boolean isNumberPart()
      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 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).
      int length()
      Get the length of the current token.
      void next()
      Move to the next token.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • 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:
        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:
        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:
        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:
        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 java.lang.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:
        java.lang.IllegalStateException - if the current token is not an alphabetical part
      • getNumberPartAsString

        public java.lang.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:
        java.lang.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:
        java.lang.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:
        java.lang.IllegalStateException - if the current token is not a numeric part
      • getNumberPartAsBigInteger

        public java.math.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:
        java.lang.IllegalStateException - if the current token is not a numeric part