Proton DotNet
Loading...
Searching...
No Matches
Classes | Public Member Functions | Public Attributes | Static Public Attributes | Properties | List of all members
Apache.Qpid.Proton.Utilities.ArrayDeque< T > Class Template Referencesealed

A resizable-array implementation of the IDeque interface which has no capacity restrictions. The backing array will grow as necessary to support usage. This collection is not thread-safe. Null elements are prohibited in this collection. More...

Inheritance diagram for Apache.Qpid.Proton.Utilities.ArrayDeque< T >:
Apache.Qpid.Proton.Utilities.IDeque< T >

Public Member Functions

 ArrayDeque (uint size=DefaultInitialSize)
 
 ArrayDeque (IEnumerable< T > elements)
 
bool TryEnqueue (T value)
 Attempts to insert the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception.
 
void Enqueue (T value)
 Inserts the given value onto the back of this queue unless the queue has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueue method and check the return value to determine if the operation succeeded.
 
bool TryDequeue (out T front)
 Attempt to remove and return the element at the front of the queue if there is any element to return otherwise the method returns false.
 
Dequeue ()
 Removes and returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryDequeue method and check the return value to see if the operation succeeded.
 
bool TryEnqueueFront (T item)
 Attempts to insert the given value onto the front of this queue unless the queue has reached its capacity limit in which case this method would throw an exception.
 
void EnqueueFront (T item)
 Inserts the given value onto the front of this queue unless the queue has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueueFront method and check the return value to determine if the operation succeeded.
 
bool TryEnqueueBack (T item)
 Attempts to insert the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception.
 
void EnqueueBack (T item)
 Inserts the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueueBack method and check the return value to determine if the operation succeeded.
 
bool TryDequeueFront (out T result)
 Attempt to remove and return the element at the front of the queue if there is any element to return otherwise the method returns false.
 
DequeueFront ()
 Removes and returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryDequeueFront method and check the return value to see if the operation succeeded.
 
bool TryDequeueBack (out T result)
 Attempt to remove and return the element at the back of the queue if there is any element to return otherwise the method returns false.
 
DequeueBack ()
 Removes and returns the element at the back of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryDequeue method and check the return value to see if the operation succeeded.
 
Peek ()
 Returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryPeek method and check the return value to see if the operation succeeded.
 
bool TryPeek (out T front)
 Attempt to read and return the element at the front of the queue if there is any element to return otherwise the method returns false.
 
PeekFront ()
 Returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryPeek method and check the return value to see if the operation succeeded.
 
bool TryPeekFront (out T front)
 Attempt to read and return the element at the front of the queue if there is any element to return otherwise the method returns false.
 
PeekBack ()
 Returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryPeek method and check the return value to see if the operation succeeded.
 
bool TryPeekBack (out T back)
 Attempt to read and return the element at the front of the queue if there is any element to return otherwise the method returns false.
 
void Clear ()
 
bool Contains (T item)
 
void CopyTo (T[] array, int index)
 
void CopyTo (Array array, int index)
 
bool Remove (T item)
 
IEnumerator< T > GetEnumerator ()
 
override bool Equals (object other)
 
bool Equals (IEnumerable< T > other)
 
override int GetHashCode ()
 
- Public Member Functions inherited from Apache.Qpid.Proton.Utilities.IDeque< T >
void ICollection< T >. Add (T item)
 Inserts the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueueBack method and check the return value to determine if the operation succeeded.
 

Public Attributes

readonly object sync = new()
 

Static Public Attributes

const int DefaultInitialSize = 16
 
const int AtLeastOne = 1
 

Properties

bool IsEmpty [get]
 Returns true if the double ended queue is currently empty. This method provides an optimized means of checking for empty in this collection type where otherwise the count property might be used which could require a calculation on each call to determine the current element count.
 
int Count [get]
 Returns the current number of elements contained in the double ended Queue.
 
bool IsReadOnly [get]
 
bool IsSynchronized [get]
 
object SyncRoot [get]
 
- Properties inherited from Apache.Qpid.Proton.Utilities.IDeque< T >

Detailed Description

A resizable-array implementation of the IDeque interface which has no capacity restrictions. The backing array will grow as necessary to support usage. This collection is not thread-safe. Null elements are prohibited in this collection.

0 1 2 3 4 5 6 7 8 9

| | | | | | | | | | | Empty head = tail = 0

H T

0 1 2 3 4 5 6 7 8 9

|x|x|x|x|x| | | | | | Size 5; Head = 0, tail = 5

H T

0 1 2 3 4 5 6 7 8 9

|x|x|x| | | | | |x|x| Size 5; Head = 8, tail = 3

T H

Following capacity increase when head > tail (or head == tail because of insert when one slot left)

0 1 2 3 4 5 6 7 8 9

|x|x|x| | | | | |x|x| | Size 5; Head = 8, tail = 3

T H

Template Parameters
TThe type that is stored in this double ended queue implementation

Member Function Documentation

◆ Dequeue()

T Apache.Qpid.Proton.Utilities.ArrayDeque< T >.Dequeue ( )
inline

