C# Class SharpNeat.Utility.KeyedCircularBuffer

A generic circular buffer of KeyValuePairs. The values are retrievable by their key. Old key-value pairs are overwritten when the circular buffer runs out of empty elements to place items into, as this happens the internal dictionary that maintains the lookup ability is also updated to reflect only the items in the circular buffer.
Inheritance: CircularBuffer
Show file Open project: flo-wolf/UnitySharpNEAT

Public Methods

Method Description
Clear ( ) : void

Clear the buffer.

ContainsKey ( key ) : bool

Determines whether the KeyedCircularBuffer contains the specified key.

Dequeue ( ) : V>.KeyValuePair

Remove the oldest item from the back end of the buffer and return it.

Enqueue ( key, value ) : void

Enqueue a new item. This overwrites the oldest item in the buffer if the buffer has reached capacity.

Enqueue ( KeyValuePair item ) : void

Enqueue a new item. This overwrites the oldest item in the buffer if the buffer has reached capacity.

KeyedCircularBuffer ( int capacity ) : System.Collections.Generic

Constructs a circular buffer with the specified capacity.

Pop ( ) : V>.KeyValuePair

Pop the most recently added item from the front end of the buffer and return it.

TryGetValue ( key, &value ) : bool

Gets the value associated with the specified key.

this ( key ) : V

Gets the value associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException.

Method Details

Clear() public method

Clear the buffer.
public Clear ( ) : void
return void

ContainsKey() public method

Determines whether the KeyedCircularBuffer contains the specified key.
public ContainsKey ( key ) : bool
return bool

Dequeue() public method

Remove the oldest item from the back end of the buffer and return it.
public Dequeue ( ) : V>.KeyValuePair
return V>.KeyValuePair

Enqueue() public method

Enqueue a new item. This overwrites the oldest item in the buffer if the buffer has reached capacity.
public Enqueue ( key, value ) : void
return void

Enqueue() public method

Enqueue a new item. This overwrites the oldest item in the buffer if the buffer has reached capacity.
public Enqueue ( KeyValuePair item ) : void
item KeyValuePair
return void

KeyedCircularBuffer() public method

Constructs a circular buffer with the specified capacity.
public KeyedCircularBuffer ( int capacity ) : System.Collections.Generic
capacity int
return System.Collections.Generic

Pop() public method

Pop the most recently added item from the front end of the buffer and return it.
public Pop ( ) : V>.KeyValuePair
return V>.KeyValuePair

TryGetValue() public method

Gets the value associated with the specified key.
public TryGetValue ( key, &value ) : bool
return bool

this() public method

Gets the value associated with the specified key. If the specified key is not found, a get operation throws a KeyNotFoundException.
public this ( key ) : V
return V