ColaRangeSet<TKey>

Namespace: SnowBank.Collections.CacheOblivious · class

Implements: IEnumerable<Entry>, IEnumerable, IDisposable

Represent an ordered list of ranges, stored in a Cache Oblivious Lookup Array

Constructors

ColaRangeSet<TKey>

ColaRangeSet<TKey>(ArrayPool<Entry> pool = null)

ColaRangeSet<TKey>(int capacity, ArrayPool<Entry> pool = null)

ColaRangeSet<TKey>(IComparer<TKey> keyComparer, ArrayPool<Entry> pool = null)

ColaRangeSet<TKey>(int capacity, IComparer<TKey> keyComparer, ArrayPool<Entry> pool = null)

Properties

Bounds

Entry Bounds { get; }

Current bounds of this instance (minimum and maximum value)

Capacity

int Capacity { get; }

Allocated capacity of this instance

Comparer

IComparer<TKey> Comparer { get; }

Helper used to compare and sort keys of this instance

Count

int Count { get; }

Number of distinct ranges in this instance

Methods

Clear

void Clear()

Removes all ranges from this instance

ContainsKey

bool ContainsKey(TKey key)

Checks if there is at least one range that contains the specified key

  • key — Key to test

Returns: true if the key is contained by one range; otherwise, false.

CopyTo

void CopyTo(ColaRangeSet<TKey> destination)

Copies all the ranges of this set onto another set

  • destination — Destination set that will be modified

Debug_Dump

void Debug_Dump(TextWriter output)

Writes the contents of this set into a log, for debugging purpose [DEBUG ONLY]

Dispose

void Dispose()

GetEnumerator

Enumerator<Entry> GetEnumerator()

IterateOrdered

IEnumerable<Entry> IterateOrdered()

Returns a sequence of all the ranges in this set, ordered by their keys.

Mark

void Mark(TKey begin, TKey end)

Adds a range to this set

  • begin — Begin key of the range (included)
  • end — End key of the range (excluded)

If the range overlaps existing ranges, they will be merged as required.

A degenerate range (begin equal to end) is empty and contains nothing: marking it is a no-op.

ToString

string ToString()