59#ifndef __ADS_IntervalTree
60 #define __ADS_IntervalTree
89template< std::totally_ordered T >
114 return( *x < *y ? y : x );
142 template< Executor E >
157 void insert(
const T & a ,
const T & b );
172 void remove(
const T & a ,
const T & b );
175 [[nodiscard]] std::size_t
size(
void )
const {
return( f_n ); }
194 [[nodiscard]]
bool stabbed(
const T & x )
const;
218 void stab(
const T & x , F && f )
const;
231 [[nodiscard]] std::size_t
count(
const T & x )
const;
238 static std::vector< std::pair< Interval , std::size_t > >
239 counted( std::vector< Interval > & I );
254#include "ADS/geometry/impl/IntervalTree.tpp"
The contracts of ADS: the preconditions, the postconditions and the invariants of the operations,...
The layer of execution of the parallel algorithms of ADS, beyond the book: an executor runs the calls...
The binary search trees balanced by join alone, and the augmented maps, beyond the book: JoinTree< K ...
std::size_t count(const T &x) const
the intervals that contain , with their copies, by stab();
IntervalTree(std::vector< Interval > I)
the intervals of , sorted, counted and inserted by multiInsert()
bool stabbed(const T &x) const
whether an interval contains ,
void insert(const T &a, const T &b)
one more copy of ,
void remove(const T &a, const T &b)
one copy less of , if there,
IntervalTree(void)=default
no interval
void stab(const T &x, F &&f) const
f( a , b ) once per copy of each interval that contains , by increasing ; for distinct intervals re...
std::pair< T, T > Interval
Definition IntervalTree.h:95
std::size_t size(void) const
the intervals, with their copies
Definition IntervalTree.h:175
IntervalTree(E &ex, std::vector< Interval > I)
the intervals of , as above, on the threads of ex
a DICTIONARY on a binary search tree balanced by the join of B alone, augmented by G,...
Definition JoinTree.h:291
the augmentation: the largest right end, nothing for no interval
Definition IntervalTree.h:99
std::optional< T > Value
the largest right end, or nothing
Definition IntervalTree.h:101
static Value from(const Interval &i, const std::size_t &)
the right end of the interval
Definition IntervalTree.h:105
static Value identity(void)
no interval, the identity of the maximum
Definition IntervalTree.h:103
static Value combine(const Value &x, const Value &y)
, nothing being smaller than any end
Definition IntervalTree.h:109