Search in sources :

Example 1 with SumStatistic

use of dr.inference.model.SumStatistic in project beast-mcmc by beast-dev.

the class SumStatisticParser method parseXMLObject.

public Object parseXMLObject(XMLObject xo) throws XMLParseException {
    boolean elementwise = xo.getAttribute(ELEMENTWISE, false);
    boolean absolute = xo.getAttribute(ABSOLUTE, false);
    String name = SUM_STATISTIC;
    if (xo.hasAttribute(Statistic.NAME)) {
        name = xo.getAttribute(Statistic.NAME, xo.getId());
    } else if (xo.hasAttribute(XMLParser.ID)) {
        name = xo.getAttribute(XMLParser.ID, xo.getId());
    }
    final SumStatistic sumStatistic = new SumStatistic(name, elementwise, absolute);
    for (int i = 0; i < xo.getChildCount(); i++) {
        final Statistic statistic = (Statistic) xo.getChild(i);
        try {
            sumStatistic.addStatistic(statistic);
        } catch (IllegalArgumentException iae) {
            throw new XMLParseException("Statistic added to " + getParserName() + " element is not of the same dimension");
        }
    }
    return sumStatistic;
}
Also used : Statistic(dr.inference.model.Statistic) SumStatistic(dr.inference.model.SumStatistic) SumStatistic(dr.inference.model.SumStatistic)

Aggregations

Statistic (dr.inference.model.Statistic)1 SumStatistic (dr.inference.model.SumStatistic)1