Debian Codegraph @

src/interval_tree.h

raw symbols SCIP
1 #include <iostream>
2
3 #include "primer_bed.h"
4 using namespace std;
5
6 #ifndef interval_tree
7 #define interval_tree
8
9 // Structure to represent an interval
10 class Interval {
11 public:
12 Interval(int val1, int val2)
13 : low(std::min(val1, val2)), high(std::max(val1, val2)) {} // constructor
14 int low, high;
15 };
16 // Structure to represent a node in Interval Search Tree
17 class ITNode {
18 /*
19 public:
20 ITNode(Interval *values): data(value), left(nullptr), right(nullptr) {} //
21 constructor int max;
22 // Getters - access member functions
23 Interval getData()const;
24 ITNode getLeft()const;
25 ITNode getRight()const;
26 // Setters - access member functions
27 void setLeft(ITNode *node);
28 void setRight(ITNode *node);
29 */
30 public:
31 ITNode(Interval value)
32 : data(new Interval(value)),
33 left(nullptr),
34 right(nullptr),
35 max(value.high) {} // constructor
36 Interval *data; // pointer to node's interval data object
37 ITNode *left, *right; // pointer to node's left & right child node objects
38 int max;
39 };
40
41 /////////////////////////////////////////////////////////////////////////////////////////
42 // IntervalTree class
43 class IntervalTree {
44 private:
45 ITNode *_root;
46 void insert(ITNode *root, Interval data);
47 bool envelopSearch(ITNode *root, Interval data);
48 void inOrder(ITNode *root);
49
50 public:
51 IntervalTree(); // constructor
52 void insert(Interval data) { insert(_root, data); }
53 bool envelopSearch(Interval data) { return envelopSearch(_root, data); }
54 void inOrder() { inOrder(_root); }
55 };
56
57 IntervalTree populate_amplicons(std::string pair_info_file,
58 std::vector<primer> &primers);
59
60 #endif