/** * 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); }
} else if (isCompartmentVolume()) { attributes.put("compartment", getVariable()); } else if (isParameter()) { attributes.put("name", getVariable());
@Override public void writeElement(SBMLObjectForXML xmlObject, Object sbmlElementToWrite) { if (sbmlElementToWrite instanceof SBase) { SBase sbase = (SBase) sbmlElementToWrite; if (logger.isDebugEnabled()) { logger.debug(MessageFormat.format("writeElement: {0}", sbase.getElementName())); } // dealing with level 1 rules if (sbase.getLevel() == 1 && sbase instanceof ExplicitRule) { ExplicitRule rule = (ExplicitRule) sbase; if (rule.isSpeciesConcentration()) { if (rule.getVersion() == 1) { xmlObject.setName("specieConcentrationRule"); } else { xmlObject.setName("speciesConcentrationRule"); } } else if (rule.isCompartmentVolume()) { xmlObject.setName("compartmentVolumeRule"); } else if (rule.isParameter()) { xmlObject.setName("parameterRule"); } } if (!xmlObject.isSetName()) { xmlObject.setName(sbase.getElementName()); } } }