Class IteratorOutOfBoundsException

  • All Implemented Interfaces:
    java.io.Serializable

    public class IteratorOutOfBoundsException
    extends java.lang.IndexOutOfBoundsException
    An exception thrown by the HNLI & HNLIInclusive iterators when, in the processes of modifying or reading the contents of the most recent Iterator-Match, a location is specified that's out of the bounds of the Vector itself.

    Using this Exception:
    The use of this exception differs slightly from that of the CursorException, with the primary difference being that a failed cursor-operation resulting in an invalid-cursor is not identical to an "Out of Bounds" exception for that iterator (when the Iterator, itself, might not have even had a cursor set by the user!).
    See Also:
    HNLIInclusive, HNLI, Serialized Form


    • Field Summary

       
      Serializable ID
      Modifier and Type Field
      static long serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      IteratorOutOfBoundsException()
      Constructs an IteratorOutOfBoundsException with no detail message.
      IteratorOutOfBoundsException​(String message)
      Constructs an IteratorOutOfBoundsException with the specified detail message.
    • Method Summary

       
      'static' Exception Check Methods
      Modifier and Type Method
      static void check​(Vector<?> v, int pos)
      static void check​(Vector<?> v, int[] posArr)
      static void check​(Vector<?> v, DotPair dp)
      • Methods inherited from class java.lang.Throwable

        addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • serialVersionUID

        🡇     🗕  🗗  🗖
        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.

        Note that Java's java.lang.Exception and java.lang.Error classes implement the Serializable interface, and a warning-free build expects this field be defined here.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
         public static final long serialVersionUID = 1;
        
    • Method Detail

      • check

        🡅  🡇     🗕  🗗  🗖
        public static void check​(java.util.Vector<?> v,
                                 int pos)
        This method provides a consistently formatted error message when this exception is thrown by the HNLI & HNLIInclusive Iterator classes. Mostly, like standard Vector operations, if the int 'pos' parameter that was passed is negative or past the end of the Vector, an IndexOutOfBoundsException will be thrown.
        Parameters:
        v - This is usually passed a reference to the internal Raw-Type Vector used by an HNLI & HNLIInclusive Iterator class.

        NOTE: The symbols <?> appended to the (almost) 'raw-type' here, are only there to prevent the java-compiler from issuing warnings regarding the use of "Raw Types." This warning is, actually, only issued if the command-line option -Xlint:all option is used.
        pos - This is the position that has been attempted to index that Vector.
        Throws:
        IteratorOutOfBoundsException - This will throw if the value passed to parameter 'pos' is negative, or greater than the size of the Vector parameter 'v'.
        See Also:
        HNLI, HNLIInclusive
        Code:
        Exact Method Body:
         if (pos < 0) throw new IteratorOutOfBoundsException(
             "An attempt was made to reference the internal-state vector with a negative " +
             "index-value: [" + pos + "]"
         );
        
         if (pos >= v.size()) throw new IteratorOutOfBoundsException(
             "An attempt was made to reference the internal-state vector with an index that " +
             "is past the end of the Vector.  The attempted operation was made using " +
             "index [" + pos + "], but the internal-state vector has " +
             "vector.size() [" + v.size() + "]."
         );
        
      • check

        🡅  🡇     🗕  🗗  🗖
        public static void check​(java.util.Vector<?> v,
                                 DotPair dp)
        This method provides a consistently formatted error message for this exception. This is used by the HNLI & HNLIInclusive Iterator classes. Mostly, like standard Vector operations, if the DotPair 'dp' provided is not consistent with the dimensions of the input html-Vector, then an IndexOutOfBoundsException will be thrown.
        Parameters:
        v - This is usually passed a reference to the internal Raw-Type Vector used by an HNLI & HNLIInclusive Iterator class.

        NOTE: The symbols <?> appended to the (almost) 'raw-type' here, are only there to prevent the java-compiler from issuing warnings regarding the use of "Raw Types." This warning is, actually, only issued if the command-line option -Xlint:all option is used.
        dp - This is the sub-section, or sub-list of the Vector that is being checked.
        Throws:
        IteratorOutOfBoundsException - This will throw if the value passed to parameter 'dp' is negative, or greater than the size of Vector parameter 'v'.
        See Also:
        HNLI, HNLIInclusive
        Code:
        Exact Method Body:
         if (dp.end >= v.size()) throw new IteratorOutOfBoundsException(
             "An attempt was made to reference the internal-state vector with an index that " +
             "is past the end of the Vector.  The attempted operation was made using " +
             "DotPair " + dp.toString() + ", but the internal-state vector has " +
             "vector.size() [" + v.size() + "]."
         );
        
      • check

        🡅     🗕  🗗  🗖
        public static void check​(java.util.Vector<?> v,
                                 int[] posArr)
        This method provides a consistently formatted error message when this exception is thrown by the HNLI & HNLIInclusive Iterator classes. Mostly, like standard Vector operations, if any of the index-positions that are referenced by the int[] posArr parameter are negative or past the end of the Vector, an IndexOutOfBoundsException will be thrown.
        Parameters:
        v - This is usually passed a reference to the internal Raw-Type Vector used by an HNLI & HNLIInclusive Iterator class.

        NOTE: The symbols <?> appended to the (almost) 'raw-type' here, are only there to prevent the java-compiler from issuing warnings regarding the use of "Raw Types." This warning is, actually, only issued if the command-line option -Xlint:all option is used.
        posArr - This is the array of position-indices into Vector parameter 'v' that have been requested to update or for replacement.

        IMPORTANT: In the code that invokes this method, the int[] position-array passed to parameter 'posArr' will ALWAYS have been sorted before being received here. As such, only the first and last elements of this array are actually check for validity. If this array is not sorted, then the check performed by this method will be thoroughly insufficient.
        Throws:
        IteratorOutOfBoundsException - This will throw if any of the the values passed to parameter 'posArr' are negative, or greater than the size of Vector parameter 'v'.
        See Also:
        HNLI, HNLIInclusive
        Code:
        Exact Method Body:
         if (posArr[0] < 0) throw new IteratorOutOfBoundsException(
                 "An attempt was made to reference the internal-state vector with a " +
                 "negative index-value.  The smallest (most-negative) value " +
                 "passed to the vector-index integer-array was [" + posArr[0] + "]."
             );
         if (posArr[posArr.length-1] >= v.size()) throw new IteratorOutOfBoundsException(
                 "An attempt was made to reference the internal-state vector with a " +
                 "location that is past the end of the Vector.  The largest value passed to " +
                 "the vector-index integer-array was [" + posArr[posArr.length-1] + "].  " +
                 "The internal-state vector has vector.size() [" + v.size() + "]."
             );