@Override public boolean setCompartment(String compartment) { if ((compartment != null) && (compartment.trim().length() == 0)) { compartment = null; // If we pass the empty String or null, the value is reset. } // TODO - do a call to the offline validator once all the species attribute checks are in place. if (!isReadingInProgress() && compartment != null) { // This method will throw IllegalArgumentException if the given id does not respect the SId syntax checkIdentifier(compartment); } String oldCompartment = compartmentID; compartmentID = compartment; firePropertyChange(TreeNodeChangeEvent.compartment, oldCompartment, compartmentID); return true; }
/** * Sets hasOnlySubstanceUnits Boolean * * @param hasOnlySubstanceUnits the has only substance units value to be set * @throws PropertyNotAvailableException if Level < 2. */ public void setHasOnlySubstanceUnits(boolean hasOnlySubstanceUnits) { if (!isReadingInProgress() && getLevel() < 2) { throw new PropertyNotAvailableException( TreeNodeChangeEvent.hasOnlySubstanceUnits, this); } if (!isReadingInProgress() && hasOnlySubstanceUnits && isSetSpatialSizeUnits()) { String ud = isSetUnitsInstance() ? UnitDefinition.printUnits( getSpatialSizeUnitsInstance(), true) : getSpatialSizeUnits(); throw new SBMLException(MessageFormat.format( "Cannot define that species {0} with spatial size units {1} has only substance units.", toString(), ud)); } Boolean oldHasOnlySubstanceUnits = this.hasOnlySubstanceUnits; this.hasOnlySubstanceUnits = Boolean.valueOf(hasOnlySubstanceUnits); isSetHasOnlySubstanceUnits = true; firePropertyChange(TreeNodeChangeEvent.hasOnlySubstanceUnits, oldHasOnlySubstanceUnits, this.hasOnlySubstanceUnits); }
if (!isReadingInProgress() && (getLevel() != 2) && ((1 != getVersion()) || (2 != getVersion()))) { throw new PropertyNotAvailableException( TreeNodeChangeEvent.spatialSizeUnits, this); if (!isReadingInProgress() && hasOnlySubstanceUnits()) { throw new SBMLException(MessageFormat.format( "Cannot set spatial size units on species {0} because it has only substance units.", if (!isReadingInProgress() && (c != null) && (c.getSpatialDimensions() == 0d)) {
/** * Sets the initialAmount of this {@link Species}. * * @param initialAmount the initial amount */ public void setInitialAmount(double initialAmount) { // store initialConcentration in user define object to allow validation of incorrect SBML files if (isReadingInProgress() && isSetInitialConcentration()) { // TODO - replace by processInvalidAttribute and change the corresponding rule(s) AbstractReaderWriter.processUnknownAttribute("initialConcentration", "", getInitialConcentration() + "", "", this); } if (!amount) { amount = true; firePropertyChange(TreeNodeChangeEvent.initialAmount, Boolean.FALSE, Boolean.TRUE); } setValue(initialAmount); }
/** * Sets the initialConcentration of this {@link Species}. * * @param initialConcentration the initial concentration */ public void setInitialConcentration(double initialConcentration) { // store initialAmount in user define object to allow validation of incorrect SBML files if (isReadingInProgress() && isSetInitialAmount()) { // TODO - replace by processInvalidAttribute and change the corresponding rule(s) AbstractReaderWriter.processUnknownAttribute("initialAmount", "", getInitialAmount() + "", "", this); } if (amount) { amount = false; firePropertyChange(TreeNodeChangeEvent.initialAmount, Boolean.TRUE, Boolean.FALSE); } setValue(initialConcentration); }