OmegaEngine API  1.0.3
Public Member Functions | Properties | List of all members
OmegaEngine.Collections.Pool< T > Class Template Reference

A very fast pseudo-collection (it does not implement IEnumerable<T>) that supports fast adding at the beginning. More...

Inheritance diagram for OmegaEngine.Collections.Pool< T >:
OmegaEngine.Collections.IPoolable< T >

Public Member Functions

void ForEach ([NotNull, InstantHandle] Action< T > action)
 Performs the specified action on each element of the pool More...
 
void Add ([NotNull] T item)
 Adds an item to the beginning pool More...
 
bool Remove ([NotNull] T item)
 Removes the first occurrence of a specific object from the pool More...
 
void Clear ()
 Removes all items from the pool More...
 
bool Contains ([NotNull] T item)
 Determines whether the pool contains a specific value. More...
 
void RemoveAll ([NotNull, InstantHandle] Action< T > action)
 Removes all the items in the buffer one-by-one, executing action after each removal. More...
 
void RemoveWhere ([NotNull, InstantHandle] Predicate< T > predicate)
 Removes all the items in the buffer that satisfy the condition defined by predicate . More...
 
void RemoveFirst ([NotNull, InstantHandle] Predicate< T > predicate)
 Removes the first item in the buffer that satisfies the condition defined by predicate . More...
 

Properties

int Count [get]
 Gets the number of elements contained in the pool More...
 
- Properties inherited from OmegaEngine.Collections.IPoolable< T >
NextElement [get, set]
 A reference to the next element in the Pool<T> chain. More...
 

Detailed Description

A very fast pseudo-collection (it does not implement IEnumerable<T>) that supports fast adding at the beginning.

An item can always only be in one pool at any given time.

Template Parameters
TThe type of items to store in the pool.
Type Constraints
T :class 
T :IPoolable<T> 

Member Function Documentation

◆ Add()

void OmegaEngine.Collections.Pool< T >.Add ( [NotNull] T  item)
inline

Adds an item to the beginning pool

Parameters
itemThe object to add to the pool
Exceptions
ArgumentExceptionitem is already in a pool.

◆ Clear()

void OmegaEngine.Collections.Pool< T >.Clear ( )
inline

Removes all items from the pool

◆ Contains()

bool OmegaEngine.Collections.Pool< T >.Contains ( [NotNull] T  item)
inline

Determines whether the pool contains a specific value.

Parameters
itemThe object to locate in the pool
Returns
true if item is found in the pool; otherwise, false.

◆ ForEach()

void OmegaEngine.Collections.Pool< T >.ForEach ( [NotNull, InstantHandle] Action< T >  action)
inline

Performs the specified action on each element of the pool

Parameters
actionA delegate to perform on each element of the pool

◆ Remove()

bool OmegaEngine.Collections.Pool< T >.Remove ( [NotNull] T  item)
inline

Removes the first occurrence of a specific object from the pool

Parameters
itemThe object to remove from the pool
Returns
true if item was successfully removed from the buffer list; otherwise, false. This method also returns false if item is not found in the original pool

Not all too fast, try to avoid using this

◆ RemoveAll()

void OmegaEngine.Collections.Pool< T >.RemoveAll ( [NotNull, InstantHandle] Action< T >  action)
inline

Removes all the items in the buffer one-by-one, executing action after each removal.

Parameters
actionA delegate that is executed right after an item is removed.

Ideal for moving all elements to a new data structure.

◆ RemoveFirst()

void OmegaEngine.Collections.Pool< T >.RemoveFirst ( [NotNull, InstantHandle] Predicate< T >  predicate)
inline

Removes the first item in the buffer that satisfies the condition defined by predicate .

Parameters
predicateA delegate that defines the condition to check for.

Ideal for selectively picking the first suitable element from the pool.

◆ RemoveWhere()

void OmegaEngine.Collections.Pool< T >.RemoveWhere ( [NotNull, InstantHandle] Predicate< T >  predicate)
inline

Removes all the items in the buffer that satisfy the condition defined by predicate .

Parameters
predicateA delegate that defines the condition to check for.

Ideal for selectively picking all suitable elements from the pool.

Property Documentation

◆ Count

int OmegaEngine.Collections.Pool< T >.Count
get

Gets the number of elements contained in the pool

Returns
The number of elements contained in the pool

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