Debian Codegraph @

src/dr/evomodel/antigenic/phyloclustering/statistics/indicatorsStatistic.java

raw symbols SCIP
1 package dr.evomodel.antigenic.phyloclustering.statistics;
2
3 import dr.inference.model.Parameter;
4 import dr.inference.model.*;
5 import dr.xml.*;
6
7
8 /**
9 * @author Charles Cheung
10 * @author Trevor Bedford
11 */
12
13 public class indicatorsStatistic extends Statistic.Abstract implements VariableListener {
14
15 private Parameter indicators;
16
17 public static final String INDICATORS_STATISTIC = "indicatorsStatistic";
18
19 public indicatorsStatistic( Parameter indicators) {
20 this.indicators = indicators;
21 indicators.addParameterListener(this);
22 }
23
24
25
26 public int getDimension() {
27 return indicators.getDimension();
28 }
29
30
31
32 //assume print in order... so before printing the first number,
33 //determine all the nodes that are active.
34 public double getStatisticValue(int dim) {
35 return ( indicators.getParameterValue(dim) );
36
37 }
38
39
40
41
42
43
44 public String getDimensionName(int dim) {
45 String name = "indicators_" + dim ;
46 return name;
47 }
48
49 public void variableChangedEvent(Variable variable, int index, Parameter.ChangeType type) {
50 // do nothing
51 //System.out.println("hi got printed");
52 }
53
54 public static XMLObjectParser PARSER = new AbstractXMLObjectParser() {
55
56 public final static String INDICATORS_STRING = "indicators";
57
58 public String getParserName() {
59 return INDICATORS_STATISTIC;
60 }
61
62 public Object parseXMLObject(XMLObject xo) throws XMLParseException {
63
64 Parameter indicators = (Parameter) xo.getElementFirstChild(INDICATORS_STRING);
65
66 return new indicatorsStatistic( indicators);
67
68 }
69
70 //************************************************************************
71 // AbstractXMLObjectParser implementation
72 //************************************************************************
73
74 public String getParserDescription() {
75 return "This element returns a statistic that shifts a matrix of locations by location drift in the first dimension.";
76 }
77
78 public Class getReturnType() {
79 return indicatorsStatistic.class;
80 }
81
82 public XMLSyntaxRule[] getSyntaxRules() {
83 return rules;
84 }
85
86 private XMLSyntaxRule[] rules = new XMLSyntaxRule[]{
87 new ElementRule(INDICATORS_STRING, Parameter.class)
88
89 };
90 };
91
92
93
94 }