| 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.app.treestat.statistics; |
| 27 |
|
| 28 |
import dr.evolution.tree.Tree; |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
public class TreeHeight extends AbstractTreeSummaryStatistic { |
| 37 |
|
| 38 |
private TreeHeight() { } |
| 39 |
|
| 40 |
public double[] getSummaryStatistic(Tree tree) { |
| 41 |
|
| 42 |
return new double[] { tree.getNodeHeight(tree.getRoot()) }; |
| 43 |
} |
| 44 |
|
| 45 |
public String getSummaryStatisticName() { return FACTORY.getSummaryStatisticName(); } |
| 46 |
public String getSummaryStatisticDescription() { return FACTORY.getSummaryStatisticDescription(); } |
| 47 |
public String getSummaryStatisticReference() { return FACTORY.getSummaryStatisticReference(); } |
| 48 |
public boolean allowsPolytomies() { return FACTORY.allowsPolytomies(); } |
| 49 |
public boolean allowsNonultrametricTrees() { return FACTORY.allowsNonultrametricTrees(); } |
| 50 |
public boolean allowsUnrootedTrees() { return FACTORY.allowsUnrootedTrees(); } |
| 51 |
public Category getCategory() { return FACTORY.getCategory(); } |
| 52 |
|
| 53 |
public static final Factory FACTORY = new Factory() { |
| 54 |
|
| 55 |
public TreeSummaryStatistic createStatistic() { |
| 56 |
return new TreeHeight(); |
| 57 |
} |
| 58 |
|
| 59 |
public String getSummaryStatisticName() { |
| 60 |
return "Tree Height"; |
| 61 |
} |
| 62 |
|
| 63 |
public String getSummaryStatisticDescription() { |
| 64 |
|
| 65 |
return "The height of the root of the tree."; |
| 66 |
} |
| 67 |
|
| 68 |
public String getSummaryStatisticReference() { |
| 69 |
|
| 70 |
return "-"; |
| 71 |
} |
| 72 |
|
| 73 |
public boolean allowsPolytomies() { return true; } |
| 74 |
|
| 75 |
public boolean allowsNonultrametricTrees() { return true; } |
| 76 |
|
| 77 |
public boolean allowsUnrootedTrees() { return false; } |
| 78 |
|
| 79 |
public Category getCategory() { return Category.GENERAL; } |
| 80 |
}; |
| 81 |
} |