Tree::Range::RB::Conflict – range tree implemented on top of Tree::RB, which fails instead of writing over
require Tree::Range::RB::Conflict; sub ncmp { $_[0] <=> $_[1]; } my $nrt = Tree::Range::RB->new ({ "cmp" => \&ncmp }); $nrt->range_set (100, 200, "foo"); $nrt->range_set (200, 300, "bar"); ## this last range_set () raises an exception $nrt->range_set (150, 250, "baz");
This class implements a range tree (as described in Tree::Range::base) on top of the Tree::RB red-black tree implementation, with the ranges being “overwrite-protected” (as described in Tree::Range::conflict.)
It inherits from both Tree::Range::RB and Tree::Range::conflict. Please refer to the Tree::Range::RB documentation for additional information and examples.
Note that the range_set_over method remains available, so it’s still possible to overwrite an arbitrary range’s association, or to effectively “remove” one (by associating it with the leftmost value.)
range_set_over
Tree::Range::RB, Tree::Range::base, Tree::Range::conflict.
Ivan Shmakov <oneingray@gmail.com>
This library is free software; you can redistribute it and/or modify it under the terms of the 3-clause BSD license, as included within the code.
To install Tree::Range, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tree::Range
CPAN shell
perl -MCPAN -e shell install Tree::Range
For more information on module installation, please visit the detailed CPAN module installation guide.