@Override public boolean equals(Object object) { boolean equal = super.equals(object); return equal; }
@Override public int hashCode() { int hashCode = super.hashCode(); return hashCode; }
@Override public boolean readAttribute(String attributeName, String prefix, String value) { boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); if (!isAttributeRead) { if (attributeName.equals(MultiConstants.value)) { setValue(value); isAttributeRead = true; } } return isAttributeRead; }
@Override public TreeNode getChildAt(int index) { if (index < 0) { throw new IndexOutOfBoundsException(MessageFormat.format( resourceBundle.getString("IndexSurpassesBoundsException"), index, 0)); } int count = super.getChildCount(); if (index < count) { return super.getChildAt(index); } else { index -= count; } return get(index); }
int packageVersion) { if (packageLabel.equals(getPackageName())) { setNamespace(namespace); setPackageVersion(packageVersion); Enumeration<TreeNode> children = children(); && ((AbstractSBase) child).getPackageName().equals(packageLabel)) { success &= ((AbstractSBase) child).setPackageNamespaceAndVersion( packageLabel, namespace, packageVersion);
/** * Checks if the sID is a valid identifier. * * @param sID * the identifier to be checked. If null or an invalid * identifier, an exception will be thrown. * @return {@code true} only if the sID is a valid identifier. * Otherwise this method throws an {@link IllegalArgumentException}. * This is an intended behavior. * @throws IllegalArgumentException * if the given id is not valid in this model. */ protected boolean checkIdentifier(String sID) { if ((sID == null) || !SyntaxChecker.isValidId(sID, getLevel(), getVersion())) { throw new IllegalArgumentException(format( resourceBundle.getString("AbstractNamedSBase.checkIdentifier"), sID, getElementName())); } return true; }
@Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = new TreeMap<String, String>(); int level = getLevel(); if (isSetAnnotation() && getAnnotation().isSetRDFannotation() && !isSetMetaId()) { SBMLDocument doc = getSBMLDocument(); if (doc != null) { setMetaId(doc.nextMetaId()); logger.debug(format( "Some annotations would get lost because there was no metaid defined on {0}. To avoid this, an automatic metaid ''{0}'' has been generated.", getElementName(), getMetaId())); getAnnotation().setAbout('#' + getMetaId()); } else { logger.warn(format( "Some annotations can get lost because no metaid is defined on {0}.", getElementName())); if (isSetMetaId()) { attributes.put("metaid", getMetaId()); if (((level == 2) && (getVersion() >= 2)) || (level > 2)) { if (isSetSBOTerm()) { attributes.put("sboTerm", getSBOTermID()); if (isSetId()) { if (getLevel() != 1) { attributes.put("id", getId());
@Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetCoordinate()) { attributes.remove("coordinate"); attributes.put(SpatialConstants.shortLabel + ":coordinate", String.valueOf(getCoordinate())); } return attributes; }
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;
@Override public void setMetaId(String metaId) throws IllegalArgumentException { if (metaId != null) { if (isSetMetaId() && getMetaId().equals(metaId)) { } else if (getLevel() == 1) { throw new PropertyNotAvailableException(TreeNodeChangeEvent.metaId, this); } else if (!SyntaxChecker.isValidMetaId(metaId) && !isReadingInProgress()) { throw new IllegalArgumentException(format( resourceBundle.getString("AbstractSBase.setMetaId"), metaId, getElementName())); SBMLDocument doc = getSBMLDocument(); String oldMetaId = this.metaId; if (doc != null) { if (!doc.registerMetaId(this, true) && !isReadingInProgress()) { if (isSetAnnotation()) { getAnnotation().setAbout('#' + metaId); firePropertyChange(TreeNodeChangeEvent.metaId, oldMetaId, metaId);
@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(shortLabel) != null) { SBasePlugin sbasePlugin = ((Model) treeNode).getExtension(shortLabel); if (sbasePlugin != null) { listOfElementsToWrite = super.getListOfSBMLElementsToWrite(sbasePlugin); logger.debug("getListOfSBMLElementsToWrite: nb children = " + sbasePlugin.getChildCount()); } } else { listOfElementsToWrite = super.getListOfSBMLElementsToWrite(treeNode); } // IntraSpeciesReaction children if (treeNode instanceof IntraSpeciesReaction) { String sbmlNamespace = JSBML.getNamespaceFrom(((IntraSpeciesReaction) treeNode).getLevel(), ((IntraSpeciesReaction) treeNode).getVersion()); for (Object child : listOfElementsToWrite) { if (child instanceof AbstractSBase && ((AbstractSBase) child).getNamespace() == null) { AbstractSBase sbase = (AbstractSBase) child; logger.debug("Found one suspect Model child: " + sbase.getElementName() + ". Setting the SBML namespace to it."); sbase.setNamespace(sbmlNamespace); } } } return listOfElementsToWrite; }
logger.warn(format( resourceBundle.getString("AbstractSBase.registerChild1"), sbase.getElementName(), sbase, getElementName(), this)); } else { logger.warn(format( if ((sbase != null) && checkLevelAndVersionCompatibility(sbase) && checkAndSetPackageNamespaceAndVersion(sbase)) { SBMLDocument doc = getSBMLDocument(); if (doc != null) { ((AbstractSBase) sbase).setParentSBML(this); IdManager idManager = getIdManager(sbase); ((AbstractSBase) sbase).setParentSBML(null); } else if (oldParent instanceof SBase) { ((AbstractSBase) sbase).setParentSBML((SBase) oldParent); sbase.addAllChangeListeners(getListOfTreeNodeChangeListeners());
/** * Returns a String representing this SBase with all the * attributes that are defined. * * @return a String representing this SBase with all its * attributes */ @Override public String toString() { Map<String, String> attMap = writeXMLAttributes(); StringBuilder sb = new StringBuilder(""); sb.append(getElementName()).append(" ["); if (attMap != null) { // print id, name and metaid first sb.append(extractAttribute(attMap, "id")); sb.append(extractAttribute(attMap, "name")); sb.append(extractAttribute(attMap, "metaid")); for (String attributeName : attMap.keySet()) { sb.append(" ").append(attributeName).append("=\""); sb.append(attMap.get(attributeName)).append("\""); } } sb.append("]"); return sb.toString(); }
if (isSetNotes()) { if (childIndex == pos) { return getNotes(); if (isSetAnnotation()) { if (childIndex == pos) { return getAnnotation(); throw new IndexOutOfBoundsException(isLeaf() ? format( resourceBundle.getString("IndexExceedsBoundsException2"), getElementName()) : format( resourceBundle.getString("IndexExceedsBoundsException"), childIndex,
if (getPackageName().equals(sbase.getPackageName())) { expectedPackageNamespace = getNamespace(); expectedPackageVersion = getPackageVersion(); } else if (isSetPlugin(packageLabel)) { SBasePlugin parentSBasePlugin = getPlugin(packageLabel); expectedPackageNamespace = parentSBasePlugin.getElementNamespace(); expectedPackageVersion = parentSBasePlugin.getPackageVersion(); return true; } else { return ((AbstractSBase) sbase).setPackageNamespaceAndVersion(packageLabel, expectedPackageNamespace, expectedPackageVersion);
@Override public List<String> filterCVTerms(CVTerm.Qualifier qualifier, boolean recursive, String... patterns) { List<String> l = new ArrayList<String>(); for (CVTerm c : filterCVTerms(qualifier)) { l.addAll(c.filterResources(patterns)); } if (recursive) { TreeNode child; for (int i = 0; i < getChildCount(); i++) { child = getChildAt(i); if (child instanceof SBase) { l.addAll( ((SBase) child).filterCVTerms(qualifier, recursive, patterns)); } } } return l; }
((AbstractSBase) sbase).unsetNamespace(); ((AbstractSBase) sbase).setNamespace(pi.namespace);
@Override public String getURI() { return getNamespace(); }
@Override public int getChildCount() { int count = super.getChildCount(); if (isSetSBaseRef()) { count++; } return count; }
@Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetValue()) { attributes.put(MultiConstants.shortLabel + ':' + MultiConstants.value, getValue()); } return attributes; }