Cerberus X Documentation

Class Deque<T>

A deque is a 'double ended queue'. More...

Declarations

Extended By
FloatDeque , IntDeque , StringDeque
Please note that only documented classes are listed here, there might be undocumented classes that extend this one.
Properties
IsEmpty : Bool () Returns true if the deque is empty.
Length : Int () Returns the number of items in the deque.
Constructors
New () Creates a new empty deque.
New ( data:T[] ) Creates a new deque containing the elements of data.
Methods
Clear : Void () Removes all items from the deque.
Get : T ( index:Int ) Returns an item at the given index from the deque.
ObjectEnumerator : Object () Returns an object enumerator for use with For Eachin loops.
PopFirst : T () Removes an item from the beginning of the deque.
PopLast : T () Removes an item from the end of the deque.
PushFirst : Void ( value:T ) Adds an item to the beginning of the deque.
PushLast : Void ( value:T ) Adds an item to the end of the deque.
Set : Void ( index:Int, value:T ) Sets an item at the given index.
ToArray : T[] () Converts the deque to an array.

Detailed Discussion

A deque is a 'double ended queue'.

It is similar to a stack, only items can be pushed and popped to and from either end of the stack.

This means it can be used as either a FIFO or LIFO/FILO queue.


Properties Documentation

Method IsEmpty : Bool () Property

Returns true if the deque is empty.

Method Length : Int () Property

Returns the number of items in the deque.


Constructors Documentation

Method New ()

Creates a new empty deque.

Method New ( data:T[] )

Creates a new deque containing the elements of data.


Methods Documentation

Method Clear : Void ()

Removes all items from the deque.

Method Get : T ( index:Int )

Returns an item at the given index from the deque.

The first item in the deck is at index 0, the last is at index Length-1.

If the deque is empty, a runtime error occurs.

Method ObjectEnumerator : Object ()

Returns an object enumerator for use with For Eachin loops.

Method PopFirst : T ()

Removes an item from the beginning of the deque.

If the deque is empty, a runtime error occurs.

Method PopLast : T ()

Removes an item from the end of the deque.

If the deque is empty, a runtime error occurs.

Method PushFirst : Void ( value:T )

Adds an item to the beginning of the deque.

Method PushLast : Void ( value:T )

Adds an item to the end of the deque.

Method Set : Void ( index:Int, value:T )

Sets an item at the given index.

The first item in the deck is at index 0, the last is at index Length-1.

If the deque is empty, a runtime error occurs.

Method ToArray : T[] ()

Converts the deque to an array.