]> git.donarmstrong.com Git - mothur.git/blob - treenode.h
When Pat tried to compile mothur in Ubuntu linux, there were a number of minor proble...
[mothur.git] / treenode.h
1 #ifndef TREENODE_H
2 #define TREENODE_H
3
4 /*
5  *  treenode.h
6  *  Mothur
7  *
8  *  Created by Sarah Westcott on 1/23/09.
9  *  Copyright 2009 Schloss Lab UMASS Amherst. All rights reserved.
10  *
11  */
12
13 using namespace std;
14
15 #include <string>
16 #include <iostream>
17 #include <fstream>
18 #include <iomanip>
19 #include <vector>
20
21 /* This class represents a node on a tree. */
22
23
24 class Node  {
25         public:
26                 Node();  //pass it the sequence name
27                 ~Node() {};
28                 
29                 void setName(string);
30                 void setGroup(string);  //non leaf nodes will belong to multiple groups, leaf nodes will only belong to one.
31                 void setBranchLength(float);
32                 void setParent(int);
33                 void setChildren(int, int);             //leftchild, rightchild
34                 void setIndex(int);
35                 
36                 string getName();
37                 vector<string> getGroup();    //leaf nodes will only have 1 group, but branch nodes may have multiple groups.
38                 float getBranchLength();
39                 int getParent();
40                 int getLChild();
41                 int getRChild();
42                 int getIndex();
43                 
44                 void printNode(ostream&);   //prints out the name and the branch length
45                 
46         private:
47                 string                  name;
48                 vector<string>  group;
49                 float                   branchLength;
50                 int                             parent;
51                 int                             lchild;
52                 int                             rchild;
53                 int                             vectorIndex;
54 };              
55
56 #endif