ROSE 0.11.145.147
|
Policy indicating how values are merged and split.
Adjacent nodes of an IntervalMap can be joined together provided their values can also be joined together. This joining is a key feature of an IntervalMap since it can significantly reduce the number nodes required in the underlying map.
Definition at line 40 of file IntervalMap.h.
#include <Sawyer/IntervalMap.h>
Public Types | |
typedef I | Interval |
typedef T | Value |
Public Member Functions | |
bool | merge (const Interval &leftInterval, Value &leftValue, const Interval &rightInterval, Value &rightValue) |
Merge two values if possible. | |
Value | split (const Interval &interval, Value &value, const typename Interval::Value &splitPoint) |
Split one value into two values. | |
void | truncate (const Interval &interval, Value &value, const typename Interval::Value &splitPoint) |
Discard the right part of a value. | |
typedef I Sawyer::Container::MergePolicy< I, T >::Interval |
Definition at line 42 of file IntervalMap.h.
typedef T Sawyer::Container::MergePolicy< I, T >::Value |
Definition at line 43 of file IntervalMap.h.
|
inline |
Merge two values if possible.
The rightValue
is merged into the leftValue
if possible, or this method returns false without changing either value. After a successful merge, the rightValue
will be removed from the IntervalMap and its destructor called.
Definition at line 70 of file IntervalMap.h.
|
inline |
Split one value into two values.
The IntervalMap calls this method when the interval
is being split into two smaller, adjacent intervals. The splitPoint
argument is the split point and becomes the least value of the right interval. The value
argument is modified in place to become the left value, and the right value is returned. This method is only invoked when the result would be two non-empty intervals.
Definition at line 82 of file IntervalMap.h.
|
inline |
Discard the right part of a value.
This method is the same as split except the right part of the resulting value is discarded. This is sometimes more efficient than calling split and then destroying the return value.
Definition at line 92 of file IntervalMap.h.