@Override public Variable getVariableInstance() { Model m = getModel(); return m != null ? m.findVariable(variableID) : null; }
@Override public boolean isSetVariableInstance() { Model m = getModel(); return m != null ? m.findVariable(variableID) != null : false; }
/** * * @return the UnitDefinition instance which matches the unitsID of this * object. * @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. */ @Override @Deprecated public UnitDefinition getUnitsInstance() { Model model = getModel(); return model != null ? model.getUnitDefinition(unitsID) : null; }
/** * * @return {@code true} if the UnitsID of this object matches a no null * UniDefinition of the model instance. * @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. */ @Override @Deprecated public boolean isSetUnitsInstance() { Model model = getModel(); return model != null ? model.getUnitDefinition(unitsID) != null : false; }
@Override @Deprecated public void setUnits(Unit unit) { UnitDefinition ud = new UnitDefinition(unit.getKind().toString(), getLevel(), getVersion()); ud.addUnit(unit); if ((unit.getExponent() != 1) || (unit.getScale() != 0) || (unit.getMultiplier() != 1d) || (unit.getOffset() != 0d)) { StringBuilder sb = new StringBuilder(); sb.append(unit.getMultiplier()); sb.append('_'); sb.append(unit.getScale()); sb.append('_'); sb.append(unit.getKind().toString()); sb.append('_'); sb.append(unit.getExponent()); ud.setId(sb.toString()); Model m = getModel(); if (m != null) { m.addUnitDefinition(ud); } } setUnits(ud); }
@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; } };