net.sourceforge.combean.graph.containers
Class StackAsNodeStack

Package class diagram package StackAsNodeStack
java.lang.Object
  extended by net.sourceforge.combean.graph.containers.StackAsNodeStack
All Implemented Interfaces:
FixedNodeCollection, NodeStack

public class StackAsNodeStack
extends Object
implements NodeStack

Uses a java.util.Stack to implement a NodeStack.


Constructor Summary
StackAsNodeStack()
          constructor
StackAsNodeStack(Stack<Node> stack)
          Use a Stack as a NodeStack.
 
Method Summary
 Stack<Node> getStack()
           
 boolean isEmpty()
          Check if the collection contains any elements.
 NodeIterator iterator()
          Return an iterator through all nodes in the collection.
 Node peek()
          Get the node on top of the stack without removing it.
 Node pop()
          Get the node on top of the stack and remove it.
 Node push(Node v)
          Put a node on top of the stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StackAsNodeStack

public StackAsNodeStack()
constructor


StackAsNodeStack

public StackAsNodeStack(Stack<Node> stack)
Use a Stack as a NodeStack.

Parameters:
stack - the Stack to be wrapped.
Method Detail

peek

public Node peek()
Description copied from interface: NodeStack
Get the node on top of the stack without removing it.

Specified by:
peek in interface NodeStack
Returns:
the node on top of the stack

pop

public Node pop()
Description copied from interface: NodeStack
Get the node on top of the stack and remove it.

Specified by:
pop in interface NodeStack
Returns:
the node on top of the stack

push

public Node push(Node v)
Description copied from interface: NodeStack
Put a node on top of the stack.

Specified by:
push in interface NodeStack
Parameters:
v - the node to add to the stack
Returns:
the node which has been added

isEmpty

public boolean isEmpty()
Description copied from interface: FixedNodeCollection
Check if the collection contains any elements.

Specified by:
isEmpty in interface FixedNodeCollection
Returns:
true if empty.

iterator

public NodeIterator iterator()
Description copied from interface: FixedNodeCollection
Return an iterator through all nodes in the collection.

Specified by:
iterator in interface FixedNodeCollection
Returns:
iterator

getStack

public Stack<Node> getStack()
Returns:
Returns the stack.