27 NT_NODE *n = ARB_calloc<NT_NODE>(1);
70 static int ntree_cont(
int len) {
71 return ntree_count<len;
121 #if defined(DUMP_PART_INSERTION)
122 fputs(
"ins_ntree part=", stdout); newpart->print();
135 const PART *sonpart = nsonp->node->part;
137 if (newpart->
equals(sonpart))
return 0;
140 int res =
ins_ntree(nsonp->node, newpart);
150 const PART *sonpart = nsonp->node->part;
161 #if defined(DUMP_PART_INSERTION)
162 fputs(
"ins_ntree part=", stdout); newpart->print();
184 NSONS *new_son = ARB_calloc<NSONS>(1);
186 new_son->
node = newntnode;
228 #if defined(DUMP_PART_INSERTION)
229 fputs(
"insert_ntree drops part=", stdout); part->print();
241 #if defined(NTREE_DEBUG_FUNCTIONS)
244 for (
int i = 0; i<indent; ++i)
fputc(
' ', stdout);
253 fputs(
"tree is empty\n", stdout);
259 fputs(
"(\n", stdout);
267 for (nsonp=tree->
son_list; nsonp; nsonp = nsonp->
next) {
268 print_ntree(nsonp->
node, indent);
274 fputs(
")\n", stdout);
277 #define FAIL_IF_NOT_WELLFORMED
279 #if defined(FAIL_IF_NOT_WELLFORMED)
280 #define SHOW_FAILURE() arb_assert(0)
282 #define SHOW_FAILURE()
285 bool is_well_formed(
const NT_NODE *tree) {
293 bool well_formed =
true;
306 PART *pson = nson->node->part;
320 pmerge = pson->
clone();
322 if (!is_well_formed(nson->node)) {
331 #if defined(FAIL_IF_NOT_WELLFORMED)
332 printf(
"tree with %i sons {\n", sons);
334 PART *pson = nson->node->part;
335 fputs(
" pson =", stdout); pson->print();
337 printf(
"} end of tree with %i sons\n", sons);
339 fputs(
"tree part=", stdout); tree->
part->print();
340 fputs(
"pmerge =", stdout); pmerge->print();
void set_len(GBT_LEN length)
bool differs(const PART *other) const
void do_indent(ostream &out, int indent)
const NT_NODE * ntree_get()
int ntree_count_sons(const NT_NODE *tree)
#define ASSERT_RESULT(Type, Expected, Expr)
static void move_son(NT_NODE *f_node, NT_NODE *s_node, NSONS *nson)
static NT_NODE * new_ntnode(PART *&p)
void ntree_init(const PartitionSize *registry)
PART * create_root() const
bool equals(const PART *other) const
void add_members_from(const PART *source)
static int ins_ntree(NT_NODE *tree, PART *&newpart)
fputs(TRACE_PREFIX, stderr)
TYPE * ARB_calloc(size_t nelem)
bool is_real_son_of(const PART *father) const
static void del_tree(NT_NODE *tree)
void insert_ntree(PART *&part)
bool is_subset_of(const PART *other) const
bool overlaps_with(const PART *other) const