Helper Scripts Collection 1.3.1
API documentation for the helper scripts compatible with Unity3D
|
Helps with ICollections and List<T>s More...
Public Types | |
enum | ItemMatching { MatchNone = 0 , MatchAtLeastOne = 1 , MatchAll = 2 , MatchAllIncludingAmount = 3 } |
An enum for collection matching checks (CollectionHelper.CollectionsMatcher) | |
Static Public Member Functions | |
static bool | CollectionsMatcher (ItemMatching matching, ICollection colA, ICollection colB) |
Checks if the given ICollection<T>s match based on the desired matching setup, with colA being the main collection to check (outer loop). More... | |
static bool | CollectionsMatchAllItems (ICollection colA, ICollection colB) |
Checks if the given ICollection elements all match against each other More... | |
static List< T > | ListOfOne< T > (T item) |
Create a list with only 1 (the given) element in it More... | |
static int | PointerHandler (bool increment, int pointer, int lengthOfCollection) |
Increment or decrement (and cycle around) correctly respecting the length of a collection More... | |
static void | LogCollection< T > (ICollection< T > collection) |
Iterates through the collection and calls ToString() on each item or logs "null" if item was null More... | |
static bool | CollectionIsNullOrEmpty (ICollection collection) |
Checks if the given ICollection is null or empty More... | |
static bool | CollectionAndIndexChecker (ICollection collection, int i, bool logError=false) |
Checks if the given index (i ) is in bounds of the given ICollection (collection ) More... | |
static T | GetListItemAtIndex< T > (List< T > list, int i, bool logError=false) |
Doesn't throw any Exceptions if the list is null or empty and if the index is out of bounds More... | |
static T | GetQueueItemAtIndex< T > (Queue< T > queue, int i, bool logError=false) |
Doesn't throw any Exceptions if the queue is null or empty and if the index is out of bounds More... | |
Helps with ICollections and List<T>s
|
static |
Checks if the given index (i ) is in bounds of the given ICollection (collection )
collection | |
i | |
logError | Log index out of bounds error? |
|
static |
Checks if the given ICollection is null or empty
collection |
|
static |
Checks if the given ICollection elements all match against each other
colA | |
colB |
|
static |
Checks if the given ICollection<T>s match based on the desired matching setup, with colA being the main collection to check (outer loop).
matching | |
colA | |
colB |
|
static |
Doesn't throw any Exceptions if the list is null or empty and if the index is out of bounds
list | |
i | |
logError | Should we at least log the errors? |
T |
|
static |
Doesn't throw any Exceptions if the queue is null or empty and if the index is out of bounds
queue | |
i | |
logError | Should we at least log the errors? |
T |
|
static |
Create a list with only 1 (the given) element in it
item |
T |
|
static |
Iterates through the collection and calls ToString() on each item or logs "null" if item was null
collection |
T |
|
static |
Increment or decrement (and cycle around) correctly respecting the length of a collection
increment | increment, otherwise decrement |
pointer | the current index to increase or decrease |
lengthOfCollection | the length to loop around |
The correct index, potentially looped around
pointer = 2; lengthOfCollection = 3; increment = true; result = 0