Class TagCollection
- Namespace
- TMPEffects.Tags.Collections
Supports all classes in the .NET class hierarchy and provides low-level services to derived classes. This is the ultimate base class of all .NET classes; it is the root of the type hierarchy.
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
tagsIList<TMPEffectTagTuple>validatorITMPTagValidator
TagCollection(ITMPTagValidator)
public TagCollection(ITMPTagValidator validator = null)
Parameters
validatorITMPTagValidator
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
listIndexintindicesTMPEffectTagIndices
BinarySearchIndexFirstIndexOf(StartIndexOnly)
protected int BinarySearchIndexFirstIndexOf(TagCollection.StartIndexOnly indices)
Parameters
indicesTagCollection.StartIndexOnly
Returns
BinarySearchIndexOf(IComparable<TMPEffectTagIndices>)
protected int BinarySearchIndexOf(IComparable<TMPEffectTagIndices> indices)
Parameters
indicesIComparable<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
tagTMPEffectTagThe tag to check.
indicesTMPEffectTagIndices?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
arrayTMPEffectTag[]arrayIndexint
FindIndex(TMPEffectTag)
protected int FindIndex(TMPEffectTag tag)
Parameters
tagTMPEffectTag
Returns
GetEnumerator()
Returns an enumerator that iterates through the collection.
public IEnumerator<TMPEffectTagTuple> GetEnumerator()
Returns
- IEnumerator<TMPEffectTagTuple>
An enumerator that can be used to iterate through the collection.
IndicesOf(TMPEffectTag)
Get the associated indices of the given tag.
public TMPEffectTagIndices? IndicesOf(TMPEffectTag tag)
Parameters
tagTMPEffectTagThe 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
tagTMPEffectTagThe tag to remove.
indicesTMPEffectTagIndices?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
startIndexintThe start index.
bufferTMPEffectTagTuple[]Buffer to save the removed tags into. Leave at default if you do not want to get the tags.
bufferIndexintThe 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
startIndexintThe 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
startIndexintThe start index.
bufferTMPEffectTagTuple[]The buffer the tags will be stored in.
bufferIndexintThe 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
tagTMPEffectTagThe tag to add.
startIndexintThe tag's start index.
endIndexintThe tag's end index.
orderAtIndexint?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
tagTMPEffectTagThe tag to add.
indicesTMPEffectTagIndicesThe tag's indices.
Returns
- bool
true if the tag was successfully added; false otherwise.