@Override public String getVariable() { return isSetVariable() ? variableID : ""; }
@Override public boolean isCompartmentVolume() { return isSetVariable() && (getVariableInstance() instanceof Compartment); }
@Override public int hashCode() { final int prime = 919; int hashCode = super.hashCode(); if (isSetVariable()) { hashCode += prime * getVariable().hashCode(); } if (isSetUnits()) { hashCode += prime * getUnits().hashCode(); } return hashCode; }
@Override public boolean equals(Object object) { boolean equals = super.equals(object); if (equals) { ExplicitRule r = (ExplicitRule) object; equals &= isSetVariable() == r.isSetVariable(); if (equals && isSetVariable()) { equals &= getVariable().equals(r.getVariable()); } equals &= isSetUnits() == r.isSetUnits(); if (equals && isSetUnits()) { equals &= getUnits().equals(r.getUnits()); } } return equals; }
/** * 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); }
/** * Creates a new {@link ExplicitRule} * * @param rule */ public ExplicitRule(ExplicitRule rule) { super(rule); initDefaults(); if (rule.isSetVariable()) { setVariable(new String(rule.getVariable())); } if (rule.isSetUnits()) { setUnits(new String(rule.getUnits())); } }
Map<String, String> attributes = super.writeXMLAttributes(); if (isSetVariable()) { if (getLevel() > 1) { attributes.put("variable", getVariable());
@Override public boolean check(ValidationContext ctx, ExplicitRule r) { Model m = r.getModel(); String var = r.getVariable(); if (r.isSetVariable() && m != null) { Compartment c = m.getCompartment(var); if (c != null && c.isSetSpatialDimensions() && c.getSpatialDimensions() == 0) { ValidationConstraint.logError(ctx, CORE_20911, r, r.getElementName(), r.getVariable()); return false; } } return true; } };