org.amino.ds.lockfree
Class EBStack<E>

java.lang.Object
  extended by org.amino.ds.lockfree.EBStack<E>
Type Parameters:
E - Type of elements
All Implemented Interfaces:
IStack<E>

public class EBStack<E>
extends java.lang.Object
implements IStack<E>

Author:
Zhi Gan (ganzhi@gmail.com)

Constructor Summary
EBStack()
          Default constructor.
EBStack(int size)
          Specify size of internal elimination array.
 
Method Summary
 void dump()
          dump array.
 boolean isEmpty()
          Check to see if Stack is empty.
 E peek()
          Return copy of the top data on the Stack.
 E pop()
          Pop data from the Stack.
 void push(E d)
          Push data onto Stack.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EBStack

public EBStack()
Default constructor.


EBStack

public EBStack(int size)
Specify size of internal elimination array.

Parameters:
size - default size of stack
Method Detail

dump

public void dump()
dump array.


pop

public E pop()
Pop data from the Stack.

Specified by:
pop in interface IStack<E>
Returns:
topmost element of the stack.

push

public void push(E d)
Push data onto Stack.

Specified by:
push in interface IStack<E>
Parameters:
d - data to be pushed onto the stack.

isEmpty

public boolean isEmpty()
Check to see if Stack is empty.

Specified by:
isEmpty in interface IStack<E>
Returns:
true if stack is empty.

peek

public E peek()
Return copy of the top data on the Stack.

Specified by:
peek in interface IStack<E>
Returns:
copy of top of stack, or null if empty.


Copyright © 2008. All Rights Reserved.