Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.codehaus.activemq.service.impl
Class DefaultQueueList

    java.lang.Object
      org.codehaus.activemq.service.impl.DefaultQueueList

All Implemented Interfaces:
  java.lang.Cloneable, QueueList, java.io.Serializable

public final class DefaultQueueList
extends java.lang.Object
implements QueueList, java.lang.Cloneable, java.io.Serializable

Linked list class to provide uniformly named methods to `get`,`remove` and `insert` an element at the beginning and end of the list. These operations allow linked lists to be used as a stack, queue, or double-ended queue (deque).

Version:
  $Revision: 1.1 $
See Also:
  Serialized Form

Field Summary

Fields inherited from interface org.codehaus.activemq.service.QueueList
`EMPTY_ARRAY`

Constructor Summary
`DefaultQueueList()` Constructs an empty list.

Method Summary
`void` | `add(int index, java.lang.Object element)` Inserts the specified element at the specified position in this list.
`QueueListEntry` | `add(java.lang.Object o)` Appends the specified element to the end of this list.
`QueueListEntry` | `addBefore(java.lang.Object o, QueueListEntry node)` Insert an Entry before this entry
`QueueListEntry` | `addFirst(java.lang.Object o)` Inserts the given element at the beginning of this list.
`QueueListEntry` | `addLast(java.lang.Object o)` Appends the given element to the end of this list.
`void` | `clear()` Removes all of the elements from this list.
`java.lang.Object` | `clone()` Returns a shallow copy of this `DefaultQueueList`.
`boolean` | `contains(java.lang.Object o)` Returns `true` if this list contains the specified element.
`DefaultQueueListEntry` | `entry(int index)`
`java.lang.Object` | `get(int index)` Returns the element at the specified position in this list.
`java.lang.Object` | `getFirst()` Returns the first element in this list.
`QueueListEntry` | `getFirstEntry()` Retrieve the first entry for the linked list
`java.lang.Object` | `getLast()` Returns the last element in this list.
`QueueListEntry` | `getLastEntry()` Retrieve the last entry for the linked list
`QueueListEntry` | `getNextEntry(QueueListEntry node)` Retrieve the next entry after this entry
`QueueListEntry` | `getPrevEntry(QueueListEntry node)` Retrive the previous entry after this entry
`int` | `indexOf(java.lang.Object o)` Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element.
`boolean` | `isEmpty()` is the list empty?
`int` | `lastIndexOf(java.lang.Object o)` Returns the index in this list of the last occurrence of the specified element, or -1 if the list does not contain this element.
`java.lang.Object` | `remove(int index)` Removes the element at the specified position in this list.
`boolean` | `remove(java.lang.Object o)` Removes the first occurrence of the specified element in this list.
`void` | `remove(QueueListEntry node)` Remove a DefaultQueueListEntry
`java.lang.Object` | `removeFirst()` remove the first object from the list
`java.lang.Object` | `removeLast()` remove the last object
`void` | `rotate()` move the first object to the back of the list
`java.lang.Object` | `set(int index, java.lang.Object element)` Replaces the element at the specified position in this list with the specified element.
`int` | `size()` Returns the number of elements in this list.
`java.lang.Object[]` | `toArray()` Returns an array containing all of the elements in this list in the correct order.

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DefaultQueueList

    public DefaultQueueList()

  Constructs an empty list.

Method Detail

### getFirst

    public java.lang.Object getFirst()

  Description copied from interface: `QueueList`
  Returns the first element in this list.

  Specified by:
    `getFirst` in interface `QueueList`
  Returns:
    the first object from the list or null

### getLast

    public java.lang.Object getLast()

  Description copied from interface: `QueueList`
  Returns the last element in this list.

  Specified by:
    `getLast` in interface `QueueList`
  Returns:
    the last object from the list

### removeFirst

    public java.lang.Object removeFirst()

  remove the first object from the list

  Specified by:
    `removeFirst` in interface `QueueList`
  Returns:
    the first element from this list.

### rotate

    public void rotate()

  move the first object to the back of the list

  Specified by:
    `rotate` in interface `QueueList`

### removeLast

    public java.lang.Object removeLast()

  remove the last object

  Specified by:
    `removeLast` in interface `QueueList`
  Returns:
    the last element from this list.

### addFirst

    public QueueListEntry addFirst(java.lang.Object o)

  Description copied from interface: `QueueList`
  Inserts the given element at the beginning of this list.

  Specified by:
    `addFirst` in interface `QueueList`
  Parameters:
    `o` - the element to be inserted at the beginning of this list.
  Returns:
    the DefaultQueueListEntry

### addLast

    public QueueListEntry addLast(java.lang.Object o)

  Description copied from interface: `QueueList`
  Appends the given element to the end of this list. (Identical in function to the `add` method; included only for consistency.)

  Specified by:
    `addLast` in interface `QueueList`
  Parameters:
    `o` - the element to be inserted at the end of this list.
  Returns:
    the DefaultQueueListEntry

### contains

    public boolean contains(java.lang.Object o)

  Description copied from interface: `QueueList`
  Returns `true` if this list contains the specified element. More formally, returns `true` if and only if this list contains at least one element `e` such that `(o==null ? e==null : o.equals(e))`.

  Specified by:
    `contains` in interface `QueueList`
  Parameters:
    `o` - element whose presence in this list is to be tested.
  Returns:
    `true` if this list contains the specified element.

### size

    public int size()

  Description copied from interface: `QueueList`
  Returns the number of elements in this list.

  Specified by:
    `size` in interface `QueueList`
  Returns:
    the number of elements in this list.

