-
Notifications
You must be signed in to change notification settings - Fork 0
/
IntervalNode.h
53 lines (32 loc) · 1.03 KB
/
IntervalNode.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#ifndef INTERVALNODE_H
#define INTERVALNODE_H
#include <iostream>
#include <stdlib.h>
#include "Interval.h"
class IntervalNode{
public:
//helper function
static int compareTimes(int t1, int t2);
IntervalNode *left;
IntervalNode *right;
IntervalNode *parent;
int maxEndTime;
Interval *interval;
int destId;
int color;
IntervalNode(); //to be used only for creating sentinel
IntervalNode(int isDestId, IntervalNode *sentinel);
IntervalNode(int isDestId, Interval *isInterval, IntervalNode *sentinel);
bool isRoot(IntervalNode *sentinel);
bool isLeaf(IntervalNode *sentinel);
/*0 if parent is null, -1 if I am left child, 1 otherwise*/
int parentDirection(IntervalNode *sentinel);
IntervalNode *successor(IntervalNode *sentinel);
int compareTo(IntervalNode *other, IntervalNode *sentinel);
void recalculateMaxEnd(IntervalNode * sentinel);
IntervalNode *grandParent(IntervalNode *sentinel);
IntervalNode *uncle(IntervalNode *sentinel);
IntervalNode *sibling(IntervalNode *sentinel);
void printInterval();
};
#endif