@Override public boolean register(SBase sbase) { boolean success = true; if (sbase instanceof Port) { Port port = (Port) sbase; if (port.isSetId()) { String portId = port.getId(); if (mapOfPorts == null) { mapOfPorts = new HashMap<String, Port>(); } if (mapOfPorts.containsKey(portId) && mapOfPorts.get(portId) != sbase) { logger.error(MessageFormat.format( "A Port with the id \"{0}\" is already present in this model {1}. The new element will not be added to the model.", portId, (isSetExtendedSBase() ? ((Model) getExtendedSBase()).getId() : ""))); success = false; } else { mapOfPorts.put(portId, port); if (logger.isDebugEnabled()) { logger.debug(MessageFormat.format("registered port id={0} in model {1}", portId, (isSetExtendedSBase() ? ((Model) getExtendedSBase()).getId() : ""))); } } } } else { logger.error(MessageFormat.format( "Trying to register something that is not a Port: \"{0}\".", sbase)); } // TODO : register all the Port children if any !! return success; }
/** * Sets the variableID of this EventAssignment to 'variable'. If 'variable' * doesn't match any id of Compartment , Species, SpeciesReference or * Parameter in Model, an {@link IllegalArgumentException} is thrown. * * @param variable * @throws IllegalArgumentException */ public void checkAndSetVariable(String variable) { Model m = getModel(); if (m != null) { Variable nsb = getModel().findVariable(variable); if (nsb == null) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Assignment.NO_SUCH_VARIABLE_EXCEPTION_MSG"), m.getId(), variable)); } setVariable(nsb); } else { throw new NullPointerException(JSBML.UNDEFINED_MODEL_MSG); } }
logger.warn(MessageFormat.format( "No Port have been registered in this model {0}. Nothing to be done.", (isSetExtendedSBase() ? ((Model) getExtendedSBase()).getId() : ""))); return success; portId, (isSetExtendedSBase() ? ((Model) getExtendedSBase()).getId() : ""))); portId, (isSetExtendedSBase() ? ((Model) getExtendedSBase()).getId() : "")));
@Override public boolean register(SBase sbase) { boolean success = true; if (sbase instanceof SpatialNamedSBase) { SpatialNamedSBase spatialSBase = (SpatialNamedSBase) sbase; if (spatialSBase.isSetSpatialId()) { String id = spatialSBase.getSpatialId(); if (spatialIdMap == null) { spatialIdMap = new HashMap<String, SpatialNamedSBase>(); } if (spatialIdMap.containsKey(id)) { logger.error(MessageFormat.format( "The spatial id \"{0}\" is already present in the spatial model assigned to the model {1}. The new element will not be added to the model.", id, (isSetExtendedSBase() ? getExtendedSBase().getId() : ""))); success = false; } else { spatialIdMap.put(id, spatialSBase); if (logger.isDebugEnabled()) { logger.debug(MessageFormat.format("registered spatial id={0} in {1}", id, (isSetExtendedSBase() ? getExtendedSBase().getElementName() : ""))); } } } } else { logger.error(MessageFormat.format( "Trying to register something that does not have a spatialId: \"{0}\".", sbase)); } // Register all spatial model children if any return success; }
/** * Sets the variableID of this {@link InitialAssignment} to 'variable'. If this * variableID doesn't match any {@link Variable} id in {@link Model} ( * {@link Compartment}, {@link Species}, {@link SpeciesReference}, or * {@link Parameter}), an {@link IllegalArgumentException} is thrown. * * @param variable * the symbol to set */ public void checkAndSetVariable(String variable) { Variable nsb = null; Model m = getModel(); if (m != null) { nsb = m.findVariable(variable); } if (nsb == null) { throw new IllegalArgumentException(MessageFormat.format( resourceBundle.getString("Assignment.NO_SUCH_VARIABLE_EXCEPTION_MSG"), m.getId(), variable)); } setVariable(nsb.getId()); }
id, (isSetExtendedSBase() ? getExtendedSBase().getId() : "")));
private void flattenSBaseList(Model modelOfSubmodel, ListOf listOfSBase){ ListOf<SBase> list = (ListOf<SBase>) listOfSBase; for(SBase sBase : list){ if (!sBase.getId().equals("")) { sBase.setId(modelOfSubmodel.getId() + sBase.getId()); } if (!sBase.getMetaId().equals("")) { sBase.setMetaId(modelOfSubmodel.getId() + sBase.getMetaId()); } if(sBase.isPackageEnabled(CompConstants.shortLabel)){ CompSBasePlugin compSBasePlugin = (CompSBasePlugin) sBase.getExtension(CompConstants.shortLabel); CompModelPlugin compModelPlugin = (CompModelPlugin) modelOfSubmodel.getExtension(CompConstants.shortLabel); replaceElementsInModelDefinition(compModelPlugin,compSBasePlugin); } //sBase.unsetPlugin(CompConstants.shortLabel); } }
ValidationConstraint.logError(ctx, CORE_10313, m, m.getSubstanceUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10313, m, m.getVolumeUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10313, m, m.getAreaUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10313, m, m.getLengthUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10313, m, m.getTimeUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10313, m, m.getExtentUnits(), m.getElementName(), m.getId()); isCheckValid = false;
ValidationConstraint.logError(ctx, CORE_10311, m, m.getSubstanceUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, invalidUnits, m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, m.getVolumeUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, invalidUnits, m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, m.getAreaUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, invalidUnits, m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, m.getLengthUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, invalidUnits, m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, m.getTimeUnits(), m.getElementName(), m.getId()); isCheckValid = false; ValidationConstraint.logError(ctx, CORE_10311, m, invalidUnits, m.getElementName(), m.getId()); isCheckValid = false;