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 >:
Inheritance graph
[legend]

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

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 (  )  [inline, virtual]

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:
element The element to be placed at the front of the Deque.
Exceptions:
IllegalStateException if the element cannot be added at this time due to capacity restrictions
NullPointerException if the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentException if 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:
element The element to be placed at the end of the Deque.
Exceptions:
IllegalStateException if the element cannot be added at this time due to capacity restrictions
NullPointerException if the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentException if 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 Iterator<E>* decaf::util::Deque< E >::descendingIterator (  )  const [pure virtual]
template<typename E>
virtual Iterator<E>* decaf::util::Deque< E >::descendingIterator (  )  [pure virtual]
template<typename E>
virtual const E& decaf::util::Deque< E >::getFirst (  )  const [pure virtual]
template<typename E>
virtual E& decaf::util::Deque< E >::getFirst (  )  [pure virtual]
template<typename E>
virtual const E& decaf::util::Deque< E >::getLast (  )  const [pure virtual]
template<typename E>
virtual E& decaf::util::Deque< E >::getLast (  )  [pure virtual]
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:
element The element to add to this Deque.
Returns:
true if the element was added, false otherwise.
Exceptions:
NullPointerException if the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentException if 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:
element The element to add to this Deque.
Returns:
true if the element was added, false otherwise.
Exceptions:
NullPointerException if the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentException if 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 bool decaf::util::Deque< E >::pollFirst ( E &  element  )  [pure virtual]
template<typename E>
virtual bool decaf::util::Deque< E >::pollLast ( E &  element  )  [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:
NoSuchElementException if 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:
element The element to be pushed onto the Deque.
Exceptions:
IllegalStateException if the element cannot be added at this time due to capacity restrictions
NullPointerException if the specified element is NULL and this deque is a Collection of pointers and does not permit null elements.
IllegalArgumentException if 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 E decaf::util::Deque< E >::removeFirst (  )  [pure virtual]
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:
value The value to be removed from this Deque.
Returns:
true if the Deque was modified as a result of this operation.
Exceptions:
NullPointerException if 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 E decaf::util::Deque< E >::removeLast (  )  [pure virtual]
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:
value The value to be removed from this Deque.
Returns:
true if the Deque was modified as a result of this operation.
Exceptions:
NullPointerException if 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:

Generated on 1 Dec 2014 for activemq-cpp-3.8.2 by  doxygen 1.6.1