Class ComputationQueue<T>
- Namespace
- SearchAThing.Sci
- Assembly
- netcore-sci.dll
helper circular queue manager for computation. at constructor the maxSize ( default=3 ) can be specified to allow retrieval of previous computed items
public class ComputationQueue<T> where T : class
Type Parameters
T
type that hold computation data
- Inheritance
-
ComputationQueue<T>
- Inherited Members
Constructors
ComputationQueue(int)
construct a computation queue with given size. if queue size already at maxSize older element will be overwritten.
public ComputationQueue(int maxSize = 3)
Parameters
maxSize
intmax circular queue size
Properties
Count
actual inserted items in the queue
public int Count { get; }
Property Value
Current
last inserted item
public T? Current { get; }
Property Value
- T
MaxSize
max queue size
public int MaxSize { get; }
Property Value
Prev
previous inserted item ( penultimate )
public T? Prev { get; }
Property Value
- T
PrevPrev
previous previous inserted item ( antepeunltimate )
public T? PrevPrev { get; }
Property Value
- T
Methods
Enq(T)
insert element in the queue. if queue size already at maxSize older element will be overwritten
public void Enq(T d)
Parameters
d
Tdata to enqueue
GetItem(int)
retrieve item from the queue
public T? GetItem(int prevCnt)
Parameters
prevCnt
int0 for last inserted, 1 for prev, 2 for prevPrev, ...
Returns
- T
prev-th item in the queue