StackedArray<T>

public sealed class StackedArray<T> : IEnumerable<T>
Provides an immutable array-like collection optimised for frequent identical consecutive elements.
T

Constructors

StackedArray

#
Create a new, empty stacked array.
public StackedArray()

StackedArray

#
Create a new stacked array from a collection of values, using a custom comparer.
public StackedArray(
values,
Value.
Func<T, T, bool>
comparer
Comparison delegate.
)

StackedArray

#
Create a new stacked array from a collection of values, using a custom comparer.
public StackedArray(
values,
Value.
comparer
Comparer to use.
)

StackedArray

#
Create a new stacked array from pre-existing value and valence collections.
public StackedArray(
values,
Collection of values. Consecutive duplicates will not be filtered.
valence
Collection of valences. Must be the same size as the values collection.
)

StackedArray

#
Create a new stacked array from a collection of values, using the default comparer.
public StackedArray(
values
)

Properties

Count

#
Gets the number of actual distinct values stored in this stacked array.
public int Count { get; }

ImpliedCount

#
Gets the total length of all implied items in this stacked array.
public long ImpliedCount { get; }

Indexers

this[]

#
Gets the implied value (adjusted for accumulated valence) at the given index.
public T this[
index
Implied index.
] { get; }
Value at implied index.

Methods

GetEnumerator

#
Returns an enumerator that iterates through the collection of implied values.
public IEnumerator<T> GetEnumerator()
An enumerator that can be used to iterate through the collection.

ImpliedValue

#
Gets the implied value (adjusted for accumulated valence) at the given index.
public T ImpliedValue(
index
Implied index.
)
Value at implied index.
Explicit

IEnumerable.GetEnumerator

#
Returns an enumerator that iterates through the collection of implied values.
IEnumerator IEnumerable.GetEnumerator()
An IEnumerator object that can be used to iterate through the collection.

Valence

#
Gets the valence of the value at the given index.
public int Valence(
index
Index of value to retrieve.
)
Valence of value at index.

Value

#
Gets the value at the given index.
public T Value(
index
Index of value to retrieve.
)
Value at index.