Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.activemq.service.impl
Class DefaultQueueList  view DefaultQueueList download DefaultQueueList.java

java.lang.Object
  extended byorg.activemq.service.impl.DefaultQueueList
All Implemented Interfaces:
java.lang.Cloneable, org.activemq.service.QueueList, java.io.Serializable

public final class DefaultQueueList
extends java.lang.Object
implements org.activemq.service.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 (dequeue).

Version:
$Revision: 1.1.1.1 $

Field Summary
private  DefaultQueueListEntry header
           
private static long serialVersionUID
           
private  int size
           
 
Fields inherited from interface org.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.
 org.activemq.service.QueueListEntry add(java.lang.Object o)
          Appends the specified element to the end of this list.
 org.activemq.service.QueueListEntry addAllBefore(java.util.Collection c, org.activemq.service.QueueListEntry node)
           
 org.activemq.service.QueueListEntry addAllFirst(java.util.Collection c)
           
 org.activemq.service.QueueListEntry addBefore(java.lang.Object o, org.activemq.service.QueueListEntry node)
          Insert an Entry before this entry
 org.activemq.service.QueueListEntry addFirst(java.lang.Object o)
          Inserts the given element at the beginning of this list.
 org.activemq.service.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 get(java.lang.Object obj)
          get the object from the queue
 java.lang.Object getFirst()
          Returns the first element in this list.
 org.activemq.service.QueueListEntry getFirstEntry()
          Retrieve the first entry for the linked list
 java.lang.Object getLast()
          Returns the last element in this list.
 org.activemq.service.QueueListEntry getLastEntry()
          Retrieve the last entry for the linked list
 org.activemq.service.QueueListEntry getNextEntry(org.activemq.service.QueueListEntry node)
          Retrieve the next entry after this entry
 org.activemq.service.QueueListEntry getPrevEntry(org.activemq.service.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(org.activemq.service.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.
 java.lang.String toString()
          Convert this Object to a human-readable String.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

header

private transient DefaultQueueListEntry header

size

private transient int size
Constructor Detail

DefaultQueueList

public DefaultQueueList()
Constructs an empty list.

Method Detail

getFirst

public java.lang.Object getFirst()
Description copied from interface: org.activemq.service.QueueList
Returns the first element in this list.

Specified by:
getFirst in interface org.activemq.service.QueueList

getLast

public java.lang.Object getLast()
Description copied from interface: org.activemq.service.QueueList
Returns the last element in this list.

Specified by:
getLast in interface org.activemq.service.QueueList

removeFirst

public java.lang.Object removeFirst()
remove the first object from the list

Specified by:
removeFirst in interface org.activemq.service.QueueList

rotate

public void rotate()
move the first object to the back of the list

Specified by:
rotate in interface org.activemq.service.QueueList

removeLast

public java.lang.Object removeLast()
remove the last object

Specified by:
removeLast in interface org.activemq.service.QueueList

addAllFirst

public org.activemq.service.QueueListEntry addAllFirst(java.util.Collection c)

addFirst

public org.activemq.service.QueueListEntry addFirst(java.lang.Object o)
Description copied from interface: org.activemq.service.QueueList
Inserts the given element at the beginning of this list.

Specified by:
addFirst in interface org.activemq.service.QueueList

addLast

public org.activemq.service.QueueListEntry addLast(java.lang.Object o)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

contains

public boolean contains(java.lang.Object o)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

size

public int size()
Description copied from interface: org.activemq.service.QueueList
Returns the number of elements in this list.

Specified by:
size in interface org.activemq.service.QueueList

isEmpty

public boolean isEmpty()
Description copied from interface: org.activemq.service.QueueList
is the list empty?

Specified by:
isEmpty in interface org.activemq.service.QueueList

add

public org.activemq.service.QueueListEntry add(java.lang.Object o)
Description copied from interface: org.activemq.service.QueueList
Appends the specified element to the end of this list.

Specified by:
add in interface org.activemq.service.QueueList

remove

public boolean remove(java.lang.Object o)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

clear

public void clear()
Description copied from interface: org.activemq.service.QueueList
Removes all of the elements from this list.

Specified by:
clear in interface org.activemq.service.QueueList

get

public java.lang.Object get(int index)
Description copied from interface: org.activemq.service.QueueList
Returns the element at the specified position in this list.

Specified by:
get in interface org.activemq.service.QueueList

get

public java.lang.Object get(java.lang.Object obj)
get the object from the queue


set

public java.lang.Object set(int index,
                            java.lang.Object element)
Description copied from interface: org.activemq.service.QueueList
Replaces the element at the specified position in this list with the specified element.

Specified by:
set in interface org.activemq.service.QueueList

add

public void add(int index,
                java.lang.Object element)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

remove

public java.lang.Object remove(int index)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

entry

public DefaultQueueListEntry entry(int index)

indexOf

public int indexOf(java.lang.Object o)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

lastIndexOf

public int lastIndexOf(java.lang.Object o)
Description copied from interface: org.activemq.service.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 org.activemq.service.QueueList

getFirstEntry

public org.activemq.service.QueueListEntry getFirstEntry()
Description copied from interface: org.activemq.service.QueueList
Retrieve the first entry for the linked list

Specified by:
getFirstEntry in interface org.activemq.service.QueueList

getLastEntry

public org.activemq.service.QueueListEntry getLastEntry()
Description copied from interface: org.activemq.service.QueueList
Retrieve the last entry for the linked list

Specified by:
getLastEntry in interface org.activemq.service.QueueList

getNextEntry

public org.activemq.service.QueueListEntry getNextEntry(org.activemq.service.QueueListEntry node)
Description copied from interface: org.activemq.service.QueueList
Retrieve the next entry after this entry

Specified by:
getNextEntry in interface org.activemq.service.QueueList

getPrevEntry

public org.activemq.service.QueueListEntry getPrevEntry(org.activemq.service.QueueListEntry node)
Description copied from interface: org.activemq.service.QueueList
Retrive the previous entry after this entry

Specified by:
getPrevEntry in interface org.activemq.service.QueueList

addBefore

public org.activemq.service.QueueListEntry addBefore(java.lang.Object o,
                                                     org.activemq.service.QueueListEntry node)
Description copied from interface: org.activemq.service.QueueList
Insert an Entry before this entry

Specified by:
addBefore in interface org.activemq.service.QueueList

addAllBefore

public org.activemq.service.QueueListEntry addAllBefore(java.util.Collection c,
                                                        org.activemq.service.QueueListEntry node)

remove

public void remove(org.activemq.service.QueueListEntry node)
Description copied from interface: org.activemq.service.QueueList
Remove a DefaultQueueListEntry

Specified by:
remove in interface org.activemq.service.QueueList

clone

public java.lang.Object clone()
Returns a shallow copy of this DefaultQueueList. (The elements themselves are not cloned.)


toArray

public java.lang.Object[] toArray()
Description copied from interface: org.activemq.service.QueueList
Returns an array containing all of the elements in this list in the correct order.

Specified by:
toArray in interface org.activemq.service.QueueList

toString

public java.lang.String toString()
Description copied from class: java.lang.Object
Convert this Object to a human-readable String. There are no limits placed on how long this String should be or what it should contain. We suggest you make it as intuitive as possible to be able to place it into System.out.println() 55 and such.

It is typical, but not required, to ensure that this method never completes abruptly with a java.lang.RuntimeException.

This method will be called when performing string concatenation with this object. If the result is null, string concatenation will instead use "null".

The default implementation returns getClass().getName() + "@" + Integer.toHexString(hashCode()).