| 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 |
package dr.evomodel.treedatalikelihood; |
| 27 |
|
| 28 |
import dr.inference.model.Model; |
| 29 |
|
| 30 |
import java.util.List; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
public interface ProcessOnTreeDelegate { |
| 40 |
|
| 41 |
TreeTraversal.TraversalType getOptimalTraversalType(); |
| 42 |
|
| 43 |
final class BranchOperation { |
| 44 |
public BranchOperation(int branchNumber, double branchLength) { |
| 45 |
this.branchNumber = branchNumber; |
| 46 |
this.branchLength = branchLength; |
| 47 |
} |
| 48 |
|
| 49 |
public int getBranchNumber() { |
| 50 |
return branchNumber; |
| 51 |
} |
| 52 |
|
| 53 |
public double getBranchLength() { |
| 54 |
return branchLength; |
| 55 |
} |
| 56 |
|
| 57 |
public String toString() { |
| 58 |
return branchNumber + ":" + branchLength; |
| 59 |
} |
| 60 |
|
| 61 |
private final int branchNumber; |
| 62 |
private final double branchLength; |
| 63 |
} |
| 64 |
|
| 65 |
final class NodeOperation { |
| 66 |
public NodeOperation(int nodeNumber, int leftChild, int rightChild) { |
| 67 |
this.nodeNumber = nodeNumber; |
| 68 |
this.leftChild = leftChild; |
| 69 |
this.rightChild = rightChild; |
| 70 |
} |
| 71 |
|
| 72 |
public int getNodeNumber() { |
| 73 |
return nodeNumber; |
| 74 |
} |
| 75 |
|
| 76 |
public int getLeftChild() { |
| 77 |
return leftChild; |
| 78 |
} |
| 79 |
|
| 80 |
public int getRightChild() { |
| 81 |
return rightChild; |
| 82 |
} |
| 83 |
|
| 84 |
public String toString() { |
| 85 |
return nodeNumber + "(" + leftChild + "," + rightChild + ")"; |
| 86 |
} |
| 87 |
|
| 88 |
private final int nodeNumber; |
| 89 |
private final int leftChild; |
| 90 |
private final int rightChild; |
| 91 |
} |
| 92 |
|
| 93 |
final class BranchNodeOperation { |
| 94 |
public BranchNodeOperation(int nodeNumber, int parentNumber, double branchLength) { |
| 95 |
this.nodeNumber = nodeNumber; |
| 96 |
this.parentNumber = parentNumber; |
| 97 |
this.branchLength = branchLength; |
| 98 |
} |
| 99 |
|
| 100 |
public int getNodeNumber() { |
| 101 |
return nodeNumber; |
| 102 |
} |
| 103 |
|
| 104 |
public int getParentNumber() { return parentNumber; } |
| 105 |
|
| 106 |
public double getBranchLength() { return branchLength; } |
| 107 |
|
| 108 |
public String toString() { |
| 109 |
return nodeNumber + "(" + parentNumber + "):" + branchLength; |
| 110 |
} |
| 111 |
|
| 112 |
private final int nodeNumber; |
| 113 |
private final int parentNumber; |
| 114 |
private final double branchLength; |
| 115 |
} |
| 116 |
|
| 117 |
final class Utils { |
| 118 |
|
| 119 |
static <T> String toString(List<T> operations) { |
| 120 |
StringBuilder sb = new StringBuilder(); |
| 121 |
for (T op : operations) { |
| 122 |
sb.append(op.toString()).append("\n"); |
| 123 |
} |
| 124 |
return sb.toString(); |
| 125 |
} |
| 126 |
} |
| 127 |
} |