Class TagCollection
- Namespace
- TMPEffects.Tags.Collections
- Assembly
- TMPEffects.dll
public class TagCollection : ITagCollection, IReadOnlyTagCollection, IReadOnlyCollection<TMPEffectTagTuple>, IEnumerable<TMPEffectTagTuple>, IEnumerable
- Inheritance
-
TagCollection
- Implements
- Derived
- Inherited Members
Constructors
TagCollection(IList<TMPEffectTagTuple>, ITMPTagValidator)
public TagCollection(IList<TMPEffectTagTuple> tags, ITMPTagValidator validator = null)
Parameters
tags
IList<TMPEffectTagTuple>validator
ITMPTagValidator
TagCollection(ITMPTagValidator)
public TagCollection(ITMPTagValidator validator = null)
Parameters
validator
ITMPTagValidator
Fields
tags
protected IList<TMPEffectTagTuple> tags
Field Value
validator
protected readonly ITMPTagValidator validator
Field Value
Properties
TagCount
The amount of TMPEffectTagTuple in this collection.
public int TagCount { get; }
Property Value
Methods
AdjustOrderAtIndexAt(int, TMPEffectTagIndices)
protected void AdjustOrderAtIndexAt(int listIndex, TMPEffectTagIndices indices)
Parameters
listIndex
intindices
TMPEffectTagIndices
BinarySearchIndexFirstIndexOf(StartIndexOnly)
protected int BinarySearchIndexFirstIndexOf(TagCollection.StartIndexOnly indices)
Parameters
indices
TagCollection.StartIndexOnly
Returns
BinarySearchIndexOf(IComparable<TMPEffectTagIndices>)
protected int BinarySearchIndexOf(IComparable<TMPEffectTagIndices> indices)
Parameters
indices
IComparable<TMPEffectTagIndices>
Returns
Clear()
Clear the entire collection.
public virtual void Clear()
Contains(TMPEffectTag, TMPEffectTagIndices?)
Whether this collection contains the given tag with the given indices (if supplied).
public bool Contains(TMPEffectTag tag, TMPEffectTagIndices? indices = null)
Parameters
tag
TMPEffectTagThe tag to check.
indices
TMPEffectTagIndices?The tag indices. If you don't care about the tag's indices, leave as default.
Returns
- bool
true if this collection contains the given tag with the given indices (if supplied); otherwise false.
CopyTo(TMPEffectTag[], int)
public void CopyTo(TMPEffectTag[] array, int arrayIndex)
Parameters
array
TMPEffectTag[]arrayIndex
int
FindIndex(TMPEffectTag)
protected int FindIndex(TMPEffectTag tag)
Parameters
tag
TMPEffectTag
Returns
GetEnumerator()
public IEnumerator<TMPEffectTagTuple> GetEnumerator()
Returns
IndicesOf(TMPEffectTag)
Get the associated indices of the given tag.
public TMPEffectTagIndices? IndicesOf(TMPEffectTag tag)
Parameters
tag
TMPEffectTagThe tag to get the indices of.
Returns
- TMPEffectTagIndices?
The indices of the given tag, if the tag is contained in the collection; otherwise null.
Remove(TMPEffectTag, TMPEffectTagIndices?)
Remove the given tag, with the specified indices (if supplied).
public virtual bool Remove(TMPEffectTag tag, TMPEffectTagIndices? indices = null)
Parameters
tag
TMPEffectTagThe tag to remove.
indices
TMPEffectTagIndices?The indices of the tag.
Returns
- bool
true if the tag was removed; false otherwise.
RemoveAllAt(int, TMPEffectTagTuple[], int)
Remove all tags starting at the given startIndex
.
public virtual int RemoveAllAt(int startIndex, TMPEffectTagTuple[] buffer = null, int bufferIndex = 0)
Parameters
startIndex
intThe start index.
buffer
TMPEffectTagTuple[]Buffer to save the removed tags into. Leave at default if you do not want to get the tags.
bufferIndex
intThe offset index of the buffer, i.e. the index at which the tags should be inserted into
buffer
.
Returns
- int
The amount of removed tags.
RemoveAt(int, int?)
Remove the tag starting at the given startIndex
with the correct order
.
If order
is left to default, the first tag at startIndex
will be removed.
public virtual bool RemoveAt(int startIndex, int? order = null)
Parameters
Returns
- bool
true if a tag was removed; false otherwise.
TagAt(int, int?)
Get the tag at the given startIndex
with the correct order
.
If order
is left to default, the first tag at startIndex
will be returned.
public TMPEffectTag TagAt(int startIndex, int? order = null)
Parameters
Returns
- TMPEffectTag
The tag at the given indices, if it exists; otherwise null.
TagsAt(int)
Get the tags starting at the given startIndex
.
public IEnumerable<TMPEffectTagTuple> TagsAt(int startIndex)
Parameters
startIndex
intThe start index.
Returns
- IEnumerable<TMPEffectTagTuple>
All tags starting at the given
startIndex
.
TagsAt(int, TMPEffectTagTuple[], int)
Get the tags starting at the given startIndex
.
public int TagsAt(int startIndex, TMPEffectTagTuple[] buffer, int bufferIndex = 0)
Parameters
startIndex
intThe start index.
buffer
TMPEffectTagTuple[]The buffer the tags will be stored in.
bufferIndex
intThe offset index of the buffer, i.e. the index at which the tags should be inserted into
buffer
.
Returns
- int
The amount of tags starting at the given
startIndex
.
TryAdd(TMPEffectTag, int, int, int?)
Attempt to add a new tag to the collection.
If orderAtIndex
is left to default, the order will be assigned so it is the first tag at the given startIndex
.
public virtual bool TryAdd(TMPEffectTag tag, int startIndex = 0, int endIndex = -1, int? orderAtIndex = null)
Parameters
tag
TMPEffectTagThe tag to add.
startIndex
intThe tag's start index.
endIndex
intThe tag's end index.
orderAtIndex
int?The tag's order at index.
Returns
- bool
true if the tag was successfully added; false otherwise.
TryAdd(TMPEffectTag, TMPEffectTagIndices)
Attempt to add a new tag to the collection.
public virtual bool TryAdd(TMPEffectTag tag, TMPEffectTagIndices indices)
Parameters
tag
TMPEffectTagThe tag to add.
indices
TMPEffectTagIndicesThe tag's indices.
Returns
- bool
true if the tag was successfully added; false otherwise.