Bases: Ranger.src.Collections.RangeMap.RangeMap
Class used to represent a mapping of disjoint ranges to sets of items. Ranges do not coalesce. However, if a new Range is added over an existing Range, items belonging to the existing Range are retained in that Range
Methods
| contains(val) | Returns true if any of the ranges fully enclose the given |
| get(key) | Get the item(s) corresponding to a given key. |
| iteritems([start, end]) | Iterates over pairs of (Range, value) |
| overlaps(val) | Returns true if any of the ranges at least partially overlap |
| put(key, val) | Creates a mapping from a Range to a value, adding to |
| remove(aRange) | Removes a range and its value(s) from the range set |
| whichOverlaps(val) | Returns which of the Ranges overlap with a single value or |
Get the item(s) corresponding to a given key. The key can be a Range or a single value that is within a Range
| Parameters: | key : comparable
|
|---|---|
| Returns: | A set containing all overlapping items |
| Raises: | KeyError
ValueError
|
Iterates over pairs of (Range, value)
| Parameters: | start : comparable, optional
end : comparable, optional
|
|---|---|
| Returns: | Generator of (Range intersecting [start,end], value), ordered by start point |
Creates a mapping from a Range to a value, adding to any existing values over that Range
| Parameters: | key : Range object
val : value, hashable
|
|---|---|
| Raises: | TypeError
|
Bases: object
Class used to represent a mapping of disjoint ranges to some objects. Ranges do not coalesce. If a new Range is added over an existing Range, it overwrites the overlapping part of the existing Range
Methods
| contains(val) | Returns true if any of the ranges fully enclose the given |
| get(key) | Get the item(s) corresponding to a given key. |
| overlaps(val) | Returns true if any of the ranges at least partially overlap |
| put(key, val) | Creates a mapping from a Range to a value. |
| remove(aRange) | Removes a range and its value from the range set |
| whichOverlaps(val) | Returns which of the Ranges overlap with a single value or |
Returns true if any of the ranges fully enclose the given value, which can be a single value or a Range object
| Parameters: | val : A single value or a Range object |
|---|---|
| Returns: | true if any of the ranges fully enclose the given value |
| Raises: | ValueError
|
Get the item(s) corresponding to a given key. The key can be a Range or a single value that is within a Range
| Parameters: | key : A single value or Range object |
|---|---|
| Returns: | A set containing all overlapping items |
| Raises: | KeyError
ValueError
|
Returns true if any of the ranges at least partially overlap the given value, which can be a single value or a Range object
| Parameters: | val : A single value or a Range object |
|---|---|
| Returns: | true if any of the ranges fully enclose the given value |
Creates a mapping from a Range to a value. Note that if the key Range overlaps any existing ranges, it will replace those Range(s) over the intersection
| Parameters: | key : Range object
val : value
|
|---|---|
| Raises: | TypeError
|
Bases: object
Class used to represent a set of non-overlapping ranges of the same type. If a range is added that is connected to another range already in the set, those ranges are merged. Otherwise, it is added as a new range in the set
Methods
| add(aRange) | Adds a range to the range set. |
| contains(val) | Returns true if any of the ranges fully enclose the given |
| difference(otherSet) | Creates a new RangeSet in which all elements in another RangeSet |
| intersection(otherSet) | Creates a new RangeSet that is the intersection of this and |
| overlaps(val) | Returns true if any of the ranges at least partially overlap |
| remove(aRange) | Removes a range from the range set. |
| union(otherSet) | Creates a new RangeSet that is the union of this set and |
| whichOverlaps(val) | Returns which of the Ranges overlap with a single value or |
Adds a range to the range set. If this range is not connected to any current ranges, it will place the new range on its own. If there is a connection, any connected ranges will be merged into a single range
| Parameters: | aRange : A Range object
|
|---|---|
| Raises: | ValueError
TypeError:
|
Returns true if any of the ranges fully enclose the given value, which can be a single value or a Range object
| Parameters: | val : A single value or a Range object |
|---|---|
| Returns: | true if any of the ranges fully enclose the given value |
| Raises: | ValueError
|
Creates a new RangeSet in which all elements in another RangeSet are taken out of this RangeSet
| Parameters: | otherSet : RangeSet object
|
|---|---|
| Returns: | RangeSet consisting of the difference of the two sets |
| Raises: | TypeError
ValueError
|
Creates a new RangeSet that is the intersection of this and another RangeSet
| Parameters: | otherSet : RangeSet object
|
|---|---|
| Returns: | RangeSet consisting of the intersection of the two sets |
| Raises: | TypeError
ValueError
|
Returns true if any of the ranges at least partially overlap the given value, which can be a single value or a Range object
| Parameters: | val : A single value or a Range object |
|---|---|
| Returns: | true if any of the ranges fully enclose the given value |
Removes a range from the range set.
| Parameters: | aRange : A Range object
|
|---|---|
| Raises: | ValueError
TypeError
|
Creates a new RangeSet that is the union of this set and another RangeSet object
| Parameters: | otherSet : RangeSet object
|
|---|---|
| Returns: | RangeSet consisting of union of two sets |
| Raises: | TypeError
ValueError
|