INET Framework for OMNeT++/OMNEST
inet::IntervalTreeNode Class Reference

The node for interval tree. More...

#include <IntervalTree.h>

Public Member Functions

void print (IntervalTreeNode *left, IntervalTreeNode *right) const
 Print the interval node information: set left = nil and right = root. More...
 
 IntervalTreeNode ()
 Create an empty node. More...
 
 IntervalTreeNode (const Interval *new_interval)
 Create an node storing the interval. More...
 
 ~IntervalTreeNode ()
 

Protected Attributes

const Intervalstored_interval = nullptr
 interval stored in the node More...
 
simtime_t key
 
simtime_t high
 
simtime_t max_high
 
bool red = false
 red or black node: if red = false then the node is black More...
 
IntervalTreeNodeleft = nullptr
 
IntervalTreeNoderight = nullptr
 
IntervalTreeNodeparent = nullptr
 

Friends

class IntervalTree
 
class IntervalTreeTest
 

Detailed Description

The node for interval tree.

Constructor & Destructor Documentation

inet::IntervalTreeNode::IntervalTreeNode ( )

Create an empty node.

Referenced by inet::IntervalTree::insert(), and inet::IntervalTree::IntervalTree().

44 {
45 }
inet::IntervalTreeNode::IntervalTreeNode ( const Interval new_interval)

Create an node storing the interval.

47  :
48  stored_interval(new_interval), key(new_interval->low), high(new_interval->high), max_high(high)
49 {
50 }
simtime_t high
Definition: IntervalTree.h:93
simtime_t key
Definition: IntervalTree.h:91
simtime_t max_high
Definition: IntervalTree.h:95
const Interval * stored_interval
interval stored in the node
Definition: IntervalTree.h:89
inet::IntervalTreeNode::~IntervalTreeNode ( )
53 {
54  delete stored_interval;
55 }
const Interval * stored_interval
interval stored in the node
Definition: IntervalTree.h:89

Member Function Documentation

void inet::IntervalTreeNode::print ( IntervalTreeNode left,
IntervalTreeNode right 
) const

Print the interval node information: set left = nil and right = root.

Referenced by inet::IntervalTree::recursivePrint().

309 {
311  std::cout << ", k = " << key << ", h = " << high << ", mH = " << max_high;
312  std::cout << " l->key = ";
313  if (left == nil)
314  std::cout << "nullptr";
315  else
316  std::cout << left->key;
317  std::cout << " r->key = ";
318  if (right == nil)
319  std::cout << "nullptr";
320  else
321  std::cout << right->key;
322  std::cout << " p->key = ";
323  if (parent == root)
324  std::cout << "nullptr";
325  else
326  std::cout << parent->key;
327  std::cout << " red = " << (int) red << std::endl;
328 }
simtime_t high
Definition: IntervalTree.h:93
virtual void print() const
Definition: IntervalTree.h:59
IntervalTreeNode * parent
Definition: IntervalTree.h:104
IntervalTreeNode * right
Definition: IntervalTree.h:102
simtime_t key
Definition: IntervalTree.h:91
bool red
red or black node: if red = false then the node is black
Definition: IntervalTree.h:98
simtime_t max_high
Definition: IntervalTree.h:95
IntervalTreeNode * left
Definition: IntervalTree.h:100
const Interval * stored_interval
interval stored in the node
Definition: IntervalTree.h:89

Friends And Related Function Documentation

friend class IntervalTree
friend
friend class IntervalTreeTest
friend

Member Data Documentation

simtime_t inet::IntervalTreeNode::key
protected
bool inet::IntervalTreeNode::red = false
protected

red or black node: if red = false then the node is black

Referenced by inet::IntervalTree::deleteFixup(), inet::IntervalTree::deleteNode(), inet::IntervalTree::insert(), and print().

const Interval* inet::IntervalTreeNode::stored_interval = nullptr
protected

The documentation for this class was generated from the following files: