1 | // Node.java |
---|
2 | // |
---|
3 | // (c) 1999-2001 PAL Development Core Team |
---|
4 | // |
---|
5 | // This package may be distributed under the |
---|
6 | // terms of the Lesser GNU General Public License (LGPL) |
---|
7 | |
---|
8 | |
---|
9 | package de.ugoe.cs.autoquest.tasktrees.alignment.pal.tree; |
---|
10 | |
---|
11 | |
---|
12 | import java.util.ArrayList; |
---|
13 | |
---|
14 | import de.ugoe.cs.autoquest.tasktrees.alignment.algorithms.NumberSequence; |
---|
15 | import de.ugoe.cs.autoquest.tasktrees.alignment.pal.misc.Identifier; |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | /** |
---|
20 | * interface for a node (includes branch) in a binary/non-binary |
---|
21 | * rooted/unrooted tree |
---|
22 | * |
---|
23 | * @version $Id: Node.java,v 1.20 2001/11/20 07:35:44 matt Exp $ |
---|
24 | * |
---|
25 | * @author Alexei Drummond |
---|
26 | * @author Korbinian Strimmer |
---|
27 | * |
---|
28 | */ |
---|
29 | |
---|
30 | public interface Node { |
---|
31 | |
---|
32 | /** Returns the parent node of this node. */ |
---|
33 | Node getParent(); |
---|
34 | |
---|
35 | /** Set the parent node of this node. */ |
---|
36 | void setParent(Node node); |
---|
37 | |
---|
38 | /** Returns the sequence at this node */ |
---|
39 | NumberSequence getSequence(int index); |
---|
40 | |
---|
41 | /** Sets the sequence using an array of bytes. */ |
---|
42 | void setSequence(int index,NumberSequence seq); |
---|
43 | |
---|
44 | /** return the index of this node */ |
---|
45 | int getNumber(); |
---|
46 | |
---|
47 | /** set the index of this node */ |
---|
48 | void setNumber(int number); |
---|
49 | |
---|
50 | /** Get the length of the branch attaching this node to its parent. */ |
---|
51 | double getBranchLength(); |
---|
52 | |
---|
53 | /** Set the length of the branch attaching this node to its parent. */ |
---|
54 | void setBranchLength(double value); |
---|
55 | |
---|
56 | /** Get the length SE of the branch attaching this node to its parent. */ |
---|
57 | double getBranchLengthSE(); |
---|
58 | |
---|
59 | /** Set the length SE of the branch attaching this node to its parent. */ |
---|
60 | void setBranchLengthSE(double value); |
---|
61 | |
---|
62 | /** Get the height of this node relative to the most recent node. */ |
---|
63 | double getNodeHeight(); |
---|
64 | |
---|
65 | /** Set the height of this node relative to the most recent node. */ |
---|
66 | void setNodeHeight(double value); |
---|
67 | |
---|
68 | /** Returns the identifier for this node. */ |
---|
69 | Identifier getIdentifier(); |
---|
70 | |
---|
71 | /** Set identifier for this node. */ |
---|
72 | Identifier setIdentifier(Identifier id); |
---|
73 | |
---|
74 | /** |
---|
75 | * Returns the number of children this node has. |
---|
76 | */ |
---|
77 | int getChildCount(); |
---|
78 | |
---|
79 | /** |
---|
80 | * check whether this node is an external node |
---|
81 | * |
---|
82 | * @return result (true or false) |
---|
83 | */ |
---|
84 | boolean isLeaf(); |
---|
85 | |
---|
86 | /** |
---|
87 | * check whether this node is a root node |
---|
88 | * |
---|
89 | * @return result (true or false) |
---|
90 | */ |
---|
91 | boolean isRoot(); |
---|
92 | |
---|
93 | /** |
---|
94 | * get child node |
---|
95 | * |
---|
96 | * @param n number of child |
---|
97 | * |
---|
98 | * @return child node |
---|
99 | */ |
---|
100 | Node getChild(int n); |
---|
101 | |
---|
102 | /** |
---|
103 | * set child node |
---|
104 | * |
---|
105 | * @param n number |
---|
106 | * @node node new child node |
---|
107 | */ |
---|
108 | void setChild(int n, Node node); |
---|
109 | |
---|
110 | /** |
---|
111 | * add new child node |
---|
112 | * |
---|
113 | * @param c new child node |
---|
114 | */ |
---|
115 | void addChild(Node c); |
---|
116 | |
---|
117 | /** |
---|
118 | * add new child node (insertion at a specific position) |
---|
119 | * |
---|
120 | * @param c new child node |
---|
121 | + @param pos position |
---|
122 | */ |
---|
123 | void insertChild(Node c, int pos); |
---|
124 | |
---|
125 | |
---|
126 | /** |
---|
127 | * remove child |
---|
128 | * |
---|
129 | * @param n number of child to be removed |
---|
130 | */ |
---|
131 | Node removeChild(int n); |
---|
132 | |
---|
133 | |
---|
134 | ArrayList<NumberSequence> getSequences(); |
---|
135 | |
---|
136 | Node joinChildren( int n1, int n2); |
---|
137 | |
---|
138 | void addSequence(NumberSequence numberSequence); |
---|
139 | |
---|
140 | void setSequences(ArrayList<NumberSequence> alignSequences); |
---|
141 | |
---|
142 | |
---|
143 | |
---|
144 | |
---|
145 | |
---|
146 | |
---|
147 | } |
---|