Struct rangetree::RangeTree
[−]
[src]
pub struct RangeTree<TOrd: RType> { /* fields omitted */ }
Main range-tree structure.
Methods
impl<TOrd: RType> RangeTree<TOrd>
[src]
fn new(range: [TOrd; 2], full: bool) -> RangeTree<TOrd>
Create a new range tree.
range
the [minimum, maximum] values (inclusive), for this range tree.full
When true, the tree is created with all values taken.
fn clear(&mut self, full: bool)
Clear an existing range tree.
full
When true, the tree is reset with all values taken.
fn take(&mut self, value: TOrd)
Take a value from the tree.
Note: taking a value which is already taken will panic.
use retake
in cases when its not know.
fn retake(&mut self, value: TOrd) -> bool
Take a value which may already be taken, returning true if the value didn't already exist in the tree.
fn take_any(&mut self) -> Option<TOrd>
Take any value from the range tree.
fn has(&self, value: TOrd) -> bool
Check if the tree has this value (not taken).
fn is_empty(&self) -> bool
Check if no values in the tree are taken.
fn is_full(&self) -> bool
Check if all values in the tree are taken.
fn release(&mut self, value: TOrd)
Release a value that has been taken.
fn ranges_taken_as_vec(&self) -> Vec<[TOrd; 2]>
Return a vector containing [minimum, maximum] pairs (inclusive) of contiguous ranges which have been taken.
fn ranges_untaken_as_vec(&self) -> Vec<[TOrd; 2]>
Return a vector containing [minimum, maximum] pairs (inclusive) of contiguous ranges which have not been taken.