### isEmpty

    public boolean isEmpty()

  Description copied from interface: `QueueList`
  is the list empty?

  Specified by:
    `isEmpty` in interface `QueueList`
  Returns:
    true if there are no elements in the list

### add

    public QueueListEntry add(java.lang.Object o)

  Description copied from interface: `QueueList`
  Appends the specified element to the end of this list.

  Specified by:
    `add` in interface `QueueList`
  Parameters:
    `o` - element to be appended to this list.
  Returns:
    the DefaultQueueListEntry

### remove

    public boolean remove(java.lang.Object o)

  Description copied from interface: `QueueList`
  Removes the first occurrence of the specified element in this list. If the list does not contain the element, it is unchanged. More formally, removes the element with the lowest index `i` such that `(o==null ? get(i)==null : o.equals(get(i)))` (if such an element exists).

  Specified by:
    `remove` in interface `QueueList`
  Parameters:
    `o` - element to be removed from this list, if present.
  Returns:
    `true` if the list contained the specified element.

### clear

    public void clear()

  Description copied from interface: `QueueList`
  Removes all of the elements from this list.

  Specified by:
    `clear` in interface `QueueList`

### get

    public java.lang.Object get(int index)

  Description copied from interface: `QueueList`
  Returns the element at the specified position in this list.

  Specified by:
    `get` in interface `QueueList`
  Parameters:
    `index` - index of element to return.
  Returns:
    the element at the specified position in this list.

### set

    public java.lang.Object set(int index,
                                java.lang.Object element)

  Description copied from interface: `QueueList`
  Replaces the element at the specified position in this list with the specified element.

  Specified by:
    `set` in interface `QueueList`
  Parameters:
    `index` - index of element to replace.
    `element` - element to be stored at the specified position.
  Returns:
    the element previously at the specified position.

### add

    public void add(int index,
                    java.lang.Object element)

  Description copied from interface: `QueueList`
  Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

  Specified by:
    `add` in interface `QueueList`
  Parameters:
    `index` - index at which the specified element is to be inserted.
    `element` - element to be inserted.

### remove

    public java.lang.Object remove(int index)

  Description copied from interface: `QueueList`
  Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.

  Specified by:
    `remove` in interface `QueueList`
  Parameters:
    `index` - the index of the element to removed.
  Returns:
    the element previously at the specified position.

### entry

    public DefaultQueueListEntry entry(int index)

### indexOf

    public int indexOf(java.lang.Object o)

  Description copied from interface: `QueueList`
  Returns the index in this list of the first occurrence of the specified element, or -1 if the List does not contain this element. More formally, returns the lowest index i such that `(o==null ? get(i)==null : o.equals(get(i)))`, or -1 if there is no such index.

  Specified by:
    `indexOf` in interface `QueueList`
  Parameters:
    `o` - element to search for.
  Returns:
    the index in this list of the first occurrence of the specified element, or -1 if the list does not contain this element.

### lastIndexOf

    public int lastIndexOf(java.lang.Object o)

  Description copied from interface: `QueueList`
  Returns the index in this list of the last occurrence of the specified element, or -1 if the list does not contain this element. More formally, returns the highest index i such that `(o==null ? get(i)==null : o.equals(get(i)))`, or -1 if there is no such index.

  Specified by:
    `lastIndexOf` in interface `QueueList`
  Parameters:
    `o` - element to search for.
  Returns:
    the index in this list of the last occurrence of the specified element, or -1 if the list does not contain this element.

### getFirstEntry

    public QueueListEntry getFirstEntry()

  Description copied from interface: `QueueList`
  Retrieve the first entry for the linked list

  Specified by:
    `getFirstEntry` in interface `QueueList`
  Returns:
    first entry or null

### getLastEntry

    public QueueListEntry getLastEntry()

  Description copied from interface: `QueueList`
  Retrieve the last entry for the linked list

  Specified by:
    `getLastEntry` in interface `QueueList`
  Returns:
    last entry or null

### getNextEntry

    public QueueListEntry getNextEntry(QueueListEntry node)

  Description copied from interface: `QueueList`
  Retrieve the next entry after this entry

  Specified by:
    `getNextEntry` in interface `QueueList`
  Parameters:
    `node` -
  Returns:

### getPrevEntry

    public QueueListEntry getPrevEntry(QueueListEntry node)

  Description copied from interface: `QueueList`
  Retrive the previous entry after this entry

  Specified by:
    `getPrevEntry` in interface `QueueList`
  Parameters:
    `node` -
  Returns:

### addBefore

    public QueueListEntry addBefore(java.lang.Object o,
                                    QueueListEntry node)

  Description copied from interface: `QueueList`
  Insert an Entry before this entry

  Specified by:
    `addBefore` in interface `QueueList`
  Parameters:
    `o` - the elment to insert
    `node` - the Entry to insert the object before
  Returns:

### remove

    public void remove(QueueListEntry node)

  Description copied from interface: `QueueList`
  Remove a DefaultQueueListEntry

  Specified by:
    `remove` in interface `QueueList`
  Parameters:
    `node` - the DefaultQueueListEntry

### clone

    public java.lang.Object clone()

  Returns a shallow copy of this `DefaultQueueList`. (The elements themselves are not cloned.)

  Returns:
    a shallow copy of this `DefaultQueueList` instance.

### toArray

    public java.lang.Object[] toArray()

  Description copied from interface: `QueueList`
  Returns an array containing all of the elements in this list in the correct order.

  Specified by:
    `toArray` in interface `QueueList`
  Returns:
    an array containing all of the elements in this list in the correct order.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2004 Protique, Ltd.. All Rights Reserved.