use of dr.evomodel.coalescent.CataclysmicDemographicModel in project beast-mcmc by beast-dev.
the class CataclysmicDemographicModelParser method parseXMLObject.
public Object parseXMLObject(XMLObject xo) throws XMLParseException {
Units.Type units = XMLUnits.Utils.getUnitsAttr(xo);
XMLObject cxo = xo.getChild(POPULATION_SIZE);
Parameter N0Param = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(GROWTH_RATE);
Parameter rParam = (Parameter) cxo.getChild(Parameter.class);
Parameter secondParam = null;
boolean useSpike = true;
if (xo.hasChildNamed(SPIKE_SIZE)) {
cxo = xo.getChild(SPIKE_SIZE);
secondParam = (Parameter) cxo.getChild(Parameter.class);
} else if (xo.hasChildNamed(DECLINE_RATE)) {
cxo = xo.getChild(DECLINE_RATE);
secondParam = (Parameter) cxo.getChild(Parameter.class);
useSpike = false;
} else {
throw new XMLParseException("Must provide either a spike factor or decline rate");
}
cxo = xo.getChild(TIME_OF_CATACLYSM);
Parameter tParam = (Parameter) cxo.getChild(Parameter.class);
return new CataclysmicDemographicModel(N0Param, secondParam, rParam, tParam, units, useSpike);
}
Aggregations