Summer.Batch.Common.Collections.PriorityBlockingQueue< T > Class Template Reference

Priority Blocking Queue; inherits from AbstractPriorityQueue More...

Inheritance diagram for Summer.Batch.Common.Collections.PriorityBlockingQueue< T >:
Summer.Batch.Common.Collections.AbstractPriorityQueue< T > Summer.Batch.Common.Collections.IQueue< T >

Public Member Functions

 PriorityBlockingQueue (IComparer< T > comparer=null)
 Constructs a new priority queue with a default capacity and no elements. More...
 
 PriorityBlockingQueue (int capacity, IComparer< T > comparer=null)
 Constructs a new priority queue with the specified capacity and no elements. More...
 
 PriorityBlockingQueue (IEnumerable< T > enumerable, IComparer< T > comparer=null)
 Constructs a new priority queue and initializes it with the given elements. More...
 
override T Poll ()
 Removes the head of the queue and returns it. More...
 
Take ()
 Removes the head of the queue and returns it. If the queue is empty, waits until an element is added. More...
 
override T Peek ()
 Returns the head of the queue without removing it. More...
 
override void Add (T item)
 Adds an item to the queue. The item is added at the correct position according to the current order. More...
 
override void Clear ()
 Removes all elements from the queue. More...
 
override bool Contains (T item)
 Checks if an element is inside the queue. The comparison is done using the current order rather than object.Equals(object). More...
 
override void CopyTo (T[] array, int arrayIndex)
 Copies the elements of the queue to an array, preserving the order. More...
 
override bool Remove (T item)
 Removes an item from the queue. More...
 
- Public Member Functions inherited from Summer.Batch.Common.Collections.AbstractPriorityQueue< T >
IEnumerator< T > GetEnumerator ()
 

Properties

override int Count [get]
 The number of elements in the queue. More...
 
- Properties inherited from Summer.Batch.Common.Collections.AbstractPriorityQueue< T >
IComparer< T > Comparer [get, protected set]
 The comparer used to order the elements in the queue. Can be null if T implements IComparable<T>. More...
 
virtual int Count [get]
 The number of elements in the queue. More...
 
bool IsReadOnly [get]
 Always false More...
 
int Capacity [get, set]
 The internal capacity of the internal array. It is automatically expended when needed. Can be set if it can be estimated, thus avoiding multiple resize, or to reduce its size if the number of elements has been considerably reduced. More...
 

Additional Inherited Members

- Protected Member Functions inherited from Summer.Batch.Common.Collections.AbstractPriorityQueue< T >
 AbstractPriorityQueue (IComparer< T > comparer=null)
 Constructs a new priority queue with a default capacity and no elements. More...
 
 AbstractPriorityQueue (int capacity, IComparer< T > comparer=null)
 Constructs a new priority queue with the specified capacity and no elements. More...
 
 AbstractPriorityQueue (IEnumerable< T > enumerable, IComparer< T > comparer=null)
 Constructs a new priority queue and initializes it with the given elements. More...
 
DoPoll ()
 Removes the head and returns it. More...
 
void DoAdd (T item)
 Adds an item to the queue. More...
 
void DoClear ()
 Clears the queue. More...
 
bool DoRemove (T item)
 Removes an item from the queue. More...
 
bool DoContains (T item)
 Checks if an item is present in the queue. More...
 

Detailed Description

Priority Blocking Queue; inherits from AbstractPriorityQueue

Template Parameters
T The type of the elements in the queue.

Constructor & Destructor Documentation

Constructs a new priority queue with a default capacity and no elements.

Parameters
comparerthe comparer to use for ordering elements
Exceptions
InvalidOperationException  if T does not implement IComparable<T> and comparer is null.
Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.PriorityBlockingQueue ( int  capacity,
IComparer< T >  comparer = null 
)

Constructs a new priority queue with the specified capacity and no elements.

Parameters
capacitythe initial capacity
comparerthe comparer to use for ordering elements
Exceptions
InvalidOperationException  if T does not implement IComparable<T> and comparer is null.
Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.PriorityBlockingQueue ( IEnumerable< T >  enumerable,
IComparer< T >  comparer = null 
)

Constructs a new priority queue and initializes it with the given elements.

Parameters
enumerablean enumerable containing the initial elements
comparerthe comparer to use for ordering elements
Exceptions
InvalidOperationException  if T does not implement IComparable<T> and comparer is null.

Member Function Documentation

override void Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.Add ( item)
virtual

Adds an item to the queue. The item is added at the correct position according to the current order.

Parameters
itemthe item to add

Implements Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

override void Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.Clear ( )
virtual

Removes all elements from the queue.

Implements Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

override bool Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.Contains ( item)
virtual

Checks if an element is inside the queue. The comparison is done using the current order rather than object.Equals(object).

Parameters
itemthe item to check
Returns
true if there is an item with the same order as item ; false otherwise

Implements Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

override void Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.CopyTo ( T[]  array,
int  arrayIndex 
)
virtual

Copies the elements of the queue to an array, preserving the order.

Parameters
arraythe array to copy the elements to
arrayIndexthe index where to start copying
Exceptions
ArgumentOutOfRangeException  if the size of array is lower than arrayIndex + AbstractPriorityQueue<T>.Count.

Reimplemented from Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

Returns the head of the queue without removing it.

Returns
the head of the queue

Reimplemented from Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

Removes the head of the queue and returns it.

Returns
the head of the queue

Implements Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

override bool Summer.Batch.Common.Collections.PriorityBlockingQueue< T >.Remove ( item)
virtual

Removes an item from the queue.

Parameters
itemthe item to remove
Returns
true if the item was removed from the queue; false otherwise

Implements Summer.Batch.Common.Collections.AbstractPriorityQueue< T >.

Removes the head of the queue and returns it. If the queue is empty, waits until an element is added.

Returns

Property Documentation

The number of elements in the queue.


The documentation for this class was generated from the following file:
  • Summer.Batch.Common/Collections/PriorityBlockingQueue.cs