-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnode.h
More file actions
58 lines (46 loc) · 1 KB
/
node.h
File metadata and controls
58 lines (46 loc) · 1 KB
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
54
55
56
57
58
#ifndef NODE_H
#define NODE_H
#include <list>
#include <string>
// A basic storage class for an existential graph tree
class Node
{
public:
/* Constructor */
Node() :
parent(NULL),
depth(0),
isLetter(false),
isCut(false),
isRoot(false) {}
/* Add new nodes */
Node* addChild();
/* Set type */
void setAsLetter( char c );
void setAsCut();
void setAsRoot();
/* Printing functions */
void print();
std::string toString();
/* Input from string */
static Node* parseFromString( std::string in );
/* Standardization */
static void standardize( Node* root );
void updateStdString();
void sortChildren();
//void sort();
//void updateStdString();
private:
Node* parent;
std::list<Node*> children;
/* Extra details */
char letter;
int depth;
/* Bool */
bool isLetter;
bool isCut;
bool isRoot;
/* Standardization */
std::string stdString;
};
#endif // NODE_H