com.mchange.util.impl
Class CircularList

java.lang.Object
  extended by com.mchange.util.impl.CircularList
All Implemented Interfaces:
Cloneable

public class CircularList
extends Object
implements Cloneable

CircularList is a list class. Objects can be added at the beginning or end; they may be enumerated through forwards or backwards; they may be retrieved directly or by index from the front or rear. CircularLists can also be enumerated endlessly. If the list contains any elements at all, an "unterminated" Enumeration will always claim to have more elements... when it's done enumerating, it will start over again. The default Enumeration is of the usual, terminated variety, however.

This class is a completely UNSYNCHRONIZED implementation class. Synchronize on calls where necessary.


Constructor Summary
CircularList()
           
 
Method Summary
 void addElementToFront(Object object)
           
 void appendElement(Object object)
           
 Object clone()
          Returns a shallow copy.
 Enumeration elements()
           
 Enumeration elements(boolean forward)
           
 Enumeration elements(boolean forward, boolean terminated)
           
 Object getElementFromBack(int index)
           
 Object getElementFromFront(int index)
           
 Object getFirstElement()
           
 Object getLastElement()
           
static void main(String[] argv)
           
 void removeAllElements()
           
 void removeFirstElement()
           
 void removeFromBack(int count)
           
 void removeFromFront(int count)
           
 void removeLastElement()
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CircularList

public CircularList()
Method Detail

appendElement

public void appendElement(Object object)

addElementToFront

public void addElementToFront(Object object)

removeFirstElement

public void removeFirstElement()

removeLastElement

public void removeLastElement()

removeFromFront

public void removeFromFront(int count)

removeFromBack

public void removeFromBack(int count)

removeAllElements

public void removeAllElements()

getElementFromFront

public Object getElementFromFront(int index)

getElementFromBack

public Object getElementFromBack(int index)

getFirstElement

public Object getFirstElement()

getLastElement

public Object getLastElement()

elements

public Enumeration elements(boolean forward,
                            boolean terminated)

elements

public Enumeration elements(boolean forward)

elements

public Enumeration elements()

size

public int size()

clone

public Object clone()
Returns a shallow copy. The list is cloned, but not the elements within it.

Overrides:
clone in class Object

main

public static void main(String[] argv)