@Override public void unsetVariable() { String oldVariableID = variableID; variableID = null; firePropertyChange(TreeNodeChangeEvent.variable, oldVariableID, variableID); }
/** * Unsets the unitsID of this {@link ExplicitRule}. * * @deprecated This is a requirement for Level 1 Version 1 and Version 2, * but can only be used in conjunction with {@link Parameter}s. * In this case this {@link ExplicitRule} represents the SBML * element ParameterRule. */ @Override @Deprecated public void unsetUnits() { String oldUnitsID = unitsID; unitsID = null; firePropertyChange(TreeNodeChangeEvent.units, oldUnitsID, unitsID); }
@Override public void setVariable(String variable) { // checkAndSetVariable(variable); // We cannot use that as the Object might not be defined yet in L3. if (variable != null && variable.trim().length() == 0) { variable = null; } if (!isReadingInProgress() && variable != null) { // This method will throw IllegalArgumentException if the given id does not respect the SId syntax checkIdentifier(variable); } String oldVariable = variableID; variableID = variable; firePropertyChange(TreeNodeChangeEvent.variable, oldVariable, variableID); }
/** * Sets the unitsID to 'unitsID'. * * @param unitsID * A valid identifier of a {@link UnitDefinition} in the * {@link Model} or the name of one of the {@link Unit.Kind} base * types. * @deprecated This is a requirement for Level 1 Version 1 and Version 2, * but can only be used in conjunction with {@link Parameter}s. * In this case this {@link AssignmentRule} represents the SBML * element ParameterRule. * @throws PropertyNotAvailableException if Level is not 1. */ @Override @Deprecated public void setUnits(String unitsID) { if (getLevel() != 1) { throw new PropertyNotAvailableException(TreeNodeChangeEvent.units, this); } if (isSetVariable() && !isParameter()) { throw new IllegalArgumentException(MessageFormat.format( "Cannot set unit {0} for a variable other than parameter", unitsID)); } String oldUnitsID = this.unitsID; this.unitsID = unitsID; firePropertyChange(TreeNodeChangeEvent.units, oldUnitsID, unitsID); }
@Override public void setVariable(Variable variable) { if (variable != null) { if (variable.isConstant()) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Assignment.ILLEGAL_CONSTANT_VARIABLE_MSG"), variable.getId(), getElementName())); } if (isSetUnits() && !(variable instanceof Parameter)) { throw new IllegalArgumentException(MessageFormat.format( "Variable expected to be an instance of Parameter because a Unit attribute is set already, but given is an instance of {0}.", variable.getElementName())); } if ((getLevel() < 3) && (variable instanceof SpeciesReference)) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Assignment.ILLEGAL_VARIABLE_EXCEPTION_MSG"), variable.getId(), getElementName())); } if (variable.isSetId()) { String oldVariable = variableID; variableID = variable.getId(); firePropertyChange(TreeNodeChangeEvent.variable, oldVariable, variableID); } else { unsetVariable(); } } else { unsetVariable(); } }