Class CollectionIndex


  • class CollectionIndex
    extends java.lang.Object
    HTMLCollectionImpl.item(int) must traverse down the tree and decrement the index until it matches an element who's index is zero. Since integers are passed by value, this class servers to pass the index into each recursion by reference. It encompasses all the operations that need be performed on the index, although direct access is possible.

    See Also:
    HTMLCollectionImpl.item(int)
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private int index_
      Holds the actual value that is passed by reference using this class.
    • Constructor Summary

      Constructors 
      Constructor Description
      CollectionIndex​(int index)
      Constructs a new index with the specified initial value.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) void decrement()
      Decrements the index by one.
      (package private) boolean isZero()
      Returns true if index is zero (or negative).
      • Methods inherited from class java.lang.Object

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

      • index_

        private int index_
        Holds the actual value that is passed by reference using this class.
    • Constructor Detail

      • CollectionIndex

        CollectionIndex​(int index)
        Constructs a new index with the specified initial value. The index will then be decremeneted until it reaches zero.
        Parameters:
        index - The initial value
    • Method Detail

      • decrement

        void decrement()
        Decrements the index by one.
      • isZero

        boolean isZero()
        Returns true if index is zero (or negative).
        Returns:
        True if index is zero