Lightweight Bartering Grid

lbg.common.queueing.deque
Class LinkedListDeque<T>

java.lang.Object
  extended by lbg.common.queueing.deque.LinkedListDeque<T>
All Implemented Interfaces:
Deque<T>

public class LinkedListDeque<T>
extends java.lang.Object
implements Deque<T>

Implements a Deque using a doubly linked list.

Original, unlicensed version written by Geoff Knagge (9806135), last modified 14/8/1999.

This version synthesized and heavily patched by Cyril Briquet, last modified 04/02/2007.

Note: the sole purpose of this class is to provide a J2SE 5.0 implementation of a Deque.

Author:
Cyril Briquet

Constructor Summary
LinkedListDeque()
           
 
Method Summary
 java.util.Iterator<T> descendingIterator()
           
 T firstElement()
          Returns the object to the head of the Deque.
 void insertFirst(T o)
          Inserts target Object at the head of the Deque.
 void insertLast(T o)
          Inserts target Object at the tail of the Deque.
 boolean isEmpty()
           
 java.util.Iterator<T> iterator()
           
 T lastElement()
          Returns the object to the tail of the Deque.
 T removeFirst()
          Returns the object to the head of the Deque, and removes that Object.
 T removeLast()
          Returns the object to the tail of the Deque, and removes that Object.
 int size()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LinkedListDeque

public LinkedListDeque()
Method Detail

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Deque<T>

size

public int size()
Specified by:
size in interface Deque<T>

insertFirst

public void insertFirst(T o)
                 throws GridException
Inserts target Object at the head of the Deque.

Specified by:
insertFirst in interface Deque<T>
Throws:
GridException

insertLast

public void insertLast(T o)
                throws GridException
Inserts target Object at the tail of the Deque.

Specified by:
insertLast in interface Deque<T>
Throws:
GridException

removeFirst

public T removeFirst()
              throws GridException
Returns the object to the head of the Deque, and removes that Object.

Specified by:
removeFirst in interface Deque<T>
Throws:
GridException

removeLast

public T removeLast()
             throws GridException
Returns the object to the tail of the Deque, and removes that Object.

Specified by:
removeLast in interface Deque<T>
Throws:
GridException

firstElement

public T firstElement()
               throws GridException
Returns the object to the head of the Deque.

Specified by:
firstElement in interface Deque<T>
Throws:
GridException

lastElement

public T lastElement()
              throws GridException
Returns the object to the tail of the Deque.

Specified by:
lastElement in interface Deque<T>
Throws:
GridException

iterator

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

descendingIterator

public java.util.Iterator<T> descendingIterator()
Specified by:
descendingIterator in interface Deque<T>

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.