PeanutButter
Loading...
Searching...
No Matches
PeanutButter.Utils.SlidingWindow< T > Class Template Reference

More...

Inheritance diagram for PeanutButter.Utils.SlidingWindow< T >:
PeanutButter.Utils.ISlidingWindow< T >

Public Member Functions

 SlidingWindow (int maxItems)
 Constructs the sliding window with a cap on maximum items.
 
 SlidingWindow (TimeSpan timeToLive)
 Constructs the sliding window with a cap on lifespan for items.
 
 SlidingWindow (int maxItems, TimeSpan timeToLive)
 
IEnumerator< T > GetEnumerator ()
 
void Add (T item)
 
void Trim ()
 Trims out stale or over-allocated items. Most useful when the collection is created with a max time to live and you'd like to get the current snapshot.
 
void Clear ()
 
bool Contains (T item)
 
void CopyTo (T[] array, int arrayIndex)
 
bool Remove (T item)
 
int IndexOf (T item)
 
void Insert (int index, T item)
 
ISlidingWindowItem< T > ItemAt (int index)
 Returns the raw item at the provided index - only really useful for diagnostics.
Parameters
index
Returns

 
void RemoveAt (int index)
 

Properties

TimeSpan TimeToLive [get, set]
 The maximum amount of time that items are kept for.
 
int MaxItems [get, set]
 The maximum number of items allowed in the window.
 
TimeSpan MaxLifeSpan [get]
 The age of the oldest record in the collection.
 
int Count [get]
 
bool IsReadOnly [get]
 
ISlidingWindowItem< T > First [get]
 Provides the first sliding window item in the collection, if available, or null.
 
ISlidingWindowItem< T > Last [get]
 Provides the last sliding window item in the collection, if available, or null.
 
this[int index] [get, set]
 
- Properties inherited from PeanutButter.Utils.ISlidingWindow< T >

Detailed Description

Constructor & Destructor Documentation

◆ SlidingWindow() [1/3]

Constructs the sliding window with a cap on maximum items.

Parameters
maxItems

◆ SlidingWindow() [2/3]

PeanutButter.Utils.SlidingWindow< T >.SlidingWindow ( TimeSpan  timeToLive)

Constructs the sliding window with a cap on lifespan for items.

Parameters
timeToLive

◆ SlidingWindow() [3/3]

PeanutButter.Utils.SlidingWindow< T >.SlidingWindow ( int  maxItems,
TimeSpan  timeToLive 
)
Parameters
maxItems
timeToLive

Member Function Documentation

◆ ItemAt()

ISlidingWindowItem< T > PeanutButter.Utils.SlidingWindow< T >.ItemAt ( int  index)

Returns the raw item at the provided index - only really useful for diagnostics.

Parameters
index
Returns

Implements PeanutButter.Utils.ISlidingWindow< T >.

◆ Trim()

Trims out stale or over-allocated items. Most useful when the collection is created with a max time to live and you'd like to get the current snapshot.

Implements PeanutButter.Utils.ISlidingWindow< T >.

Property Documentation

◆ First

Provides the first sliding window item in the collection, if available, or null.

Implements PeanutButter.Utils.ISlidingWindow< T >.

◆ Last

Provides the last sliding window item in the collection, if available, or null.

Implements PeanutButter.Utils.ISlidingWindow< T >.

◆ MaxLifeSpan

TimeSpan PeanutButter.Utils.SlidingWindow< T >.MaxLifeSpan
get

The age of the oldest record in the collection.

Implements PeanutButter.Utils.ISlidingWindow< T >.


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