A IList{T} implementation that has efficient insertion and removal (in O(lg n) time)
and that saves memory by allocating only one node when a value is repeated in adjacent indices.
Based on this "compression", it also supports efficient InsertRange/SetRange/RemoveRange operations.
Declaration Syntax
C# | Visual Basic | Visual C++ |
public sealed class CompressingTreeList<T> : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Public NotInheritable Class CompressingTreeList(Of T) _ Implements IList(Of T), ICollection(Of T), _ IEnumerable(Of T), IEnumerable
generic<typename T> public ref class CompressingTreeList sealed : IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
Generic Template Parameters
- T
Members
All Members | Constructors | Methods | Properties | ||
Icon | Member | Description |
---|---|---|
CompressingTreeList<(Of <(<'T>)>)>(IEqualityComparer<(Of <<'(T>)>>)) |
Creates a new CompressingTreeList instance.
| |
CompressingTreeList<(Of <(<'T>)>)>(Func<(Of <<'(T, T, Boolean>)>>)) |
Creates a new CompressingTreeList instance.
| |
Add(T) |
Adds the specified item to the end of the list.
| |
Clear()()()() |
Removes all items from this list.
| |
Contains(T) |
Gets whether this list contains the specified item.
| |
CopyTo(array<T>[]()[][], Int32) |
Copies all items in this list to the specified array.
| |
Count |
Gets the number of items in the list.
| |
Equals(Object) | (Inherited from Object.) | |
GetEndOfRun(Int32) |
Gets the first index after index so that the value at the result index is not
equal to the value at index.
That is, this method returns the exclusive end index of the run of equal values.
| |
GetEnumerator()()()() |
Gets an enumerator for this list.
| |
GetHashCode()()()() | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetRunLength(Int32) | Obsolete.
Gets the number of elements after index that have the same value as each other.
| |
GetStartOfRun(Int32) |
Gets the the first index so that all values from the result index to index
are equal.
| |
GetType()()()() | Gets the Type of the current instance. (Inherited from Object.) | |
IndexOf(T) |
Gets the index of the specified item.
| |
Insert(Int32, T) |
Inserts the specified item at index | |
InsertRange(Int32, Int32, T) |
Inserts itemcount times at position
index.
| |
Item[([( Int32])]) |
Gets or sets an item by index.
| |
Remove(T) |
Removes the specified item from this list.
| |
RemoveAt(Int32) |
Removes one item at index | |
RemoveRange(Int32, Int32) |
Removes count items starting at position
index.
| |
SetRange(Int32, Int32, T) |
Sets count indices starting at index to
item | |
ToString()()()() | (Inherited from Object.) | |
Transform(Func<(Of <<'(T, T>)>>)) |
Applies the conversion function to all elements in this CompressingTreeList.
| |
TransformRange(Int32, Int32, Func<(Of <<'(T, T>)>>)) |
Applies the conversion function to the elements in the specified range.
|
Remarks
Current memory usage: 5*IntPtr.Size + 12 + sizeof(T) per node.
Use this class only if lots of adjacent values are identical (can share one node).
Inheritance Hierarchy
Object | |
CompressingTreeList<(Of <(<'T>)>)> |
Assembly: ICSharpCode.AvalonEdit (Module: ICSharpCode.AvalonEdit.dll) Version: 5.0.0.4238