Debian Codegraph @

src/dr/evomodelxml/coalescent/BayesianSkylinePopSizeStatisticParser.java

raw symbols SCIP
1 /*
2 * BayesianSkylinePopSizeStatisticParser.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.evomodelxml.coalescent;
27
28 import dr.evomodel.coalescent.BayesianSkylineLikelihood;
29 import dr.evomodel.coalescent.BayesianSkylinePopSizeStatistic;
30 import dr.xml.AbstractXMLObjectParser;
31 import dr.xml.XMLObject;
32 import dr.xml.XMLParseException;
33 import dr.xml.XMLSyntaxRule;
34
35 /**
36 */
37 public class BayesianSkylinePopSizeStatisticParser extends AbstractXMLObjectParser {
38 public static final String TIME = "time";
39 public static final String BAYESIAN_SKYLINE_POP_SIZE_STATISTIC = "generalizedSkylinePopSizeStatistic";
40
41
42 public String getParserDescription() {
43 return "The pop sizes at the given times";
44 }
45
46 public Class getReturnType() {
47 return BayesianSkylinePopSizeStatistic.class;
48 }
49
50 public XMLSyntaxRule[] getSyntaxRules() {
51 return null;
52 }
53
54 public Object parseXMLObject(XMLObject xo) throws XMLParseException {
55
56 double time = xo.getDoubleAttribute(TIME);
57
58 BayesianSkylineLikelihood bsl =
59 (BayesianSkylineLikelihood) xo.getChild(BayesianSkylineLikelihood.class);
60
61 return new BayesianSkylinePopSizeStatistic(time, bsl);
62 }
63
64 public String getParserName() {
65 return BAYESIAN_SKYLINE_POP_SIZE_STATISTIC;
66 }
67
68 }