/** * @param param the qualifier to set */ public void setParamType(ParameterType param) { this.param = param; if (isSetExtendedSBase()) { extendedSBase.registerChild(param); } }
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); } }
@Override public SBMLDocument getParent() { return (SBMLDocument) getExtendedSBase().getParent(); }
/** * * @param sbase */ public LevelVersionError(SBase sbase) { this(sbase.getElementName(), sbase.getLevel(), sbase.getVersion()); }
packageName = sb.getPackageName(); packageVersion = sb.getPackageVersion(); declaredNamespaces = new TreeMap<String, String>(); if (sb.isSetLevel()) { setLevel(sb.getLevel()); if (sb.isSetVersion()) { setVersion(sb.getVersion()); id = sb.isSetId() ? new String(sb.getId()) : null; name = sb.isSetName() ? new String(sb.getName()) : null; if (sb.isSetSBOTerm()) { sboTerm = sb.getSBOTerm(); } else { sboTerm = -1; if (sb.isSetMetaId()) { metaId = new String(sb.getMetaId()); if (sb.isSetNotes()) { setNotes(sb.getNotes().clone()); if (sb.isSetAnnotation()) { setAnnotation(sb.getAnnotation().clone()); if (sb.isExtendedByOtherPackages()) {
equals &= sbase.isSetMetaId() == isSetMetaId(); if (equals && sbase.isSetMetaId()) { equals &= sbase.getMetaId().equals(getMetaId()); equals &= sbase.isSetId() == isSetId(); if (equals && isSetId()) { equals &= sbase.getId().equals(getId()); equals &= sbase.isSetName() == isSetName(); if (equals && sbase.isSetName()) { equals &= sbase.getName().equals(getName()); equals &= sbase.isSetSBOTerm() == isSetSBOTerm(); if (equals && sbase.isSetSBOTerm()) { equals &= sbase.getSBOTerm() == getSBOTerm(); equals &= sbase.isSetLevelAndVersion() == isSetLevelAndVersion(); if (equals && sbase.isSetLevelAndVersion()) { equals &= sbase.getLevelAndVersion().equals(getLevelAndVersion()); getNamespace() != null ? getNamespace().equals(sbase.getNamespace()) : sbase.getNamespace() == null; if (sbase.getDeclaredNamespaces() != null) { return false; } else if (!declaredNamespaces.equals(sbase.getDeclaredNamespaces())) { return false;
messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, ((Assignment) sbase).getVariable())); } else if (sbase instanceof Trigger || sbase instanceof Delay) { messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, ((Event) sbase.getParent()).getId())); } else { messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, sbase.getId())); if (sbase.isSetId()) { postMessageI18n = getSBMLErrorPostMessageBundle().getString(SBMLErrorPostMessage.DEFAULT_POST_MESSAGE_WITH_ID); messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, sbase.getElementName(), sbase.getId())); else if (sbase.isSetMetaId()) { postMessageI18n = getSBMLErrorPostMessageBundle().getString(SBMLErrorPostMessage.DEFAULT_POST_MESSAGE_WITH_METAID); messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, sbase.getElementName(), sbase.getMetaId())); messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, sbase.getElementName(), ((InitialAssignment) sbase).getVariable())); messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, sbase.getElementName(), ((Assignment) sbase).getVariable())); messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, ((SBase) sbase.getParent()).getId())); messageBuilder.append('\n').append(MessageFormat.format(postMessageI18n, sbase.getElementName())); // TODO - create a better String with the potential attributes or/and the position in the file.
SBase parent = index.getParentSBMLObject().getParentSBMLObject(); ArraysSBasePlugin plugin = (ArraysSBasePlugin) parent.getExtension(ArraysConstants.shortLabel); SBase parents = parent.getParentSBMLObject(); ArraysSBasePlugin parentArraysSBasePlugin = (ArraysSBasePlugin) parents.getExtension(ArraysConstants.shortLabel); parents = parents.getParentSBMLObject();
String about = contextObject.getAnnotation().getAbout(); String metaid = null; if (contextObject.isSetMetaId()) metaid = contextObject.getMetaId(); else if (contextObject.getLevel() > 1) SBMLDocument doc = contextObject.getSBMLDocument(); contextObject.setMetaId(doc != null ? doc.nextMetaId() : null); metaid = contextObject.getMetaId(); contextObject.getAnnotation().setAbout(expectedRDFAbout);
private ConceptClass determineCC(SBase element, TypeOfConcept type) throws PluginConfigurationException { if (element.isSetSBOTerm()) { ConceptClass cc = ccLookup.get(element.getSBOTermID()); if (cc != null) { return cc; } else { log("No translation entry found for: " + element.getSBOTermID()); } } else { log("Element " +element.getMetaId() + "named: \""+ element.getElementName() + "\" is missing an SBO term"); } SBase parent = element.getParentSBMLObject(); ConceptClass parentCC = null; if (parent != null && (parent.isSetSBOTerm())) { parentCC = determineCC(parent, type); } return mdu.safeFetchConceptClass(type.getId(), type.getDescription(), parentCC); }
/** * Checks if adding an {@link Index} object to a parent * {@link SBase} object for referencing another {@link SBase} object does not * cause out-of-bounds issues. * * @param model * @param parent * @param refAttribute * @param math * @param arrayDim * @return */ public static boolean evaluateIndexBounds(Model model, SBase parent, String refAttribute, ASTNode math, int arrayDim) { String refId = parent.writeXMLAttributes().get(refAttribute); SBase reference = model.findNamedSBase(refId); ArraysSBasePlugin arraysSBasePlugin = (ArraysSBasePlugin) parent.getExtension(ArraysConstants.shortLabel); ArraysSBasePlugin parentArraysSBasePlugin = (ArraysSBasePlugin) parent.getParentSBMLObject().getExtension(ArraysConstants.shortLabel); ArraysSBasePlugin refSbasePlugin = (ArraysSBasePlugin) reference.getExtension(ArraysConstants.shortLabel); Dimension dimByArrayDim = refSbasePlugin.getDimensionByArrayDimension(arrayDim); if (dimByArrayDim == null) { return false; } Map<String, Double> dimensionSizes = getDimensionSizes(model, arraysSBasePlugin); if (parentArraysSBasePlugin != null) { dimensionSizes.putAll(getDimensionSizes(model,parentArraysSBasePlugin)); } Map<String, Double> refSBaseSizes = getDimensionSizes(model, refSbasePlugin); double size = refSBaseSizes.get(dimByArrayDim.getId()); return evaluateBounds(dimensionSizes, math, size); }
if (child instanceof SBase) { SBase sbase = ((SBase) child); ArraysSBasePlugin arraysPlugin = (ArraysSBasePlugin) sbase.getExtension(ArraysConstants.shortLabel); sbase.unsetExtension(ArraysConstants.shortLabel); return false; expandDim(model, (NamedSBase)sbase.clone(), sbase.getParentSBMLObject(), arraysPlugin, compiler, idToVector.get(((NamedSBase) child).getId()), dim, idToVector, indices); } else { expandDim(model, sbase.clone(), sbase.getParentSBMLObject(), arraysPlugin, compiler, dim, idToVector, indices); sbase.removeFromParent();
elementName = getExtendedSBase().getElementName(); } else if (getExtendedSBase().isSetMetaId()) { elementId = "metaid[" + getExtendedSBase().getMetaId() + "]"; id, (isSetExtendedSBase() ? getExtendedSBase().getElementName() : "")));
/** * @param id * the identifier to be set for the new {@link Member}, can be * {@code null}. * @param sbase * the element that should be referenced as a new member of this * {@link Group}. * @return the newly created {@link Member} or {@code null} if the given * {@link SBase} neither has a metaId nor an id. */ public Member createMember(String id, SBase sbase) { if (sbase.isSetId()) { return createMemberWithIdRef(id, sbase.getId()); } if (sbase.isSetMetaId()) { return createMemberWithMetaIdRef(id, sbase.getMetaId()); } return null; }
@Override public boolean accepts(Object o) { if (o instanceof SBase) { SBase sbase = (SBase) o; if (sbase.isSetMetaId() && (metaid != null) && sbase.getMetaId().equals(metaid)) { return true; } } return false; }
@Override public List<Object> getListOfSBMLElementsToWrite(Object treeNode) { if (logger.isDebugEnabled()) { logger.debug("getListOfSBMLElementsToWrite: " + treeNode.getClass().getCanonicalName()); } List<Object> listOfElementsToWrite = new ArrayList<Object>(); // test if this treeNode is an extended SBase. if (treeNode instanceof SBase && ((SBase) treeNode).getExtension(getNamespaceURI()) != null) { SBasePlugin sbasePlugin = ((SBase) treeNode).getExtension(getNamespaceURI()); if (sbasePlugin != null) { listOfElementsToWrite = super.getListOfSBMLElementsToWrite(sbasePlugin); logger.debug("getListOfSBMLElementsToWrite: nb children = " + sbasePlugin.getChildCount()); } } else { listOfElementsToWrite = super.getListOfSBMLElementsToWrite(treeNode); } return listOfElementsToWrite; }
/** * This updates the metaid of an SBase. * * @param doc * @param arraysPlugin * @param sbase * @param index */ private static void updateSBase(SBMLDocument doc, ArraysSBasePlugin arraysPlugin, SBase sbase, int index) { //TODO check if unique if (sbase.isSetMetaId()) { String metaId = sbase.getMetaId(); String appendId = "_" + index; while(doc.findSBase(metaId + appendId) != null) { appendId = "_" + appendId; } sbase.setMetaId(metaId+appendId); } }