43 printf(
"%g not <= parent %g\n",
48 if (t_ < parent_->
t_) {
49 printf(
"%g not >= parent %g\n",
54 printf(
"this %g is not a child of its parent %g\n",
60 printf(
"%g: weight %d inconsistent with left=%d and right=%d\n",
70 for (i=0; i < level; ++
i) {
92 #if BBTQ == 0 // balanced binary tree implemented by Michael Hines 96 tpool_ =
new TQItemPool(1000);
101 #if COLLECT_TQueue_STATISTICS 102 nmove = ninsert = nrem = nleast = nbal = ncmplxrem = 0;
103 nfastmove = ncompare = nleastsrch = nfind = nfindsrch = 0;
116 root_->t_iterate(
prnt, 0);
122 root_->t_iterate(f, 0);
130 root_->t_iterate(
chk, 0);
147 #if !FAST_LEAST || DOCHECK 150 if (b)
for (; b->left_; b = b->left_) {
195 double tmin = -1e9, tmax = 1e9;
206 if ( tmin <= tnew && tnew < tmax) {
229 }
else if (t < b->
t_) {
235 Printf(
"couldn't find %g\n", t);
257 check(
"begin remove1");
259 if (least_ && least_ == i) {
265 bool doweight =
true;
343 check(
"end remove1");
402 check(
"begin insert1");
405 if (!least_ || t < least_->
t_) {
452 check(
"end insert1");
456 int balance, dbalance;
460 if (balance < -(
wright() + 1)) {
465 if (balance >
wleft() + 1) {
475 #if COLLECT_TQueue_STATISTICS 476 Printf(
"insertions=%lu moves=%lu fastmoves=%lu removals=%lu calls to least=%lu\n", ninsert, nmove, nfastmove, nrem, nleast);
477 Printf(
"calls to find=%lu balances=%lu complex removals=%lu\n", nfind, nbal, ncmplxrem);
478 Printf(
"comparisons=%lu leastsearch=%lu findsearch=%lu\n", ncompare, nleastsrch, nfindsrch);
480 Printf(
"Turn on COLLECT_TQueue_STATISTICS_ in tqueue.h\n");
void forall_callback(void(*)(const TQItem *, int))
void hoc_execerror(const char *, const char *)
TQItem * insert(double t, void *data_)
static void chk(TQItem *b, int level)
static void deleteitem(TQItem *i)
static void prnt(const TQItem *b, int level)
void move_least(double tnew)
static const char * errmess_
void insert1(double t, TQItem *)
static double least(void *v)
void check(const char *errmess)
void move(TQItem *, double tnew)
void t_iterate(void(*)(const TQItem *, int), int)