Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.util.intr
Class IntStack

java.lang.Object
  extended by cytoscape.util.intr.IntStack
All Implemented Interfaces:
Serializable

public final class IntStack
extends Object
implements Serializable

A first-in, last-out container of 32 bit integers. In the underlying implementation, the memory consumed by an instance of this class may increase, but does never decrease.

An instance of this class is serializable; however, serialized instances of this class should not be stored in a persistent manner because the serialization implemented in this class makes no attempt at handling class versioning.

See Also:
Serialized Form

Constructor Summary
IntStack()
          Creates a new stack of integers.
 
Method Summary
 IntEnumerator elements()
          Returns an enumeration of all elements currently on this stack.
 void empty()
          Removes all integers from this stack.
 int peek()
          A non-mutating operation that retrieves the next integer on this stack.
 int pop()
          Removes and returns the next integer on this stack.
 void push(int value)
          Pushes a new integer onto this stack.
 int size()
          Returns the number of integers that are currently on this stack.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IntStack

public IntStack()
Creates a new stack of integers.

Method Detail

empty

public final void empty()
Removes all integers from this stack. This operation has constant time complexity.


size

public final int size()
Returns the number of integers that are currently on this stack.


push

public final void push(int value)
Pushes a new integer onto this stack. A successive peek() or pop() call will return the specified value.


peek

public final int peek()
A non-mutating operation that retrieves the next integer on this stack.

It is considered an error to call this method if there are no integers currently on this stack. If size() returns zero immediately before this method is called, the results of this operation are undefined.


pop

public final int pop()
Removes and returns the next integer on this stack.

It is considered an error to call this method if there are no integers currently on this stack. If size() returns zero immediately before this method is called, the results of this operation are undefined.


elements

public final IntEnumerator elements()
Returns an enumeration of all elements currently on this stack. The order of elements in the returned enumeration is based on the elements' popping order on the stack; the first element returned is the element waiting to be popped off the stack.

No operation on this stack will have an effect on the returned enumeration except for push(). If calls to push() are mingled with calls to iterate over the returned enumeration, the contents of this enumeration become undefined. Iterating over the returned enumeration never has an affect on this stack.


www.cytoscape.org