template class MAGES::Recorder::IntervalTree

Overview

A tree that stores intervals, and can be queried for values that fall within a given range. More…

template 
class IntervalTree
{
public:
    // structs

    struct RVP;

    // classes

    class Node;

    // properties

    int Count;
    IEnumerable Values;
    TKey Min;
    TKey Max;

    // methods

    IntervalTree();
    List Q(TKey point);
    List Q(TKey min, TKey max);
    void Add(TKey min, TKey max, TValue value);
    override string ToString();
    bool CompletelyContains(TKey min, TKey max);
};

Detailed Documentation

A tree that stores intervals, and can be queried for values that fall within a given range.

Parameters:

TKey

The key type.

TValue

The value type.

Properties

int Count

Gets the number of items in the tree.

IEnumerable Values

Gets the values.

TKey Min

Gets the minimum key.

TKey Max

Gets the maximum key.

Methods

IntervalTree()

Initializes a new instance of the IntervalTree<TKey, TValue> class.

List Q(TKey point)

Gets the values that intersect the point.

Parameters:

point

The point key.

Returns:

List of values containing the point.

List Q(TKey min, TKey max)

Gets the values that intersect the range.

Parameters:

min

Minimum of the range.

max

Maximum of the range.

Returns:

List of values that intersect or contain the range.

void Add(TKey min, TKey max, TValue value)

Adds a new value to the tree.

Parameters:

min

The minimum range.

max

The maxmimum range.

value

The value.

override string ToString()

Converts the tree to a string.

Returns:

Multiline string for the tree.

bool CompletelyContains(TKey min, TKey max)

Determines if a given range is contained in the tree.

Parameters:

min

The minimum of the range.

max

The maximum of the range.

Returns:

True if the range is contained in the tree.