Changeset 1579 for branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/NodeUtils.java
- Timestamp:
- 06/25/14 22:02:05 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ralph/src/main/java/de/ugoe/cs/autoquest/tasktrees/alignment/pal/tree/NodeUtils.java
r1573 r1579 12 12 13 13 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.io.FormattedOutput; 14 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.misc.BranchLimits;15 14 import de.ugoe.cs.autoquest.tasktrees.alignment.pal.misc.Identifier; 16 15 … … 119 118 } 120 119 121 /** 122 * determines branch lengths of this and all descendent nodes 123 * from heights 124 */ 125 public static void heights2Lengths(Node node) { 126 heights2Lengths(node, true); //respect minimum 127 } 128 129 /** 130 * determines branch lengths of this and all descendent nodes 131 * from heights 132 */ 133 public static void heights2Lengths(Node node, boolean respectMinimum) { 134 135 for (int i = 0; i < node.getChildCount(); i++) { 136 heights2Lengths(node.getChild(i)); 137 } 138 139 if (node.isRoot()) { 140 node.setBranchLength(0.0); 141 } 142 else { 143 node.setBranchLength(node.getParent().getNodeHeight() - node.getNodeHeight()); 144 if (respectMinimum && (node.getBranchLength() < BranchLimits.MINARC)) 145 { 146 node.setBranchLength(BranchLimits.MINARC); 147 } 148 } 149 } 150 151 /** 152 * determines branch lengths of this node and its immediate descendent nodes 153 * from heights. 154 */ 155 public static void localHeights2Lengths(Node node, boolean respectMinimum) { 156 157 for (int i = 0; i < node.getChildCount(); i++) { 158 Node child = node.getChild(i); 159 160 child.setBranchLength(node.getNodeHeight() - child.getNodeHeight()); 161 } 162 163 if (node.isRoot()) { 164 node.setBranchLength(0.0); 165 } 166 else { 167 node.setBranchLength(node.getParent().getNodeHeight() - node.getNodeHeight()); 168 if (respectMinimum && (node.getBranchLength() < BranchLimits.MINARC)) 169 { 170 node.setBranchLength(BranchLimits.MINARC); 171 } 172 } 173 } 120 174 121 175 122
Note: See TracChangeset
for help on using the changeset viewer.