ProGAL.dataStructures
Class DLCyclicList<T>

java.lang.Object
  extended by ProGAL.dataStructures.DLCyclicList<T>
All Implemented Interfaces:
java.lang.Iterable<T>

public class DLCyclicList<T>
extends java.lang.Object
implements java.lang.Iterable<T>


Nested Class Summary
static class DLCyclicList.DLNode<T>
           
 
Constructor Summary
DLCyclicList()
           
 
Method Summary
 T delete(DLCyclicList.DLNode<T> nd)
          Deletes a node from the list and returns its object.
 DLCyclicList.DLNode<T> findNode(java.lang.Object obj)
          Finds the element containing given object.
 DLCyclicList.DLNode<T> getEntry()
           
 DLCyclicList.DLNode<T> getFirst()
           
 int getSize()
          Returns the number of elements in this cyclic list.
 boolean isEmpty()
          Returns true if the list is empty
 java.util.Iterator<T> iterator()
           
static void main(java.lang.String[] args)
           
 void pushAfter(T obj, DLCyclicList.DLNode<T> n)
          Adds an object after the specified node in the list.
 void pushBefore(T obj)
          Adds the object before the entry of the list.
 void pushBefore(T obj, DLCyclicList.DLNode<T> n)
          Adds an object before the specified node in the list.
 void setEntry(DLCyclicList.DLNode<T> n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DLCyclicList

public DLCyclicList()
Method Detail

isEmpty

public boolean isEmpty()
Returns true if the list is empty


getFirst

public DLCyclicList.DLNode<T> getFirst()

findNode

public DLCyclicList.DLNode<T> findNode(java.lang.Object obj)
Finds the element containing given object. Worst-case O(n)-time.


getEntry

public DLCyclicList.DLNode<T> getEntry()

setEntry

public void setEntry(DLCyclicList.DLNode<T> n)

pushBefore

public void pushBefore(T obj)
Adds the object before the entry of the list. Worst-case O(1)-time.


pushBefore

public void pushBefore(T obj,
                       DLCyclicList.DLNode<T> n)
Adds an object before the specified node in the list. Worst-case O(1)-time.


pushAfter

public void pushAfter(T obj,
                      DLCyclicList.DLNode<T> n)
Adds an object after the specified node in the list. Worst-case O(1)-time.


delete

public T delete(DLCyclicList.DLNode<T> nd)
Deletes a node from the list and returns its object. Worst-case O(1)-time.


getSize

public int getSize()
Returns the number of elements in this cyclic list.


iterator

public java.util.Iterator<T> iterator()
Specified by:
iterator in interface java.lang.Iterable<T>

main

public static void main(java.lang.String[] args)