Removes and returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryDequeue method and check the return value to see if the operation succeeded.

Returns
The element at the front of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently empty

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ DequeueBack()

T Apache.Qpid.Proton.Utilities.ArrayDeque< T >.DequeueBack ( )
inline

Removes and returns the element at the back of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryDequeue method and check the return value to see if the operation succeeded.

Returns
The element at the back of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently empty

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ DequeueFront()

T Apache.Qpid.Proton.Utilities.ArrayDeque< T >.DequeueFront ( )
inline

Removes and returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryDequeueFront method and check the return value to see if the operation succeeded.

Returns
The element at the front of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently empty

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ Enqueue()

void Apache.Qpid.Proton.Utilities.ArrayDeque< T >.Enqueue ( value)
inline

Inserts the given value onto the back of this queue unless the queue has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueue method and check the return value to determine if the operation succeeded.

Parameters
valueThe value to add to the tail of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently at max capacity

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ EnqueueBack()

void Apache.Qpid.Proton.Utilities.ArrayDeque< T >.EnqueueBack ( value)
inline

Inserts the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueueBack method and check the return value to determine if the operation succeeded.

Parameters
valueThe value to add to the back of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently at max capacity

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ EnqueueFront()

void Apache.Qpid.Proton.Utilities.ArrayDeque< T >.EnqueueFront ( value)
inline

Inserts the given value onto the front of this queue unless the queue has reached its capacity limit in which case this method would throw an exception. Generally it is preferable to call the TryEnqueueFront method and check the return value to determine if the operation succeeded.

Parameters
valueThe value to add to the front of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently at max capacity

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ Peek()

Returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryPeek method and check the return value to see if the operation succeeded.

Returns
The element at the front of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently empty

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ PeekBack()

T Apache.Qpid.Proton.Utilities.ArrayDeque< T >.PeekBack ( )
inline

Returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryPeek method and check the return value to see if the operation succeeded.

Returns
The element at the front of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently empty

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ PeekFront()

T Apache.Qpid.Proton.Utilities.ArrayDeque< T >.PeekFront ( )
inline

Returns the element at the front of the queue if the queue is currently not empty, otherwise this method throws an exception to indicate that there is no value in the queue currently. Generally it is preferable to call the TryPeek method and check the return value to see if the operation succeeded.

Returns
The element at the front of the queue
Exceptions
InvalidOperationExceptionIf the queue is currently empty

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryDequeue()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryDequeue ( out T  front)
inline

Attempt to remove and return the element at the front of the queue if there is any element to return otherwise the method returns false.

Parameters
frontA reference to store the value at the front of the queue
Returns
True if a value was removed from the queue and returned.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryDequeueBack()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryDequeueBack ( out T  back)
inline

Attempt to remove and return the element at the back of the queue if there is any element to return otherwise the method returns false.

Parameters
backA reference to store the value at the back of the queue
Returns
True if a value was removed from the queue and returned.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryDequeueFront()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryDequeueFront ( out T  front)
inline

Attempt to remove and return the element at the front of the queue if there is any element to return otherwise the method returns false.

Parameters
frontA reference to store the value at the front of the queue
Returns
True if a value was removed from the queue and returned.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryEnqueue()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryEnqueue ( value)
inline

Attempts to insert the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception.

Parameters
valueThe value to add to the front of the queue
Returns
True if the value was added to the deque

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryEnqueueBack()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryEnqueueBack ( value)
inline

Attempts to insert the given value onto the back of this queue unless the deque has reached its capacity limit in which case this method would throw an exception.

Parameters
valueThe value to add to the front of the queue
Returns
True if the value was added to the deque

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryEnqueueFront()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryEnqueueFront ( value)
inline

Attempts to insert the given value onto the front of this queue unless the queue has reached its capacity limit in which case this method would throw an exception.

Parameters
valueThe value to add to the front of the queue
Returns
True if the value was added to the deque

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryPeek()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryPeek ( out T  front)
inline

Attempt to read and return the element at the front of the queue if there is any element to return otherwise the method returns false.

Parameters
frontA reference to store the value at the front of the queue
Returns
True if a value was read from the queue and returned.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryPeekBack()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryPeekBack ( out T  front)
inline

Attempt to read and return the element at the front of the queue if there is any element to return otherwise the method returns false.

Parameters
frontA reference to store the value at the front of the queue
Returns
True if a value was read from the queue and returned.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ TryPeekFront()

bool Apache.Qpid.Proton.Utilities.ArrayDeque< T >.TryPeekFront ( out T  front)
inline

Attempt to read and return the element at the front of the queue if there is any element to return otherwise the method returns false.

Parameters
frontA reference to store the value at the front of the queue
Returns
True if a value was read from the queue and returned.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

Property Documentation

◆ Count

Returns the current number of elements contained in the double ended Queue.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.

◆ IsEmpty

Returns true if the double ended queue is currently empty. This method provides an optimized means of checking for empty in this collection type where otherwise the count property might be used which could require a calculation on each call to determine the current element count.

Implements Apache.Qpid.Proton.Utilities.IDeque< T >.


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