activemq-cpp-3.6.0
decaf::util::Deque< E > Class Template Reference

Defines a 'Double ended Queue' interface that allows for insertion and removal of elements from both ends. More...

#include <src/main/decaf/util/Deque.h>

Inheritance diagram for decaf::util::Deque< E >:

Public Member Functions

virtual ~Deque ()
virtual void addFirst (const E &element)=0
 Inserts an element onto the front of the Deque if possible without violating the implementations capacity restrictions.
virtual void addLast (const E &element)=0
 Inserts an element onto the end of the Deque if possible without violating the implementations capacity restrictions.
virtual bool offerFirst (const E &element)=0
 This method attempts to insert the given element into the Deque at the front end.
virtual bool offerLast (const E &element)=0
 This method attempts to insert the given element into the Deque at the end.
virtual E removeFirst ()=0
 Removes the topmost element from the Deque and returns it.
virtual E removeLast ()=0
 Removes the last element from the Deque and returns it.
virtual bool pollFirst (E &element)=0
 Removes the first element from the Deque assigns it to the element reference passed.
virtual bool pollLast (E &element)=0
 Removes the last element from the Deque assigns it to the element reference passed.
virtual E & getFirst ()=0
 Attempts to fetch a reference to the first element in the Deque.
virtual const E & getFirst () const =0
virtual E & getLast ()=0
 Attempts to fetch a reference to the last element in the Deque.
virtual const E & getLast () const =0
virtual bool peekFirst (E &value) const =0
 Retrieves the first element contained in this Deque and assigns its value to the reference value passed the value however is not removed from the Deque.
virtual bool peekLast (E &value) const =0
 Retrieves the last element contained in this Deque and assigns its value to the reference value passed the value however is not removed from the Deque.
virtual bool removeFirstOccurrence (const E &value)=0
 Removes the first occurrence of the specified element from this Deque.
virtual bool removeLastOccurrence (const E &value)=0
 Removes the last occurrence of the specified element from this Deque.
virtual void push (const E &element)=0
 Pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it is possible to do so immediately without violating capacity restrictions, otherwise it throwing an IllegalStateException if no space is currently available.
virtual E pop ()=0
 Treats this Deque as a stack and attempts to pop an element off the top.
virtual Iterator< E > * descendingIterator ()=0
 Provides an Iterator over this Collection that traverses the element in reverse order.
virtual Iterator< E > * descendingIterator () const =0
- Public Member Functions inherited from decaf::util::Queue< E >
virtual ~Queue ()
virtual bool offer (const E &value)=0
 Inserts the specified element into the queue provided that the condition allows such an operation.
virtual bool poll (E &result)=0
 Gets and removes the element in the head of the queue.
virtual E remove ()=0
 Gets and removes the element in the head of the queue.
virtual bool peek (E &result) const =0
 Gets but not removes the element in the head of the queue.
virtual E element () const =0
 Gets but not removes the element in the head of the queue.
- Public Member Functions inherited from decaf::util::Collection< E >
virtual ~Collection ()
virtual void copy (const Collection< E > &collection)=0
 Renders this Collection as a Copy of the given Collection.
virtual bool add (const E &value)=0
 Returns true if this collection changed as a result of the call.
virtual bool addAll (const Collection< E > &collection)=0
 Adds all of the elements in the specified collection to this collection.
virtual void clear ()=0
 Removes all of the elements from this collection (optional operation).
virtual bool contains (const E &value) const =0
 Returns true if this collection contains the specified element.
virtual bool containsAll (const Collection< E > &collection) const =0
 Returns true if this collection contains all of the elements in the specified collection.
virtual bool equals (const Collection< E > &value) const =0
 Compares the passed collection to this one, if they contain the same elements, i.e.
virtual bool isEmpty () const =0
virtual bool remove (const E &value)=0
 Removes a single instance of the specified element from the collection.
virtual bool removeAll (const Collection< E > &collection)=0
 Removes all this collection's elements that are also contained in the specified collection (optional operation).
virtual bool retainAll (const Collection< E > &collection)=0
 Retains only the elements in this collection that are contained in the specified collection (optional operation).
virtual int size () const =0
 Returns the number of elements in this collection.
virtual std::vector< E > toArray () const =0
 Returns an array containing all of the elements in this collection.
- Public Member Functions inherited from decaf::lang::Iterable< E >
virtual ~Iterable ()
virtual decaf::util::Iterator
< E > * 
iterator ()=0
virtual decaf::util::Iterator
< E > * 
iterator () const =0
- Public Member Functions inherited from decaf::util::concurrent::Synchronizable
virtual ~Synchronizable ()
virtual void lock ()=0
 Locks the object.
virtual bool tryLock ()=0
 Attempts to Lock the object, if the lock is already held by another thread than this method returns false.
virtual void unlock ()=0
 Unlocks the object.
virtual void wait ()=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs)=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void wait (long long millisecs, int nanos)=0
 Waits on a signal from this object, which is generated by a call to Notify.
virtual void notify ()=0
 Signals a waiter on this object that it can now wake up and continue.
virtual void notifyAll ()=0
 Signals the waiters on this object that it can now wake up and continue.

Detailed Description

template<typename E>
class decaf::util::Deque< E >

