Class IntProcedureEntriesStack

  • All Implemented Interfaces:
    IntProcedure

    public class IntProcedureEntriesStack
    extends Object
    implements IntProcedure
    The IntProcedureEntriesStack class provides an implementation of an IntProcedure and records node id's from its execution in a stack.

    Simply pass an instance of this class to an rtree search and access the retrieved node indices with peek(), peek(int), and pop(). These indices are returned as Integer objects.
    • Constructor Detail

      • IntProcedureEntriesStack

        public IntProcedureEntriesStack()
        Initializes an empty IntProcedureEntriesStack.
    • Method Detail

      • execute

        public boolean execute​(int id)
        Caches the id passed from the calling method to the stack. This method is utilized primarily for the purpose of rtree searches and is typically not invoked explicitly
        Specified by:
        execute in interface IntProcedure
        Parameters:
        id - a node id (from an RTree)
        Returns:
        true if execution succeeds, otherwise false
      • pop

        public Integer pop()
        Removes the Integer value from the top of this stack
        Returns:
        the value removed from the top of this stack or null if there are no values on the stack
      • popAll

        public List<Integer> popAll()
        Removes all items from this stack. Use clear() instead, if the values returned by this methods invokation are not going to be used.
        Returns:
        a copy of the values removed from this stack in an Integer list
      • push

        public void push​(int value)
        Pushes the given value to the top of this stack
        Parameters:
        value - an Integer
      • peek

        public Integer peek()
        Retrieves the value of the top-most item on this stack
        Returns:
        an Integer value, or null if no values have been pushed to this stack
      • peek

        public Integer peek​(int index)
                     throws IndexOutOfBoundsException
        Retrieves the value of the top-most item on this stack
        Parameters:
        index - an integer index
        Returns:
        an Integer value
        Throws:
        IndexOutOfBoundsException - if the indices is out of range (indices < 0 || indices >= size())
      • peekAll

        public List<Integer> peekAll()
        Retrieves an Integer list of all items on this stack
        Returns:
        a copy of the internal Integer list
      • size

        public int size()
        Returns the number of elements in this stack. If this stack contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.
        Returns:
        the number of elements in this stack.
      • clear

        public boolean clear()
        Removes all of the elements from this stack (optional operation). This list will be empty after this call returns (unless it throws an exception).
        Returns:
        true on success; otherwise false
      • dump

        public String dump()
        Builds a dump of the indexed values within this stack
        Returns:
        a String