use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ExpansionModelParser 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(ANCESTRAL_POPULATION_PROPORTION);
Parameter N1Param = (Parameter) cxo.getChild(Parameter.class);
Parameter rParam;
boolean usingGrowthRate = true;
if (xo.getChild(GROWTH_RATE) != null) {
cxo = xo.getChild(GROWTH_RATE);
rParam = (Parameter) cxo.getChild(Parameter.class);
} else {
cxo = xo.getChild(DOUBLING_TIME);
rParam = (Parameter) cxo.getChild(Parameter.class);
usingGrowthRate = false;
}
return new ExpansionModel(N0Param, N1Param, rParam, units, usingGrowthRate);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ConstantExponentialModelParser 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_PHASE_START_TIME);
Parameter timeParam = (Parameter) cxo.getChild(Parameter.class);
Parameter rParam;
boolean usingGrowthRate = true;
if (xo.getChild(GROWTH_RATE) != null) {
cxo = xo.getChild(GROWTH_RATE);
rParam = (Parameter) cxo.getChild(Parameter.class);
} else {
cxo = xo.getChild(DOUBLING_TIME);
rParam = (Parameter) cxo.getChild(Parameter.class);
usingGrowthRate = false;
}
return new ConstantExponentialModel(N0Param, timeParam, rParam, units, usingGrowthRate);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ConstantPopulationModelParser 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);
return new ConstantPopulationModel(N0Param, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class ExponentialSawtoothModelParser 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);
cxo = xo.getChild(WAVELENGTH);
Parameter wavelengthParam = (Parameter) cxo.getChild(Parameter.class);
cxo = xo.getChild(OFFSET);
Parameter tParam = (Parameter) cxo.getChild(Parameter.class);
return new ExponentialSawtoothModel(N0Param, rParam, wavelengthParam, tParam, units);
}
use of dr.evolution.util.Units in project beast-mcmc by beast-dev.
the class SamplesPanel method timeScaleChanged.
public final void timeScaleChanged() {
Units.Type units = Units.Type.YEARS;
switch(unitsCombo.getSelectedIndex()) {
case 0:
units = Units.Type.YEARS;
break;
case 1:
units = Units.Type.MONTHS;
break;
case 2:
units = Units.Type.DAYS;
break;
}
boolean backwards = directionCombo.getSelectedIndex() == 1;
for (int i = 0; i < taxonList.getTaxonCount(); i++) {
Date date = taxonList.getTaxon(i).getDate();
double d = date.getTimeValue();
Date newDate = createDate(d, units, backwards, 0.0);
newDate.setPrecision(date.getPrecision());
taxonList.getTaxon(i).setDate(newDate);
}
calculateHeights();
dataTableModel.fireTableDataChanged();
frame.timeScaleChanged();
}
Aggregations