Defines a 'Double ended Queue' interface that allows for insertion and removal of elements from both ends.

Generally there is no limit on the number of elements that can be placed into a Deque.

Unlike a List the Deque doesn't provide index element based access, however methods are provided to grant access to interior elements.

Since
1.0

Constructor & Destructor Documentation

template<typename E>
virtual decaf::util::Deque< E >::~Deque ( )
inlinevirtual

Member Function Documentation

template<typename E>
virtual void decaf::util::Deque< E >::addFirst ( const E &  element)
pure virtual

Inserts an element onto the front of the Deque if possible without violating the implementations capacity restrictions.

For a capacity restricted Deque it is preferable to call offerFirst instead.

Parameters
elementThe element to be placed at the front of the Deque.
Exceptions
IllegalStateExceptionif the element cannot be added at this time due to capacity restrictions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentExceptionif some property of the specified element prevents it from being added to this deque.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual void decaf::util::Deque< E >::addLast ( const E &  element)
pure virtual

Inserts an element onto the end of the Deque if possible without violating the implementations capacity restrictions.

For a capacity restricted Deque it is preferable to call offerLast instead.

Parameters
elementThe element to be placed at the end of the Deque.
Exceptions
IllegalStateExceptionif the element cannot be added at this time due to capacity restrictions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentExceptionif some property of the specified element prevents it from being added to this deque.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual bool decaf::util::Deque< E >::offerFirst ( const E &  element)
pure virtual

This method attempts to insert the given element into the Deque at the front end.

Unlike the addFirst method that throws an exception if it cannot insert the element due to capacity restrictions etc this method returns false if it cannot insert the element.

Parameters
elementThe element to add to this Deque.
Returns
true if the element was added, false otherwise.
Exceptions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentExceptionif some property of the specified element prevents it from being added to this deque.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual bool decaf::util::Deque< E >::offerLast ( const E &  element)
pure virtual

This method attempts to insert the given element into the Deque at the end.

Unlike the addLast method that throws an exception if it cannot insert the element due to capacity restrictions etc this method returns false if it cannot insert the element.

Parameters
elementThe element to add to this Deque.
Returns
true if the element was added, false otherwise.
Exceptions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentExceptionif some property of the specified element prevents it from being added to this deque.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual bool decaf::util::Deque< E >::peekFirst ( E &  value) const
pure virtual

Retrieves the first element contained in this Deque and assigns its value to the reference value passed the value however is not removed from the Deque.

If this call is successful it returns true. Unlike getFirst this method does not throw an exception if the Deque is empty.

Returns
true if an element was assigned to the reference passed, false otherwise.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual bool decaf::util::Deque< E >::peekLast ( E &  value) const
pure virtual
template<typename E>
virtual E decaf::util::Deque< E >::pop ( )
pure virtual

Treats this Deque as a stack and attempts to pop an element off the top.

If there's no element to pop then a NuSuchElementException is thrown, otherwise the top element is removed and assigned to the reference passed.

This operation performs the same basic function as the removeFirst method.

Returns
the element at the front of this deque which would be the top of a stack.
Exceptions
NoSuchElementExceptionif there is nothing on the top of the stack.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual void decaf::util::Deque< E >::push ( const E &  element)
pure virtual

Pushes an element onto the stack represented by this deque (in other words, at the head of this deque) if it is possible to do so immediately without violating capacity restrictions, otherwise it throwing an IllegalStateException if no space is currently available.

This method performs the same basic operation as the addFirst method.

Parameters
elementThe element to be pushed onto the Deque.
Exceptions
IllegalStateExceptionif the element cannot be added at this time due to capacity restrictions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentExceptionif some property of the specified element prevents it from being added to this deque.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual bool decaf::util::Deque< E >::removeFirstOccurrence ( const E &  value)
pure virtual

Removes the first occurrence of the specified element from this Deque.

If there is no matching element then the Deque is left unchanged.

Parameters
valueThe value to be removed from this Deque.
Returns
true if the Deque was modified as a result of this operation.
Exceptions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.

template<typename E>
virtual bool decaf::util::Deque< E >::removeLastOccurrence ( const E &  value)
pure virtual

Removes the last occurrence of the specified element from this Deque.

If there is no matching element then the Deque is left unchanged.

Parameters
valueThe value to be removed from this Deque.
Returns
true if the Deque was modified as a result of this operation.
Exceptions
NullPointerExceptionif the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.

Implemented in decaf::util::LinkedList< E >, decaf::util::LinkedList< cms::MessageConsumer * >, decaf::util::LinkedList< CompositeTask * >, decaf::util::LinkedList< URI >, decaf::util::LinkedList< Pointer< MessageDispatch > >, decaf::util::LinkedList< Pointer< DestinationInfo > >, decaf::util::LinkedList< PrimitiveValueNode >, decaf::util::LinkedList< decaf::net::URI >, decaf::util::LinkedList< Pointer< Command > >, decaf::util::LinkedList< cms::MessageProducer * >, decaf::util::LinkedList< cms::Destination * >, decaf::util::LinkedList< cms::Session * >, and decaf::util::LinkedList< cms::Connection * >.


The documentation for this class was generated from the following file: