use of org.vcell.model.bngl.BngUnitSystem.TimeUnitSystem in project vcell by virtualcell.
the class BNGLUnitsPanel method getUnits.
public BngUnitSystem getUnits() {
if (getSelectedButtonText(buttonGroup) == null) {
// better to return a default than null
return new BngUnitSystem(BngUnitOrigin.DEFAULT);
}
if (getSelectedButtonText(buttonGroup).equals(concentrations)) {
double volume = Double.parseDouble(cVolumeSize.getText());
ConcUnitSystem cus = ConcUnitSystem.values()[0];
for (ConcUnitSystem s : ConcUnitSystem.values()) {
if (s.description.equals(concentrationUnitsCombo.getSelectedItem().toString())) {
cus = s;
break;
}
}
TimeUnitSystem tus = TimeUnitSystem.values()[0];
for (TimeUnitSystem s : TimeUnitSystem.values()) {
if (s.description.equals(cTimeUnitsCombo.getSelectedItem().toString())) {
tus = s;
break;
}
}
return BngUnitSystem.createAsConcentration(BngUnitOrigin.USER, volume, cus, tus);
} else {
// molecules
// we know for sure it's valid double
double volume = Double.parseDouble(mVolumeSize.getText());
VolumeUnitSystem vus = VolumeUnitSystem.values()[0];
for (VolumeUnitSystem s : VolumeUnitSystem.values()) {
if (s.description.equals(mVolumeUnitsCombo.getSelectedItem().toString())) {
vus = s;
break;
}
}
TimeUnitSystem tus = TimeUnitSystem.values()[0];
for (TimeUnitSystem s : TimeUnitSystem.values()) {
if (s.description.equals(mTimeUnitsCombo.getSelectedItem().toString())) {
tus = s;
break;
}
}
return BngUnitSystem.createAsMolecules(BngUnitOrigin.USER, volume, vus, tus);
}
}
Aggregations