use of dr.evomodel.tree.TMRCAStatistic in project beast-mcmc by beast-dev.
the class TMRCAStatisticParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
String name = xo.getAttribute(Statistic.NAME, xo.getId());
Tree tree = (Tree) xo.getChild(Tree.class);
TaxonList taxa = null;
if (xo.hasChildNamed(MRCA)) {
taxa = (TaxonList) xo.getElementFirstChild(MRCA);
}
boolean isAbsolute = xo.getAttribute(ABSOLUTE, false);
boolean includeStem = false;
if (xo.hasAttribute(PARENT) && xo.hasAttribute(STEM)) {
throw new XMLParseException("Please use either " + PARENT + " or " + STEM + "!");
} else if (xo.hasAttribute(PARENT)) {
includeStem = xo.getBooleanAttribute(PARENT);
} else if (xo.hasAttribute(STEM)) {
includeStem = xo.getBooleanAttribute(STEM);
}
try {
return new TMRCAStatistic(name, tree, taxa, isAbsolute, includeStem);
} catch (TreeUtils.MissingTaxonException mte) {
throw new XMLParseException("Taxon, " + mte + ", in " + getParserName() + "was not found in the tree.");
}
}
Aggregations