Debian Codegraph @

src/dr/app/treestat/statistics/TreeHeight.java

raw symbols SCIP
1 /*
2 * TreeHeight.java
3 *
4 * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard
5 *
6 * This file is part of BEAST.
7 * See the NOTICE file distributed with this work for additional
8 * information regarding copyright ownership and licensing.
9 *
10 * BEAST is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU Lesser General Public License as
12 * published by the Free Software Foundation; either version 2
13 * of the License, or (at your option) any later version.
14 *
15 * BEAST is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License for more details.
19 *
20 * You should have received a copy of the GNU Lesser General Public
21 * License along with BEAST; if not, write to the
22 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
23 * Boston, MA 02110-1301 USA
24 */
25
26 package dr.app.treestat.statistics;
27
28 import dr.evolution.tree.Tree;
29
30 /**
31 *
32 * @version $Id: TreeHeight.java,v 1.2 2005/09/28 13:50:56 rambaut Exp $
33 *
34 * @author Alexei Drummond
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 }