Class EventQueueBase<TEvent, TPoint, TPointDelta>
Represents a generic mutable event queue.
public abstract class EventQueueBase<TEvent, TPoint, TPointDelta> : IMutableEventQueue<TEvent, TPoint, TPointDelta>, IEventQueue<TEvent, TPoint, TPointDelta>, IReadOnlyEventQueue<TEvent, TPoint, TPointDelta>, IReadOnlyCollection<EnqueuedEvent<TEvent, TPoint, TPointDelta>>, IEnumerable<EnqueuedEvent<TEvent, TPoint, TPointDelta>>, IEnumerableType Parameters
- TEvent
- Event type. 
- TPoint
- Queue point type. 
- TPointDelta
- Queue point delta type. 
- Inheritance
- 
      
      EventQueueBase<TEvent, TPoint, TPointDelta>
- Implements
- 
      IMutableEventQueue<TEvent, TPoint, TPointDelta>IEventQueue<TEvent, TPoint, TPointDelta>IReadOnlyEventQueue<TEvent, TPoint, TPointDelta>IReadOnlyCollection<EnqueuedEvent<TEvent, TPoint, TPointDelta>>IEnumerable<EnqueuedEvent<TEvent, TPoint, TPointDelta>>
- Derived
- Inherited Members
Constructors
EventQueueBase(TPoint)
Creates a new empty EventQueueBase<TEvent, TPoint, TPointDelta> instance with Default point comparer.
protected EventQueueBase(TPoint startPoint)Parameters
- startPointTPoint
- Specifies the starting point of this queue. 
EventQueueBase(TPoint, IComparer<TPoint>)
Creates a new empty EventQueueBase<TEvent, TPoint, TPointDelta> instance.
protected EventQueueBase(TPoint startPoint, IComparer<TPoint> comparer)Parameters
- startPointTPoint
- Specifies the starting point of this queue. 
- comparerIComparer<TPoint>
- Queue point comparer. 
Properties
Comparer
Queue point comparer.
public IComparer<TPoint> Comparer { get; }Property Value
- IComparer<TPoint>
Count
Gets the number of elements in the collection.
public int Count { get; }Property Value
- int
- The number of elements in the collection. 
CurrentPoint
Specifies the current point that this queue is in.
public TPoint CurrentPoint { get; }Property Value
- TPoint
StartPoint
Specifies the starting point of this queue.
public TPoint StartPoint { get; }Property Value
- TPoint
Methods
AddDelta(TPoint, TPointDelta?)
Adds delta to the specified point in order to create a new point.
[Pure]
protected abstract TPoint AddDelta(TPoint point, TPointDelta? delta)Parameters
- pointTPoint
- Original point. 
- deltaTPointDelta
- Point delta to add to - point.
Returns
- TPoint
- New point. 
Clear()
Removes all events from this queue.
public void Clear()Dequeue()
Attempts to dequeue the next event that should be processed.
public EnqueuedEvent<TEvent, TPoint, TPointDelta>? Dequeue()Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>?
- EnqueuedEvent<TEvent, TPoint, TPointDelta> instance or null when no events are waiting for processing. 
Enqueue(TEvent, TPointDelta)
Adds a new event to this queue that happens exactly once with its
DequeuePoint equal to
CurrentPoint moved by the specified delta.
public EnqueuedEvent<TEvent, TPoint, TPointDelta> Enqueue(TEvent @event, TPointDelta delta)Parameters
- eventTEvent
- Underlying event. 
- deltaTPointDelta
- Point delta used for moving DequeuePoint forward. 
Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>
- New EnqueuedEvent<TEvent, TPoint, TPointDelta> instance. 
Enqueue(TEvent, TPointDelta, int)
Adds a new repeatable event to this queue with its DequeuePoint equal to
CurrentPoint moved by the specified delta.
public EnqueuedEvent<TEvent, TPoint, TPointDelta> Enqueue(TEvent @event, TPointDelta delta, int repetitions)Parameters
- eventTEvent
- Underlying event. 
- deltaTPointDelta
- Point delta used for moving DequeuePoint forward on each repetition of this event. 
- repetitionsint
- Number of repetitions. 
Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>
- New EnqueuedEvent<TEvent, TPoint, TPointDelta> instance. 
Exceptions
- ArgumentOutOfRangeException
- When - repetitionsis less than 1.
EnqueueAt(TEvent, TPoint)
Adds a new event to this queue that happens exactly once.
public EnqueuedEvent<TEvent, TPoint, TPointDelta> EnqueueAt(TEvent @event, TPoint dequeuePoint)Parameters
- eventTEvent
- Underlying event. 
- dequeuePointTPoint
- Queue point at which this event should be dequeued. 
Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>
- New EnqueuedEvent<TEvent, TPoint, TPointDelta> instance. 
EnqueueAt(TEvent, TPoint, TPointDelta, int)
Adds a new repeatable event to this queue.
public EnqueuedEvent<TEvent, TPoint, TPointDelta> EnqueueAt(TEvent @event, TPoint dequeuePoint, TPointDelta delta, int repetitions)Parameters
- eventTEvent
- Underlying event. 
- dequeuePointTPoint
- Queue point at which this event should be dequeued for the first time. 
- deltaTPointDelta
- Point delta used for moving DequeuePoint forward on each repetition of this event. 
- repetitionsint
- Number of repetitions. 
Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>
- New EnqueuedEvent<TEvent, TPoint, TPointDelta> instance. 
Exceptions
- ArgumentOutOfRangeException
- When - repetitionsis less than 1.
EnqueueInfinite(TEvent, TPointDelta)
Adds a new infinitely repeatable event to this queue with its DequeuePoint
equal to CurrentPoint moved by the specified delta.
public EnqueuedEvent<TEvent, TPoint, TPointDelta> EnqueueInfinite(TEvent @event, TPointDelta delta)Parameters
- eventTEvent
- Underlying event. 
- deltaTPointDelta
- Point delta used for moving DequeuePoint forward on each repetition of this event. 
Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>
- New EnqueuedEvent<TEvent, TPoint, TPointDelta> instance. 
EnqueueInfiniteAt(TEvent, TPoint, TPointDelta)
Adds a new infinitely repeatable event to this queue.
public EnqueuedEvent<TEvent, TPoint, TPointDelta> EnqueueInfiniteAt(TEvent @event, TPoint dequeuePoint, TPointDelta delta)Parameters
- eventTEvent
- Underlying event. 
- dequeuePointTPoint
- Queue point at which this event should be dequeued for the first time. 
- deltaTPointDelta
- Point delta used for moving DequeuePoint forward on each repetition of this event. 
Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>
- New EnqueuedEvent<TEvent, TPoint, TPointDelta> instance. 
GetEnumerator()
Returns an enumerator that iterates through the collection.
[Pure]
public IEnumerator<EnqueuedEvent<TEvent, TPoint, TPointDelta>> GetEnumerator()Returns
- IEnumerator<EnqueuedEvent<TEvent, TPoint, TPointDelta>>
- An enumerator that can be used to iterate through the collection. 
GetEvents(TPoint)
Returns information about all currently registered events in this queue,
from CurrentPoint to the specified endPoint.
[Pure]
public IEnumerable<EnqueuedEvent<TEvent, TPoint, TPointDelta>> GetEvents(TPoint endPoint)Parameters
- endPointTPoint
- Largest event point to include in the result. 
Returns
- IEnumerable<EnqueuedEvent<TEvent, TPoint, TPointDelta>>
- New IEnumerable<T> instance. 
GetNext()
Attempts to return information about the next event to happen.
[Pure]
public EnqueuedEvent<TEvent, TPoint, TPointDelta>? GetNext()Returns
- EnqueuedEvent<TEvent, TPoint, TPointDelta>?
- EnqueuedEvent<TEvent, TPoint, TPointDelta> instance or null when this queue is empty. 
Move(TPointDelta)
Moves the CurrentPoint forward.
public void Move(TPointDelta delta)Parameters
- deltaTPointDelta
- Point delta to move the CurrentPoint forward by.