Crystal AI  1.0.0
Crystal.IPriorityQueue< TItem, in in TPriority > Interface Template Reference

Priority queue interface. More...

Public Member Functions

TItem Peek ()
 Returns the item at the head of the queue without removing it. More...
 
void Enqueue (TItem item, TPriority priority)
 Enqueues an item to the list. Items with lower priority values are placed ahead of the queue. More...
 
TItem Dequeue ()
 Removes and returns the item at the head of the queue. In the event of a priority tie the item inserted first in the queue is returned. More...
 
bool Contains (TItem item)
 Returns true if the queue has 1 or more of the secified items. More...
 
TItem Remove (TItem item)
 RemoveBehaviour the specified item. Note that the queue may contain multiples of the same item, in which case this removes the one that is closest to the head. More...
 
TItem Remove (Func< TItem, bool > predicate)
 Removes the first item that matches the specified predicate. Note that the queue may contain multiples of the same item, in which case this removes the one that is closest to the head. More...
 
void UpdatePriority (TItem item, TPriority priority)
 Updates the priority of the specified item. If the item does not exist in the queue, it simply returns. More...
 
void Clear ()
 Removes every node from the queue. More...
 

Properties

bool HasNext [get]
 Returns true if there is an element at the head of the queue, i.e. if the queue is not empty. More...
 
int Count [get]
 Returns the number of items in the queue. More...
 

Detailed Description

Priority queue interface.

Type Constraints
TPriority :IComparable<TPriority> 

Member Function Documentation

void Crystal.IPriorityQueue< TItem, in in TPriority >.Clear ( )

Removes every node from the queue.

bool Crystal.IPriorityQueue< TItem, in in TPriority >.Contains ( TItem  item)

Returns true if the queue has 1 or more of the secified items.

TItem Crystal.IPriorityQueue< TItem, in in TPriority >.Dequeue ( )

Removes and returns the item at the head of the queue. In the event of a priority tie the item inserted first in the queue is returned.

void Crystal.IPriorityQueue< TItem, in in TPriority >.Enqueue ( TItem  item,
TPriority  priority 
)

Enqueues an item to the list. Items with lower priority values are placed ahead of the queue.

TItem Crystal.IPriorityQueue< TItem, in in TPriority >.Peek ( )

Returns the item at the head of the queue without removing it.

TItem Crystal.IPriorityQueue< TItem, in in TPriority >.Remove ( TItem  item)

RemoveBehaviour the specified item. Note that the queue may contain multiples of the same item, in which case this removes the one that is closest to the head.

Parameters
itemItem.
TItem Crystal.IPriorityQueue< TItem, in in TPriority >.Remove ( Func< TItem, bool >  predicate)

Removes the first item that matches the specified predicate. Note that the queue may contain multiples of the same item, in which case this removes the one that is closest to the head.

Parameters
predicateThe predicate.
Returns
The item that was removed or null if no item was not found.
void Crystal.IPriorityQueue< TItem, in in TPriority >.UpdatePriority ( TItem  item,
TPriority  priority 
)

Updates the priority of the specified item. If the item does not exist in the queue, it simply returns.

Property Documentation

int Crystal.IPriorityQueue< TItem, in in TPriority >.Count
get

Returns the number of items in the queue.

bool Crystal.IPriorityQueue< TItem, in in TPriority >.HasNext
get

Returns true if there is an element at the head of the queue, i.e. if the queue is not empty.


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