From: <and...@us...> - 2012-05-08 08:07:51
|
Revision: 1249 http://jsbml.svn.sourceforge.net/jsbml/?rev=1249&view=rev Author: andreas-draeger Date: 2012-05-08 08:07:37 +0000 (Tue, 08 May 2012) Log Message: ----------- Bug fixes: ========== Corrected problems of un-registering elements from SBMLDocument and Model (via id or metaid). Previously, it was possible that cloned elements or elements that were removed from the model at ealier states, could interfere with the register/unregister procedure causing that links to elements were deleted mistakenly. Example: The element sbase was registered using its id in the model and using its metaid in the SBMLDocument. In Model: id -> sbase In SBMLDocument: metaid -> sbase Now, a clone sbase' is created, sbase is removed from the model and the clone is registered. Note that now sbase' is part of the model and the pointers from the id will point to sbase'. However, sbase still has a pointer to its previous parent (which is important). If we now remove any sub-element from sbase, pointers in Model and SBMLDocument from the ids/metaids to the sub-elements of sbase' will be deleted! Hence, a check was mounted to ensure that only correct elements will be unregistered. The other changes are minor code/comment changes. New features: ============= The handling of user objects has been shifted to the interface TreeNodeWithChangeSupport and new methods were added for convenience. Modified Paths: -------------- trunk/core/NEWS.txt trunk/core/build.xml trunk/core/doc/publications/Bioinformatics2011ApplicationNote/document.pdf trunk/core/resources/org/sbml/jsbml/resources/cfg/SBO_OBO.obo trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java trunk/core/src/org/sbml/jsbml/IdentifierException.java trunk/core/src/org/sbml/jsbml/KineticLaw.java trunk/core/src/org/sbml/jsbml/ListOf.java trunk/core/src/org/sbml/jsbml/Model.java trunk/core/src/org/sbml/jsbml/SBMLDocument.java trunk/core/src/org/sbml/jsbml/SBO.java trunk/core/src/org/sbml/jsbml/SBase.java trunk/core/src/org/sbml/jsbml/UnitDefinition.java trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java trunk/core/src/org/sbml/jsbml/util/TreeNodeWithChangeSupport.java trunk/core/src/org/sbml/jsbml/util/compilers/ASTNodeValue.java trunk/core/src/org/sbml/jsbml/util/compilers/LaTeXCompiler.java trunk/core/src/org/sbml/jsbml/util/compilers/UnitsCompiler.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java trunk/extensions/layout/doc/img/type_hierarchy.dot Modified: trunk/core/NEWS.txt =================================================================== --- trunk/core/NEWS.txt 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/NEWS.txt 2012-05-08 08:07:37 UTC (rev 1249) @@ -43,9 +43,9 @@ of Units and UnitDefinitions works correctly. - The userObject in ASTNode has been replaced by a more general map - of userObjects that is located in AbstractTreeNode. In this way, any - JSBML object that is part of the SBML tree can now be attached with - user-defined additional objects for in-memory manipulation. These + of userObjects that is located in TreeNodeWithChangeSupport. In this + way, any JSBML object that is part of the SBML tree can now be attached + with user-defined additional objects for in-memory manipulation. These will not be written to SBML later on. - The new class NamedSBaeGlyph in the layout package supports accessing @@ -57,6 +57,11 @@ * Bug Fixes: + - It was sometimes possible to unregister elements from a model that were + the result of cloning, removal of the original entry and linking the clone + to the model. When altering the previous element, pointers were deleted + in SBMLDocument and Model. + - There is now a rounding correction for multipliers when merging units that tries to shift multipliers to the scale of a unit. This can only be done if the logarithm to the base 10 of the multiplier is nearly Modified: trunk/core/build.xml =================================================================== --- trunk/core/build.xml 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/build.xml 2012-05-08 08:07:37 UTC (rev 1249) @@ -215,8 +215,8 @@ </target> <!-- =================================================================== --> - <!-- Creates the class package and include all the dependencies jars --> - <!-- into a big jsbml jar file. --> + <!-- Creates the class package and include all the dependencies jars --> + <!-- into a big jsbml jar file. --> <!-- =================================================================== --> <target name="bigjar" depends="compile"> @@ -334,7 +334,6 @@ <get src="http://www.ebi.ac.uk/sbo/exports/Main/SBO_OBO.obo" dest="${basedir}/resources/org/sbml/jsbml/resources/cfg/SBO_OBO.obo" verbose="on"/> - </target> <!-- =================================================================== --> @@ -423,7 +422,6 @@ </fileset> </copy> - <copy todir="${dist.dir}"> <fileset dir="${basedir}/" includes="LICENSE.txt NEWS.txt README AUTHORS.txt build.xml"> </fileset> @@ -448,7 +446,6 @@ <!-- Not generating a tar.gz a having only a zip file should be enough --> <!-- <tar basedir="${dist.root}" destfile="${dist.root}/${name}-${version}.tar.gz" includes="${name}-${version}/**" compression="gzip"/> --> - </target> @@ -457,7 +454,6 @@ <!-- =================================================================== --> <target name="module" depends="init"> - <ant dir="${cellDesigner.module.base.dir}" inheritAll="false" inheritRefs="false"> <target name="clean"/> <target name="jar"/> @@ -518,6 +514,7 @@ <delete dir="${dist.root}" includeEmptyDirs="true" quiet="yes"> </delete> </target> + </project> <!-- End of file --> Modified: trunk/core/doc/publications/Bioinformatics2011ApplicationNote/document.pdf =================================================================== (Binary files differ) Modified: trunk/core/resources/org/sbml/jsbml/resources/cfg/SBO_OBO.obo =================================================================== --- trunk/core/resources/org/sbml/jsbml/resources/cfg/SBO_OBO.obo 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/resources/org/sbml/jsbml/resources/cfg/SBO_OBO.obo 2012-05-08 08:07:37 UTC (rev 1249) @@ -1,6 +1,6 @@ format-version: 1.2 -date: 27:02:2012 07:00 -data-version: 09:02:2012 16:47 +date: 05:05:2012 07:00 +data-version: 30:03:2012 11:02 saved-by: SBO community auto-generated-by: SBO Browser (http://www.ebi.ac.uk/sbo/) default-namespace: sbo @@ -3654,6 +3654,18 @@ def: "A conceptualisation of time which is intrinsic to a mathematical model\, and which can be used to describe other variables or parameters of the model." [src_code:NR] is_a: SBO:0000346 ! temporal measure +[Term] +id: SBO:0000587 +name: transcellular membrane influx reaction +def: "A transport reaction which results in the entry of the transported entity\, into the cell." [src_code:NR] +is_a: SBO:0000185 ! transport reaction + +[Term] +id: SBO:0000588 +name: transcellular membrane efflux reaction +def: "A transport reaction which results in the removal of the transported entity from the cell." [src_code:NR] +is_a: SBO:0000185 ! transport reaction + [Typedef] id: is_a name: is_a Modified: trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -186,13 +186,10 @@ } if (ud != null) { Model m = getModel(); - if (m != null) - for (UnitDefinition u : m.getListOfUnitDefinitions()) { - if (UnitDefinition.areEquivalent(u, ud)) { - ud = u; - break; - } - } + if (m != null) { + UnitDefinition u = m.findIdentical(ud); + return (u != null) ? u : ud; + } } else { ud = new UnitDefinition(getLevel(), getVersion()); ud.addUnit(ud.createUnit()); Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -1390,19 +1390,34 @@ * @see org.sbml.jsbml.SBase#setMetaId(java.lang.String) */ public void setMetaId(String metaId) { - if ((metaId != null) && (getLevel() == 1)) { - throw new PropertyNotAvailableException(TreeNodeChangeEvent.metaId, this); - } - SBMLDocument doc = getSBMLDocument(); - if ((doc != null) && doc.containsMetaId(metaId)) { - throw new IdentifierException(this, metaId); - } - String oldMetaId = this.metaId; - this.metaId = metaId; - if (doc != null) { - doc.registerMetaId(this, true); - } - firePropertyChange(TreeNodeChangeEvent.metaId, oldMetaId, metaId); + if ((metaId != null) && (getLevel() == 1)) { + throw new PropertyNotAvailableException(TreeNodeChangeEvent.metaId, this); + } + SBMLDocument doc = getSBMLDocument(); + String oldMetaId = this.metaId; + if (doc != null) { + // We have to first remove the pointer from the old metaId to this SBase + if (oldMetaId != null) { + doc.registerMetaId(this, false); + } + // Now we can register the new metaId if necessary. + if (metaId != null) { + this.metaId = metaId; + if (!doc.registerMetaId(this, true)) { + // register failed. Revert the change and throw an exception: + this.metaId = oldMetaId; + throw new IdentifierException(this, metaId); + } + } + } else { + // If the document is null, we don't have to register anything. Simply change: + this.metaId = metaId; + } + if (isSetAnnotation()) { + // Propagate the change also to the annotation: + getAnnotation().setAbout('#' + metaId); + } + firePropertyChange(TreeNodeChangeEvent.metaId, oldMetaId, metaId); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -27,6 +27,7 @@ import java.util.List; import java.util.Map; import java.util.NoSuchElementException; +import java.util.Set; import javax.swing.tree.TreeNode; @@ -163,8 +164,8 @@ Enumeration<TreeNode> children = children(); while (children.hasMoreElements()) { TreeNode node = children.nextElement(); - if (node instanceof AbstractTreeNode) { - success &= ((AbstractTreeNode) node) + if (node instanceof TreeNodeWithChangeSupport) { + success &= ((TreeNodeWithChangeSupport) node) .addAllChangeListeners(listeners); } } @@ -181,8 +182,8 @@ Enumeration<TreeNode> children = children(); while (children.hasMoreElements()) { TreeNode node = children.nextElement(); - if (node instanceof AbstractTreeNode) { - ((AbstractTreeNode) node).addTreeNodeChangeListener(listener); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); } } } @@ -222,10 +223,9 @@ }; } - /** - * Removes all of the mappings from the map of user objects (optional operation). The map - * will be empty after this call returns. - */ + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#clearUserObjects() + */ public void clearUserObjects() { if (isSetUserObjects()) { userObjects.clear(); @@ -239,6 +239,13 @@ public abstract TreeNode clone(); /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#containsUserObjectKey(java.lang.Object) + */ + public boolean containsUserObjectKey(Object key) { + return userObjects.containsKey(key); + } + + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override @@ -274,7 +281,7 @@ return equal; } return false; - } + } /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter) @@ -341,12 +348,12 @@ changeType = 2; // real property change } if (-1 < changeType) { - boolean newValTreeNode = newValue instanceof AbstractTreeNode; - boolean oldValTreeNode = oldValue instanceof AbstractTreeNode; + boolean newValTreeNode = newValue instanceof TreeNodeWithChangeSupport; + boolean oldValTreeNode = oldValue instanceof TreeNodeWithChangeSupport; if ((changeType == 0) && newValTreeNode) { - ((AbstractTreeNode) newValue).fireNodeAddedEvent(); + ((TreeNodeWithChangeSupport) newValue).fireNodeAddedEvent(); } else if ((changeType == 1) && oldValTreeNode) { - ((AbstractTreeNode) oldValue).fireNodeRemovedEvent(); + ((TreeNodeWithChangeSupport) oldValue).fireNodeRemovedEvent(); } else { // TODO: check if notifying and updating the metaId is necessary // because of the method AbstractSBase.setThisAsParentSBMLObject @@ -369,7 +376,7 @@ } } } - + /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode) */ @@ -383,7 +390,7 @@ public List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners() { return listOfListeners; } - + /** * Returns the number of child elements of this {@link TreeNode}. * @@ -394,17 +401,17 @@ public int getNumChildren() { return getChildCount(); } - + /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getParent() */ public TreeNode getParent() { return parent; } - - /** - * @return the userObject - */ + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getUserObject(java.lang.Object) + */ public Object getUserObject(Object key) { if (userObjects == null) { userObjects = new HashMap<Object, Object>(); @@ -441,7 +448,7 @@ return hashCode; } - + /* (non-Javadoc) * @see javax.swing.tree.TreeNode#isLeaf() */ @@ -472,13 +479,9 @@ return parent != null; } - /** - * Checks whether any user-defined key-value pairs have been attached - * to this object. - * - * @return <code>true</code> if at least one user-defined key-value pair has - * been attached to this object. - */ + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isSetUserObjects() + */ public boolean isSetUserObjects() { return (userObjects != null) && !userObjects.isEmpty(); } @@ -496,12 +499,10 @@ protected void notifyChildChange(TreeNode oldChild, TreeNode newChild) { // default: empty body, nothing to do. } - - /** - * @param key some user-defined key under which the given userObject can be found. - * @param userObject - * the userObject to set - */ + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#putUserObject(java.lang.Object, java.lang.Object) + */ public void putUserObject(Object key, Object userObject) { if (userObjects == null) { userObjects = new HashMap<Object, Object>(); @@ -509,15 +510,15 @@ Object oldObject = userObjects.put(key, userObject); firePropertyChange(key.toString(), oldObject, userObject); } - + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeAllTreeNodeChangeListeners() */ public void removeAllTreeNodeChangeListeners() { listOfListeners.clear(); } - - /* (non-Javadoc) + + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) */ public void removeTreeNodeChangeListener(TreeNodeChangeListener l) { @@ -525,16 +526,14 @@ Enumeration<TreeNode> children = children(); while (children.hasMoreElements()) { TreeNode node = children.nextElement(); - if (node instanceof AbstractTreeNode) { - ((AbstractTreeNode) node).removeTreeNodeChangeListener(l); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(l); } } } - /** - * - * @param key - * @return + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeUserObject(java.lang.Object) */ public Object removeUserObject(Object key) { if (userObjects != null) { @@ -542,8 +541,8 @@ } return null; } - - /** + + /** * @param parent * the parent to set */ @@ -553,7 +552,7 @@ this.firePropertyChange(TreeNodeChangeEvent.parentSBMLObject, oldValue, this.parent); } - /* (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override @@ -561,4 +560,11 @@ return StringTools.firstLetterLowerCase(getClass().getSimpleName()); } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#userObjectKeySet() + */ + public Set<Object> userObjectKeySet() { + return userObjects.keySet(); + } + } Modified: trunk/core/src/org/sbml/jsbml/IdentifierException.java =================================================================== --- trunk/core/src/org/sbml/jsbml/IdentifierException.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/IdentifierException.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -20,6 +20,8 @@ */ package org.sbml.jsbml; +import java.text.MessageFormat; + import org.apache.log4j.Logger; /** @@ -45,7 +47,7 @@ /** * */ - public static final String DUPLICATE_IDENTIFIER_MSG = "Cannot set duplicate %sidentifier '%s' for %s."; + public static final String DUPLICATE_IDENTIFIER_MSG = "Cannot set duplicate {0}identifier {1} for {2}."; /** * @@ -53,9 +55,9 @@ * @param id */ public IdentifierException(NamedSBase sb, String id) { - super(String.format(DUPLICATE_IDENTIFIER_MSG, "", id, sb.getElementName())); - logger.error(String.format( - "An element with the id '%s' is already present in the SBML model. The identifier of %s will not be set to this value.", + super(MessageFormat.format(DUPLICATE_IDENTIFIER_MSG, "", id, sb.getElementName())); + logger.error(MessageFormat.format( + "An element with the id \"{0}\" is already present in the SBML model. The identifier of {1} will not be set to this value.", id, sb.getElementName())); } @@ -64,9 +66,9 @@ * @param metaId */ public IdentifierException(SBase sb, String metaId) { - super(String.format(DUPLICATE_IDENTIFIER_MSG, "meta ", metaId, sb.getElementName())); - logger.error(String.format( - "An element with the metaid '%s' is already present in the SBML document. The element %s will not be annotated with it.", + super(MessageFormat.format(DUPLICATE_IDENTIFIER_MSG, "meta ", metaId, sb.getElementName())); + logger.error(MessageFormat.format( + "An element with the metaid \"{0}\" is already present in the SBML document. The element {1} will not be annotated with it.", metaId, sb.getElementName())); } Modified: trunk/core/src/org/sbml/jsbml/KineticLaw.java =================================================================== --- trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -414,7 +414,7 @@ return m.getUnitDefinition(substanceUnitsID); } if (unitsID != null) { - UnitDefinition def = new UnitDefinition("substance", getLevel(), + UnitDefinition def = new UnitDefinition(UnitDefinition.SUBSTANCE, getLevel(), getVersion()); for (Unit unit : getUnitsInstance().getListOfUnits()) { if (unit.isVariantOfSubstance()) { @@ -448,7 +448,7 @@ return m.getUnitDefinition(timeUnitsID); } if (unitsID != null) { - UnitDefinition def = new UnitDefinition("time", getLevel(), getVersion()); + UnitDefinition def = new UnitDefinition(UnitDefinition.TIME, getLevel(), getVersion()); Unit time; for (Unit unit : getUnitsInstance().getListOfUnits()) { time = unit.clone(); Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -432,8 +432,8 @@ public void clear() { List<T> removedElements = listOf; listOf.clear(); - for( T element : removedElements){ - ((AbstractTreeNode) element).fireNodeRemovedEvent(); + for (T element : removedElements) { + ((TreeNodeWithChangeSupport) element).fireNodeRemovedEvent(); } } @@ -684,8 +684,7 @@ */ @Override public boolean readAttribute(String attributeName, String prefix, - String value) - { + String value) { boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); if (!isAttributeRead) { @@ -699,7 +698,7 @@ */ public T remove(int index) { T t = listOf.remove(index); - ((AbstractTreeNode) t).fireNodeRemovedEvent(); + ((TreeNodeWithChangeSupport) t).fireNodeRemovedEvent(); return t; } @@ -743,7 +742,7 @@ } SBase sbase = (SBase) o; if (listOf.remove(sbase)) { - ((AbstractTreeNode) o).fireNodeRemovedEvent(); + ((TreeNodeWithChangeSupport) o).fireNodeRemovedEvent(); return true; } return false; @@ -771,7 +770,7 @@ } if (pos >= 0) { T element = listOf.remove(pos); - ((AbstractTreeNode) element).fireNodeRemovedEvent(); + ((TreeNodeWithChangeSupport) element).fireNodeRemovedEvent(); return (T) sbase; } } @@ -785,7 +784,7 @@ boolean success = listOf.removeAll(c); if(success){ for(Iterator<?> i = c.iterator(); i.hasNext();){ - AbstractTreeNode element = (AbstractTreeNode) i.next(); + TreeNodeWithChangeSupport element = (TreeNodeWithChangeSupport) i.next(); element.fireNodeRemovedEvent(); } } @@ -825,7 +824,7 @@ for(T element : listOf){ if (!c.contains(element)) { listOf.remove(element); - ((AbstractTreeNode) element).fireNodeRemovedEvent(); + ((TreeNodeWithChangeSupport) element).fireNodeRemovedEvent(); modified = true; } } @@ -840,7 +839,7 @@ // TODO: this should rather be a firePropertyChangedEvent, as the // element is first removed and then added again. But the method // registerChild fires a NodeAddedEvent - ((AbstractTreeNode) element).fireNodeRemovedEvent(); + ((TreeNodeWithChangeSupport) element).fireNodeRemovedEvent(); registerChild(element); return prevElem; } Modified: trunk/core/src/org/sbml/jsbml/Model.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Model.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/Model.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -21,6 +21,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -191,7 +192,7 @@ /** * Creates a Model instance. By default, all the listOfxxx and xxxUnitsID are - * null. + * <code>null</code>. */ public Model() { super(); @@ -276,7 +277,7 @@ /** * Creates a Model instance from an id, level and version. By default, all the - * listOfxxx and xxxUnitsID are null. + * listOfxxx and xxxUnitsID are <code>null</code>. * * @param id * @param level @@ -578,11 +579,11 @@ } /** - * Returns true if this model contains a reference to a {@link Compartment} + * Returns <code>true</code> if this model contains a reference to a {@link Compartment} * with the given identifier. * * @param id - * @return true if this model contains a reference to a {@link Compartment} + * @return <code>true</code> if this model contains a reference to a {@link Compartment} * with the given identifier. */ public boolean containsCompartment(String id) { @@ -590,11 +591,11 @@ } /** - * Returns true if this model contains a reference to a + * Returns <code>true</code> if this model contains a reference to a * {@link FunctionDefinition} with the given identifier. * * @param id - * @return true if this model contains a reference to a + * @return <code>true</code> if this model contains a reference to a * {@link FunctionDefinition} with the given identifier. */ public boolean containsFunctionDefinition(String id) { @@ -602,11 +603,11 @@ } /** - * Returns true if this model contains a reference to a {@link Parameter} with + * Returns <code>true</code> if this model contains a reference to a {@link Parameter} with * the given identifier. * * @param id - * @return true if this model contains a reference to a {@link Parameter} with + * @return <code>true</code> if this model contains a reference to a {@link Parameter} with * the given identifier. */ public boolean containsParameter(String id) { @@ -780,7 +781,7 @@ * created is not significant. It could have been created in a variety of * ways, for example by using createEvent(). If no {@link Event} object exists * in this {@link Model} object, a new {@link Delay} is <em>not</em> created - * and NULL is returned instead. + * and <code>null</code> is returned instead. * <p> * * @return the {@link Delay} object created @@ -820,7 +821,7 @@ * created is not significant. It could have been created in a variety of * ways, for example by using createEvent(). If no {@link Event} object exists * in this {@link Model} object, a new {@link EventAssignment} is <em>not</em> - * created and NULL is returned instead. + * created and <code>null</code> is returned instead. * <p> * * @return the {@link EventAssignment} object created @@ -897,7 +898,7 @@ * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, or a {@link Reaction} * exists but already has a {@link KineticLaw}, a new {@link KineticLaw} is - * <em>not</em> created and NULL is returned instead. + * <em>not</em> created and <code>null</code> is returned instead. * <p> * * @return the {@link KineticLaw} object created @@ -928,7 +929,7 @@ * Reaction.createKineticLaw() on the {@link Reaction} object created by a * createReaction(). If a {@link Reaction} does not exist for this model, or * the last {@link Reaction} does not contain a {@link KineticLaw} object, a - * new {@link LocalParameter} is <em>not</em> created and NULL is returned + * new {@link LocalParameter} is <em>not</em> created and <code>null</code> is returned * instead. * <p> * @@ -977,7 +978,7 @@ * added to this {@link Model} is not significant. It could have been created * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, a new - * {@link ModifierSpeciesReference} is <em>not</em> created and NULL is + * {@link ModifierSpeciesReference} is <em>not</em> created and <code>null</code> is * returned instead. * <p> * @@ -997,7 +998,9 @@ public ModifierSpeciesReference createModifier(String id) { Reaction lastReaction = (Reaction) getLastElementOf(listOfReactions); - if (lastReaction == null) { return null; } + if (lastReaction == null) { + return null; + } ModifierSpeciesReference modifier = lastReaction.createModifier(id); @@ -1037,7 +1040,7 @@ * added to this {@link Model} is not significant. It could have been created * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, a new - * {@link SpeciesReference} is <em>not</em> created and NULL is returned + * {@link SpeciesReference} is <em>not</em> created and <code>null</code> is returned * instead. * <p> * @@ -1092,7 +1095,7 @@ * added to this {@link Model} is not significant. It could have been created * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, a new - * {@link SpeciesReference} is <em>not</em> created and NULL is returned + * {@link SpeciesReference} is <em>not</em> created and <code>null</code> is returned * instead. * <p> * @@ -1244,7 +1247,7 @@ * created is not significant. It could have been created in a variety of * ways, for example by using createEvent(). If no {@link Event} object exists * in this {@link Model} object, a new {@link Trigger} is <em>not</em> created - * and NULL is returned instead. + * and <code>null</code> is returned instead. * <p> * * @return the {@link Trigger} object created @@ -1259,7 +1262,7 @@ * <p> * The mechanism by which the {@link UnitDefinition} was created is not * significant. If a {@link UnitDefinition} object does not exist in this - * model, a new {@link Unit} is <em>not</em> created and NULL is returned + * model, a new {@link Unit} is <em>not</em> created and <code>null</code> is returned * instead. * <p> * @@ -1365,12 +1368,12 @@ /** * Returns a {@link CallableSBase} element of the {@link Model} that has the - * given 'id' as identifier or null if no element is found. + * given 'id' as identifier or <code>null</code> if no element is found. * * @param id * an identifier indicating an element of the {@link Model}. * @return a {@link CallableSBase} element of the {@link Model} that has the - * given 'id' as id or null if no element is found. + * given 'id' as id or <code>null</code> if no element is found. */ public CallableSBase findCallableSBase(String id) { UniqueNamedSBase found = findUniqueNamedSBase(id); @@ -1407,7 +1410,7 @@ * @param id * @return A {@link List} of all {@link LocalParameter} instances with the * given name or identifier. This {@link List} can be empty, but never - * null. + * <code>null</code>. */ public List<LocalParameter> findLocalParameters(String id) { List<LocalParameter> list = new LinkedList<LocalParameter>(); @@ -1452,7 +1455,7 @@ /** * Returns a {@link NamedSBase} element of the model that has the given 'id' - * as id or null if no element is found. + * as id or <code>null</code> if no element is found. * * @param id * an id indicating an element of the model. @@ -1469,7 +1472,7 @@ /** * Returns a {@link NamedSBaseWithDerivedUnit} element of the {@link Model} - * that has the given 'id' as id or null if no element is found. It first + * that has the given 'id' as id or <code>null</code> if no element is found. It first * tries to find a {@link CallableSBase} with the given identifier and, if * this is not successful, it searches for an instance of {@link Event} with * the given id. @@ -1477,7 +1480,7 @@ * @param id * an id indicating an element of the {@link Model}. * @return a {@link NamedSBaseWithDerivedUnit} element of the {@link Model} - * that has the given 'id' as id or null if no element is found. + * that has the given 'id' as id or <code>null</code> if no element is found. * @see #findCallableSBase(String) */ public NamedSBaseWithDerivedUnit findNamedSBaseWithDerivedUnit(String id) { @@ -1603,7 +1606,7 @@ * {@link Parameter}s for the element with the given identifier. * * @param id - * @return a {@link Symbol} element with the given identifier or null if there + * @return a {@link Symbol} element with the given identifier or <code>null</code> if there * is no such element. */ public Symbol findSymbol(String id) { @@ -1834,7 +1837,7 @@ * * @param n * @return the nth {@link Compartment} instance of the listOfCompartments. - * Null if if the listOfCompartments is not set. + * <code>null</code> if if the listOfCompartments is not set. */ public Compartment getCompartment(int n) { return getListOfCompartments().get(n); @@ -1846,7 +1849,7 @@ * * @param id * @return the {@link Compartment} of the listOfCompartments which has 'id' as - * id (or name depending on the version and level). Null if if the + * id (or name depending on the version and level). <code>null</code> if if the * listOfCompartments is not set. */ public Compartment getCompartment(String id) { @@ -1871,7 +1874,7 @@ * * @param n * index - * @return the nth CompartmentType of this Model. Returns null if there are no + * @return the nth CompartmentType of this Model. Returns <code>null</code> if there are no * compartmentType defined or if the index n is too big or lower than * zero. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. @@ -1886,7 +1889,7 @@ * * @param id * @return the CompartmentType of the {@link #listOfCompartmentTypes} which has 'id' as - * id (or name depending on the level and version). Null if the + * id (or name depending on the level and version). <code>null</code> if the * {@link #listOfCompartmentTypes} is not set or the id is not found. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -1916,7 +1919,7 @@ * Gets the nth Constraint object in this Model. * * @param n - * @return the nth Constraint of this Model. Returns null if there are no + * @return the nth Constraint of this Model. Returns <code>null</code> if there are no * constraint defined or if the index n is too big or lower than zero. */ public Constraint getConstraint(int n) { @@ -1947,7 +1950,7 @@ * Model as id. * * @return the Parameter instance which has the conversionFactorID of this - * Model as id. Null if it doesn't exist + * Model as id. <code>null</code> if it doesn't exist */ public Parameter getConversionFactorInstance() { return getParameter(this.conversionFactorID); @@ -1972,7 +1975,7 @@ * Gets the nth Event object in this Model. * * @param n - * @return the nth Event of this Model. Returns null if there are no event + * @return the nth Event of this Model. Returns <code>null</code> if there are no event * defined or if the index n is too big or lower than zero. */ public Event getEvent(int n) { @@ -1984,7 +1987,7 @@ * * @param id * @return the {@link Event} of the {@link #listOfEvents} which has 'id' as id - * (or name depending on the level and version). Null if if the + * (or name depending on the level and version). <code>null</code> if if the * {@link #listOfEvents} is not set. */ public Event getEvent(String id) { @@ -2032,7 +2035,7 @@ * of this Model as id. * * @return the {@link UnitDefinition} instance which has the extent units ID - * of this Model as id. Null if it doesn't exist + * of this Model as id. <code>null</code> if it doesn't exist */ public UnitDefinition getExtentUnitsInstance() { return getUnitDefinition(getExtentUnits()); @@ -2044,7 +2047,7 @@ * * @param n * @return the nth {@link FunctionDefinition} instance of the - * listOfFunstionDefinitions. Null if if the listOfFunctionDefinitions + * listOfFunstionDefinitions. <code>null</code> if if the listOfFunctionDefinitions * is not set. */ public FunctionDefinition getFunctionDefinition(int n) { @@ -2058,7 +2061,7 @@ * @param id * @return the {@link FunctionDefinition} of the {@link #listOfFunctionDefinitions} * which has 'id' as id (or name depending on the level and version). - * Null if if the {@link #listOfFunctionDefinitions} is not set. + * <code>null</code> if if the {@link #listOfFunctionDefinitions} is not set. */ public FunctionDefinition getFunctionDefinition(String id) { UniqueNamedSBase found = findUniqueNamedSBase(id); @@ -2082,7 +2085,7 @@ * Gets the nth {@link InitialAssignment} object in this {@link Model}. * * @param n - * @return the nth {@link InitialAssignment} of this {@link Model}. Null if + * @return the nth {@link InitialAssignment} of this {@link Model}. <code>null</code> if * the listOfInitialAssignments is not set. */ public InitialAssignment getInitialAssignment(int n) { @@ -2101,7 +2104,7 @@ * @return the first {@link InitialAssignment} of the * {@link #listOfInitialAssignments}, whose {@link Variable} has the * <code>variable</code> as identifier (or name depending on the level - * and version). Null if it doesn't exist. + * and version). <code>null</code> if it doesn't exist. */ public InitialAssignment getInitialAssignment(String variable) { return getListOfInitialAssignments().firstHit( @@ -2137,7 +2140,7 @@ * Returns the last element added in the given list. * * @return the last element added in the model, corresponding to the last - * element of the list of these elements, or null is no element exist + * element of the list of these elements, or <code>null</code> is no element exist * for this type. */ private <T> T getLastElementOf(ListOf<? extends T> listOf) { @@ -2816,7 +2819,7 @@ * * @param id * @return the {@link Parameter} of the listOfParameters which has 'id' as id - * (or name depending on the level and version). Null if it doesn't + * (or name depending on the level and version). <code>null</code> if it doesn't * exist. */ public Parameter getParameter(String id) { @@ -2842,14 +2845,14 @@ /** * Returns a UnitDefinition representing one of the predefined units of SBML, - * returns null if the given unit kind is not a valid one for the SBML level + * returns <code>null</code> if the given unit kind is not a valid one for the SBML level * and version of this {@link Model}. * * @param unitKind * a unit kind for one of the predefined units from the SBML * Specifications * @return a UnitDefinition representing one of the predefined units of SBML, - * null if the unitKind is invalid. + * <code>null</code> if the unitKind is invalid. */ public UnitDefinition getPredefinedUnitDefinition(String unitKind) { // TODO: This might be more efficient than ALWAYS storing ALL base units in the listOfPredefinedUnits: @@ -2932,7 +2935,7 @@ * * @param n * an index - * @return the nth {@link Rule} of the listOfRules. Null if it doesn't exist. + * @return the nth {@link Rule} of the listOfRules. <code>null</code> if it doesn't exist. */ public Rule getRule(int n) { return getListOfRules().get(n); @@ -2944,7 +2947,7 @@ * the value passed to this method. * * @param variable - * @return Null if no element with the required property exists. + * @return <code>null</code> if no element with the required property exists. */ public ExplicitRule getRule(String variable) { Rule rule = listOfRules.firstHit(new AssignmentVariableFilter(variable)); @@ -3042,7 +3045,7 @@ * * @param n * index - * @return the nth {@link SpeciesType} of this Model. Returns null if there + * @return the nth {@link SpeciesType} of this Model. Returns <code>null</code> if there * are no speciesType defined or if the index n is too big or lower * than zero. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. @@ -3230,7 +3233,7 @@ * @param id * @return the {@link UnitDefinition} of the {@link #listOfUnitDefinitions}s * which has 'id' as id (or name depending on the level and version). - * Null if it doesn't exist. + * <code>null</code> if it doesn't exist. */ public UnitDefinition getUnitDefinition(String id) { UnitDefinition unitDefinition = mapOfUnitDefinitions != null ? mapOfUnitDefinitions.get(id) : null; @@ -3317,12 +3320,12 @@ } /** - * Returns true if this model has a reference to the unit with the given + * Returns <code>true</code> if this model has a reference to the unit with the given * identifier. * * @param id - * @return true if this model has a reference to the unit with the given - * identifier, false otherwise. + * @return <code>true</code> if this model has a reference to the unit with the given + * identifier, <code>false</code> otherwise. */ public boolean hasUnit(String id) { return getUnitDefinition(id) != null; @@ -3418,90 +3421,90 @@ } /** - * Returns true if the area units ID of this Model is not null. + * Returns <code>true</code> if the area units ID of this Model is not <code>null</code>. * - * @return true if the area units ID of this Model is not null. + * @return <code>true</code> if the area units ID of this Model is not <code>null</code>. */ public boolean isSetAreaUnits() { return this.areaUnitsID != null; } /** - * Returns true if the UnitDefinition which has the area units ID of this - * Model as id is not null. + * Returns <code>true</code> if the UnitDefinition which has the area units ID of this + * Model as id is not <code>null</code>. * - * @return true if the UnitDefinition which has the area units ID of this - * Model as id is not null. + * @return <code>true</code> if the UnitDefinition which has the area units ID of this + * Model as id is not <code>null</code>. */ public boolean isSetAreaUnitsInstance() { return getAreaUnitsInstance() != null; } /** - * Returns true if the conversionFactorID of this Model is not null. + * Returns <code>true</code> if the conversionFactorID of this Model is not <code>null</code>. * - * @return true if the conversionFactorID of this Model is not null. + * @return <code>true</code> if the conversionFactorID of this Model is not <code>null</code>. */ public boolean isSetConversionFactor() { return this.conversionFactorID != null; } /** - * Returns true if the Parameter which has the conversionFactorID of this - * Model as id is not null. + * Returns <code>true</code> if the Parameter which has the conversionFactorID of this + * Model as id is not <code>null</code>. * - * @return true if the Parameter which has the conversionFactorID of this - * Model as id is not null. + * @return <code>true</code> if the Parameter which has the conversionFactorID of this + * Model as id is not <code>null</code>. */ public boolean isSetConversionFactorInstance() { return getParameter(this.conversionFactorID) != null; } /** - * Returns true if the extentUnitsID of this Model is not null. + * Returns <code>true</code> if the extentUnitsID of this Model is not <code>null</code>. * - * @return true if the extentUnitsID of this Model is not null. + * @return <code>true</code> if the extentUnitsID of this Model is not <code>null</code>. */ public boolean isSetExtentUnits() { return this.extentUnitsID != null; } /** - * Returns true if the UnitDefinition which has the extentUnitsID of this - * Model as id is not null. + * Returns <code>true</code> if the UnitDefinition which has the extentUnitsID of this + * Model as id is not <code>null</code>. * - * @return true if the UnitDefinition which has the extentUnitsID of this - * Model as id is not null. + * @return <code>true</code> if the UnitDefinition which has the extentUnitsID of this + * Model as id is not <code>null</code>. */ public boolean isSetExtentUnitsInstance() { return getExtentUnitsInstance() != null; } /** - * Returns true if the lengthUnitsID of this Model is not null. + * Returns <code>true</code> if the lengthUnitsID of this Model is not <code>null</code>. * - * @return true if the lengthUnitsID of this Model is not null. + * @return <code>true</code> if the lengthUnitsID of this Model is not <code>null</code>. */ public boolean isSetLengthUnits() { return this.lengthUnitsID != null; } /** - * Returns true if the UnitDefinition which has the lengthUnitsID of this - * Model as id is not null. + * Returns <code>true</code> if the UnitDefinition which has the lengthUnitsID of this + * Model as id is not <code>null</code>. * - * @return true if the UnitDefinition which has the lengthUnitsID of this - * Model as id is not null. + * @return <code>true</code> if the UnitDefinition which has the lengthUnitsID of this + * Model as id is not <code>null</code>. */ public boolean isSetLengthUnitsInstance() { return getLengthUnitsInstance() != null; } /** - * Returns true if the listOfCompartments of this Model is not null and not + * Returns <code>true</code> if the listOfCompartments of this Model is not <code>null</code> and not * empty. * - * @return true if the listOfCompartments of this Model is not null and not + * @return <code>true</code> if the listOfCompartments of this Model is not <code>null</code> and not * empty. */ public boolean isSetListOfCompartments() { @@ -3509,10 +3512,10 @@ } /** - * Returns true if the listOfCompartmentTypes of this Model is not null and + * Returns <code>true</code> if the listOfCompartmentTypes of this Model is not <code>null</code> and * not empty. * - * @return true if the listOfCompartmentTypes of this Model is not null and + * @return <code>true</code> if the listOfCompartmentTypes of this Model is not <code>null</code> and * not empty. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -3523,10 +3526,10 @@ } /** - * Returns true if the listOfConstraints of this Model is not null and not + * Returns <code>true</code> if the listOfConstraints of this Model is not <code>null</code> and not * empty. * - * @return true if the listOfConstraints of this Model is not null and not + * @return <code>true</code> if the listOfConstraints of this Model is not <code>null</code> and not * empty. */ public boolean isSetListOfConstraints() { @@ -3534,19 +3537,19 @@ } /** - * Returns true if the listOfEvents of this Model is not null and not empty. + * Returns <code>true</code> if the listOfEvents of this Model is not <code>null</code> and not empty. * - * @return true if the listOfEvents of this Model is not null and not empty. + * @return <code>true</code> if the listOfEvents of this Model is not <code>null</code> and not empty. */ public boolean isSetListOfEvents() { return (listOfEvents != null) && (listOfEvents.size() > 0); } /** - * Returns true if the listOfFunctionDefinitions of this Model is not null and + * Returns <code>true</code> if the listOfFunctionDefinitions of this Model is not <code>null</code> and * not empty. * - * @return true if the listOfFunctionDefinitions of this Model is not null and + * @return <code>true</code> if the listOfFunctionDefinitions of this Model is not <code>null</code> and * not empty. */ public boolean isSetListOfFunctionDefinitions() { @@ -3555,10 +3558,10 @@ } /** - * Returns true if the listOfInitialAssignments of this Model is not null and + * Returns <code>true</code> if the listOfInitialAssignments of this Model is not <code>null</code> and * not empty. * - * @return true if the listOfInitialAssignments of this Model is not null and + * @return <code>true</code> if the listOfInitialAssignments of this Model is not <code>null</code> and * not empty. */ public boolean isSetListOfInitialAssignments() { @@ -3567,10 +3570,10 @@ } /** - * Returns true if the listOfParameters of this Model is not null and not + * Returns <code>true</code> if the listOfParameters of this Model is not <code>null</code> and not * empty. * - * @return true if the listOfParameters of this Model is not null and not + * @return <code>true</code> if the listOfParameters of this Model is not <code>null</code> and not * empty. */ public boolean isSetListOfParameters() { @@ -3578,10 +3581,10 @@ } /** - * Returns true if the listOfReactions of this Model is not null and not + * Returns <code>true</code> if the listOfReactions of this Model is not <code>null</code> and not * empty. * - * @return true if the listOfReactions of this Model is not null and not + * @return <code>true</code> if the listOfReactions of this Model is not <code>null</code> and not * empty. */ public boolean isSetListOfReactions() { @@ -3589,28 +3592,28 @@ } /** - * Returns true if the listOfRules of this Model is not null and not empty. + * Returns <code>true</code> if the listOfRules of this Model is not <code>null</code> and not empty. * - * @return true if the listOfRules of this Model is not null and not empty. + * @return <code>true</code> if the listOfRules of this Model is not <code>null</code> and not empty. */ public boolean isSetListOfRules() { return (listOfRules != null) && (listOfRules.size() > 0); } /** - * Returns true if the listOfSpecies of this Model is not null and not empty. + * Returns <code>true</code> if the listOfSpecies of this Model is not <code>null</code> and not empty. * - * @return true if the listOfSpecies of this Model is not null and not empty. + * @return <code>true</code> if the listOfSpecies of this Model is not <code>null</code> and not empty. */ public boolean isSetListOfSpecies() { return (listOfSpecies != null) && (listOfSpecies.size() > 0); } /** - * Returns true if the listOfSpeciesTypes of this Model is not null and not + * Returns <code>true</code> if the listOfSpeciesTypes of this Model is not <code>null</code> and not * empty. * - * @return true if the listOfSpeciesTypes of this Model is not null and not + * @return <code>true</code> if the listOfSpeciesTypes of this Model is not <code>null</code> and not * empty. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -3620,10 +3623,10 @@ } /** - * Returns true if the listOfUnitDefinitions of this Model is not null and not + * Returns <code>true</code> if the listOfUnitDefinitions of this Model is not <code>null</code> and not * empty. * - * @return true if the listOfUnitDefinitions of this Model is not null and not + * @return <code>true</code> if the listOfUnitDefinitions of this Model is not <code>null</code> and not * empty. */ public boolean isSetListOfUnitDefinitions() { @@ -3644,20 +3647,20 @@ } /** - * Returns true if the substanceUnitsID of this Model is not null. + * Returns <code>true</code> if the substanceUnitsID of this Model is not <code>null</code>. * - * @return true if the substanceUnitsID of this Model is not null. + * @return <code>true</code> if the substanceUnitsID of this Model is not <code>null</code>. */ public boolean isSetSubstanceUnits() { return this.substanceUnitsID != null; } /** - * Returns true if the UnitDefinition which has the substanceUnitsID of this - * Model as id is not null. + * Returns <code>true</code> if the UnitDefinition which has the substanceUnitsID of this + * Model as id is not <code>null</code>. * - * @return true if the UnitDefinition which has the substanceUnitsID of this - * Model as id is not null. + * @return <code>true</code> if the UnitDefinition which has the substanceUnitsID of this + * Model as id is not <code>null</code>. */ public boolean isSetSubstanceUnitsInstance() { return getSubstanceUnitsInstance() != null; @@ -3673,31 +3676,31 @@ } /** - * Returns true if the UnitsDefinition which has the timeUnistID of this Model - * as id is not null. + * Returns <code>true</code> if the UnitsDefinition which has the timeUnistID of this Model + * as id is not <code>null</code>. * - * @return true if the UnitsDefinition which has the timeUnistID of this Model - * as id is not null. + * @return <code>true</code> if the UnitsDefinition which has the timeUnistID of this Model + * as id is not <code>null</code>. */ public boolean isSetTimeUnitsInstance() { return getTimeUnitsInstance() != null; } /** - * Returns true if the volumeUnitsID of this Model is not null. + * Returns <code>true</code> if the volumeUnitsID of this Model is not <code>null</code>. * - * @return true if the volumeUnitsID of this Model is not null. + * @return <code>true</code> if the volumeUnitsID of this Model is not <code>null</code>. */ public boolean isSetVolumeUnits() { return this.volumeUnitsID != null; } /** - * Returns true if the UnitDefinition which has the volumeUnitsID of this - * Model as id is not null. + * Returns <code>true</code> if the UnitDefinition which has the volumeUnitsID of this + * Model as id is not <code>null</code>. * - * @return true if the UnitDefinition which has the volumeUnitsID of this - * Model as id is not null. + * @return <code>true</code> if the UnitDefinition which has the volumeUnitsID of this + * Model as id is not <code>null</code>. */ public boolean isSetVolumeUnitsInstance() { return getVolumeUnitsInstance() != null; @@ -3760,6 +3763,14 @@ String pId = lp.getId(); if ((r != null) && r.isSetId()) { if (delete) { + // Check if this method was called by some cloned object. + // In this case we must not delete the references to the objects + // within this model. + Reaction rTest = getReaction(r.getId()); + if ((rTest == null) || (rTest != r) || !rTest.isSetKineticLaw() + || (rTest.getKineticLaw().getLocalParameter(lp.getId()) == null)) { + return false; + } if (mapOfLocalParameters != null) { SortedSet<String> reactionSet = mapOfLocalParameters.get(pId); if (reactionSet != null) { @@ -3785,7 +3796,7 @@ } return false; } - + /** * Registers the identifier of a {@link NamedSBase} and its associated object * in this {@link Model}. @@ -3796,6 +3807,8 @@ * If <code>true</code> the identifier of the given {@link NamedSBase} * will be registered in this {@link Model} Otherwise, the given * identifier will be removed from this {@link Model}'s hash. + * @return <code>true</code> if this operation was successfully performed, + * <code>false</code> otherwise. */ boolean registerId(NamedSBase nsb, boolean add) { return registerIds(nsb.getParentSBMLObject(), nsb, true, !add); @@ -3811,9 +3824,13 @@ private boolean registerId(UniqueNamedSBase unsb, boolean recursively, boolean delete) { String id = unsb.getId(); if (delete && (mapOfUniqueNamedSBases != null)) { + // Check if this method was called from some cloned element that is not part of this model: + if (mapOfUniqueNamedSBases.get(id) != unsb) { + return false; + } mapOfUniqueNamedSBases.remove(id); if (logger.isDebugEnabled()) { - logger.debug(String.format("removed id=%s from model%s", + logger.debug(MessageFormat.format("removed id={0} from model{1}", id, (isSetId() ? " " + getId() : ""))); } } else if (unsb.isSetId()) { @@ -3881,6 +3898,11 @@ if (add) { return mapOfUnitDefinitions.put(ud.getId(), ud) == null; } + // Check if the element to be removed is part of this model or maybe a clone: + UnitDefinition unitDef = mapOfUnitDefinitions.get(ud); + if ((unitDef != null) && (unitDef != ud)) { + return false; + } return mapOfUnitDefinitions.remove(ud.getId()) != null; } @@ -3900,8 +3922,7 @@ if (newNsb.isSetId()) { if (newNsb instanceof UniqueNamedSBase) { return registerId((UniqueNamedSBase) newNsb, recursively, delete); - } else if ((newNsb instanceof LocalParameter) - && (parent.getParent() != null)) { + } else if ((newNsb instanceof LocalParameter) && (parent.getParent() != null)) { return registerId((KineticLaw) parent.getParent(), (LocalParameter) newNsb, delete); } else if (newNsb instanceof UnitDefinition) { @@ -4058,7 +4079,7 @@ * Removes the Parameter 'parameter' from this Model. * * @param parameter - * @return true if the {@link Parameter} was found and removed. + * @return <code>true</code> if the {@link Parameter} was found and removed. */ public boolean removeParameter(Parameter parameter) { return getListOfParameters().remove(parameter); @@ -4088,7 +4109,7 @@ * Removes a reaction from the model. * * @param reac - * @return true if the {@link Reaction} was found and removed. + * @return <code>true</code> if the {@link Reaction} was found and removed. */ public boolean removeReaction(Reaction reac) { return getListOfReactions().remove(reac); @@ -4140,7 +4161,7 @@ * Removes a species from the model. * * @param spec - * @return true if the {@link Species} was found and removed. + * @return <code>true</code> if the {@link Species} was found and removed. */ public boolean removeSpecies(Species spec) { return getListOfSpecies().remove(spec); @@ -4204,7 +4225,7 @@ * Removes a {@link UnitDefinition} of the {@link Model}. * * @param unitDefininition - * @return true if the UnitDefinition 'unitDefinition' has been removed from + * @return <code>true</code> if the UnitDefinition 'unitDefinition' has been removed from * the Model. */ public boolean removeUnitDefinition(UnitDefinition unitDefininition) { Modified: trunk/core/src/org/sbml/jsbml/SBMLDocument.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -777,9 +777,17 @@ if (add) { return mappingFromMetaId2SBase.put(sbase.getMetaId(), sbase) == null; } else { - return mappingFromMetaId2SBase.remove(sbase.getMetaId()) != null; + SBase old = mappingFromMetaId2SBase.get(sbase.getMetaId()); + if ((old != null) && (old != sbase)) { + /* This check is needed because the given SBase might originate from a + * different Document or could be a clone of some other SBase registered + * here. + */ + return mappingFromMetaId2SBase.remove(sbase.getMetaId()) != null; + } } - } return false; + } + return false; } Modified: trunk/core/src/org/sbml/jsbml/SBO.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBO.java 2012-04-27 15:43:04 UTC (rev 1248) +++ trunk/core/src/org/sbml/jsbml/SBO.java 2012-05-08 08:07:37 UTC (rev 1249) @@ -917,6 +917,14 @@ } /** + * Returns the SBO term id for macromolecule. + * @return + */ + public static int getMacromolecule() { + return 245; + } + + /** * * @return */ @@ -2165,6 +2173,6 @@ */ public static int stringToInt(String sboTerm) { return checkTerm(sboTerm) ? Integer.parseInt(sboTerm.substring(4)) : -1; - } + } } Modified: trunk/core/src/org/sbml/jsbml/SB... [truncated message content] |
From: <and...@us...> - 2012-05-15 07:43:14
|
Revision: 1257 http://jsbml.svn.sourceforge.net/jsbml/?rev=1257&view=rev Author: andreas-draeger Date: 2012-05-15 07:43:01 +0000 (Tue, 15 May 2012) Log Message: ----------- - Updated the version number in the trunk version of JSBML 1.0-rc1 because the previous value 0.8-rc1 was not appropriate anymore. - SBML Layout extension contained bugs that caused endless recursion when trying to access referenced instances of NamedSBase from a glyph (such as CompartmentGlyph, SpeciesGlyph etc.). - The pow function in the formula compiler was not working properly. - Added more convenient methods for Unit manipulation on ASTNode. Unit checks should be unified in all classes that can be associated with units. Currently, JSBML has three different implementations of the identical check. Modified Paths: -------------- trunk/core/NEWS.txt trunk/core/src/org/sbml/jsbml/ASTNode.java trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java trunk/core/src/org/sbml/jsbml/JSBML.java trunk/core/src/org/sbml/jsbml/KineticLaw.java trunk/core/src/org/sbml/jsbml/Unit.java trunk/core/src/org/sbml/jsbml/util/compilers/FindUnitsCompiler.java trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompiler.java trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompilerNoPiecewise.java trunk/core/src/org/sbml/jsbml/util/compilers/MathMLXMLStreamCompiler.java trunk/core/src/org/sbml/jsbml/util/filters/NameFilter.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java Modified: trunk/core/NEWS.txt =================================================================== --- trunk/core/NEWS.txt 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/NEWS.txt 2012-05-15 07:43:01 UTC (rev 1257) @@ -57,6 +57,10 @@ * Bug Fixes: + - SBML Layout extension contained bugs that caused endless recursion when + trying to access referenced instances of NamedSBase from a glyph (such + as CompartmentGlyph, SpeciesGlyph etc.). + - It was sometimes possible to unregister elements from a model that were the result of cloning, removal of the original entry and linking the clone to the model. When altering the previous element, pointers were deleted Modified: trunk/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -3541,6 +3541,22 @@ this.unitId = unitId; this.firePropertyChange(TreeNodeChangeEvent.units, oldValue, unitId); } + + /** + * + * @param unit + */ + public void setUnits(Unit.Kind unit) { + setUnits(unit.toString().toLowerCase()); + } + + /** + * + * @param ud + */ + public void setUnits(UnitDefinition ud) { + setUnits(ud.getId()); + } /** * Sets the value of this ASTNode to the given double number and sets the Modified: trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -20,6 +20,8 @@ package org.sbml.jsbml; +import java.text.MessageFormat; + import org.sbml.jsbml.Unit.Kind; import org.sbml.jsbml.util.TreeNodeChangeEvent; @@ -262,7 +264,7 @@ if ((units != null) && (units.trim().length() == 0)) { units = null; // If we pass the empty String or null, the value is reset. } - + // TODO: Use the method Units.isValidUnit here! String oldUnits = this.unitsID; if (units == null) { unitsID = null; @@ -284,7 +286,7 @@ } } if (illegalArgument) { - throw new IllegalArgumentException(String.format( + throw new IllegalArgumentException(MessageFormat.format( JSBML.ILLEGAL_UNIT_EXCEPTION_MSG, units)); } } Modified: trunk/core/src/org/sbml/jsbml/JSBML.java =================================================================== --- trunk/core/src/org/sbml/jsbml/JSBML.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/JSBML.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -49,7 +49,7 @@ * Error message for the case that an invalid unit identifier is to be added * to this object. */ - public static final String ILLEGAL_UNIT_EXCEPTION_MSG = "Cannot identify unit %s in the model. Only a valid unit kind or the identifier of an existing unit definition are allowed."; + public static final String ILLEGAL_UNIT_EXCEPTION_MSG = "Cannot identify unit {0} in the model. Only a valid unit kind or the identifier of an existing unit definition are allowed."; public static final int INDEX_EXCEEDS_SIZE = -1; public static final int INVALID_ATTRIBUTE_VALUE = -4; public static final int INVALID_OBJECT = -5; @@ -57,7 +57,7 @@ /** * The current version number of JSBML. */ - private static final String jsbmlVersion = "0.8-rc1"; // TODO : replace automatically this version number with [BUILD.NUMBER] + private static final String jsbmlVersion = "1.0-rc1"; // TODO : replace automatically this version number with [BUILD.NUMBER] public static final int LEVEL_MISMATCH = -7; public static final int OPERATION_FAILED = -3; Modified: trunk/core/src/org/sbml/jsbml/KineticLaw.java =================================================================== --- trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -20,6 +20,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.HashMap; import java.util.Map; @@ -856,6 +857,7 @@ @Deprecated public void setUnits(String units) { String oldUnits = this.unitsID; + // TODO: Use the method Units.isValidUnit here! if (units == null) { unitsID = null; } else { @@ -874,7 +876,7 @@ } } if (illegalArgument) { - throw new IllegalArgumentException(String.format( + throw new IllegalArgumentException(MessageFormat.format( JSBML.ILLEGAL_UNIT_EXCEPTION_MSG, units)); } } Modified: trunk/core/src/org/sbml/jsbml/Unit.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Unit.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/Unit.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -1005,7 +1005,7 @@ public static boolean isValidUnit(Model model, String unit) { boolean isValidUnit = false; - if (unit != null && model != null) { + if ((unit != null) && (model != null)) { unit = unit.trim(); if (unit.length() > 0) { if (Kind.isValidUnitKindString(unit, model.getLevel(), model @@ -1015,7 +1015,7 @@ isValidUnit = true; } } - } else if (model == null && unit != null) { + } else if ((model == null) && (unit != null)) { isValidUnit = true; } Modified: trunk/core/src/org/sbml/jsbml/util/compilers/FindUnitsCompiler.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/compilers/FindUnitsCompiler.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/util/compilers/FindUnitsCompiler.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -185,7 +185,7 @@ */ public ASTNodeValue compile(double mantissa, int exponent, String units) { - if (units != null && units.length() > 0) { + if ((units != null) && (units.length() > 0)) { isUnitsDefined = true; throw new SBMLException("Stopping the recursion, a units has been found and the SBML namespace is needed."); } @@ -198,7 +198,7 @@ */ public ASTNodeValue compile(double real, String units) { - if (units != null && units.length() > 0) { + if ((units != null) && (units.length() > 0)) { isUnitsDefined = true; throw new SBMLException("Stopping the recursion, a units has been found and the SBML namespace is needed."); } @@ -211,7 +211,7 @@ */ public ASTNodeValue compile(int integer, String units) { - if (units != null && units.length() > 0) { + if ((units != null) && (units.length() > 0)) { isUnitsDefined = true; throw new SBMLException("Stopping the recursion, a units has been found and the SBML namespace is needed."); } Modified: trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompiler.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompiler.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompiler.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -262,163 +262,106 @@ return arith('*', factors); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#abs(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#abs(org.sbml.jsbml.ASTNode) */ public ASTNodeValue abs(ASTNode node) throws SBMLException { return function("abs", node); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#and(java.util.List) */ public ASTNodeValue and(List<ASTNode> nodes) throws SBMLException { return logicalOperation(" and ", nodes); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccos(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccos(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arccos(ASTNode node) throws SBMLException { return function("acos", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccosh(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccosh(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arccosh(ASTNode node) throws SBMLException { return function("acosh", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccot(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccot(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arccot(ASTNode node) throws SBMLException { return function("acot", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccoth(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccoth(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arccoth(ASTNode node) throws SBMLException { return function("acoth", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccsc(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccsc(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arccsc(ASTNode node) throws SBMLException { return function("acsc", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccsch(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arccsch(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arccsch(ASTNode node) throws SBMLException { return function("acsch", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsec(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsec(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arcsec(ASTNode node) throws SBMLException { return function("asec", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsech(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsech(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arcsech(ASTNode node) throws SBMLException { return function("asech", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsin(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsin(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arcsin(ASTNode node) throws SBMLException { return function("asin", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsinh(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arcsinh(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arcsinh(ASTNode node) throws SBMLException { return function("asinh", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arctan(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arctan(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arctan(ASTNode node) throws SBMLException { return function("atan", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#arctanh(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#arctanh(org.sbml.jsbml.ASTNode) */ public ASTNodeValue arctanh(ASTNode node) throws SBMLException { return function("atanh", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#ceiling(org.sbml.jsbml. - * ASTNode) + /* (non-Javadoc) + * @seeorg.sbml.jsbml.util.compilers.ASTNodeCompiler#ceiling(org.sbml.jsbml.ASTNode) */ public ASTNodeValue ceiling(ASTNode node) throws SBMLException { return function("ceil", node); @@ -437,7 +380,7 @@ if (node.isSum() || node.isDifference() || node.isUMinus()) { term = brackets(term).toString(); } else if (node.isReal()) { - if (node.getReal() < 0.0) { + if (node.getReal() < 0d) { term = brackets(term).toString(); } } @@ -453,30 +396,27 @@ * @throws SBMLException */ private String checkDenominatorBrackets(ASTNode nodes) throws SBMLException { - String term = nodes.compile(this).toString(); - if (nodes.isSum() || nodes.isDifference() || nodes.isUMinus() - || nodes.getType() == Type.TIMES) { - term = brackets(term).toString(); - } - return term; + if ((nodes.getType() == Type.POWER) && (nodes.getChildCount() > 1) + && nodes.getRightChild().toString().equals("1")) { + return checkDenominatorBrackets(nodes.getLeftChild()); + } + String term = nodes.compile(this).toString(); + if (nodes.isSum() || nodes.isDifference() || nodes.isUMinus() + || (nodes.getType() == Type.TIMES)) { + term = brackets(term).toString(); + } + return term; } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(org.sbml.jsbml. - * Compartment) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(org.sbml.jsbml.Compartment) */ public ASTNodeValue compile(Compartment c) { return new ASTNodeValue(c.getId(), this); } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(double, int, - * java.lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(double, int, java.lang.String) */ public ASTNodeValue compile(double mantissa, int exponent, String units) { if (exponent == 0) { @@ -489,113 +429,78 @@ .format(mantissa), "E", exponent).toString(), this); } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(double, - * java.lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(double, java.lang.String) */ public ASTNodeValue compile(double real, String units) { return new ASTNodeValue(toString(Locale.ENGLISH, real), this); } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(int, - * java.lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(int, java.lang.String) */ public ASTNodeValue compile(int integer, String units) { return new ASTNodeValue(integer, this); } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(org.sbml.jsbml.CallableSBase) */ public ASTNodeValue compile(CallableSBase variable) { return new ASTNodeValue(variable.getId(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(java.lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#compile(java.lang.String) */ public ASTNodeValue compile(String name) { return new ASTNodeValue(name, this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#cos(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#cos(org.sbml.jsbml.ASTNode) */ public ASTNodeValue cos(ASTNode node) throws SBMLException { return function("cos", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#cosh(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#cosh(org.sbml.jsbml.ASTNode) */ public ASTNodeValue cosh(ASTNode node) throws SBMLException { return function("cosh", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#cot(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#cot(org.sbml.jsbml.ASTNode) */ public ASTNodeValue cot(ASTNode node) throws SBMLException { return function("cot", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#coth(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#coth(org.sbml.jsbml.ASTNode) */ public ASTNodeValue coth(ASTNode node) throws SBMLException { return function("coth", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#csc(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#csc(org.sbml.jsbml.ASTNode) */ public ASTNodeValue csc(ASTNode node) throws SBMLException { return function("csc", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#csch(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#csch(org.sbml.jsbml.ASTNode) */ public ASTNodeValue csch(ASTNode node) throws SBMLException { return function("csch", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#delay(java.lang.String, - * org.sbml.jsbml.ASTNode, double, java.lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#delay(java.lang.String, org.sbml.jsbml.ASTNode, double, java.lang.String) */ public ASTNodeValue delay(String delayName, ASTNode x, ASTNode y, String timeUnits) throws SBMLException { @@ -603,33 +508,22 @@ y.compile(this), ")").toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#eq(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#eq(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue eq(ASTNode left, ASTNode right) throws SBMLException { return new ASTNodeValue(relation(left, " == ", right), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#exp(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#exp(org.sbml.jsbml.ASTNode) */ public ASTNodeValue exp(ASTNode node) throws SBMLException { return function("exp", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#factorial(org.sbml.jsbml - * .ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#factorial(org.sbml.jsbml.ASTNode) */ public ASTNodeValue factorial(ASTNode node) { return new ASTNodeValue(append(brackets(node), Character.valueOf('!')) @@ -638,32 +532,25 @@ /* * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#floor(org.sbml.jsbml.ASTNode - * ) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#floor(org.sbml.jsbml.ASTNode) */ public ASTNodeValue floor(ASTNode node) throws SBMLException { return function("floor", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#frac(org.sbml.jsbml.ASTNode - * , org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#frac(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue frac(ASTNode numerator, ASTNode denominator) throws SBMLException { - return new ASTNodeValue(concat(checkBrackets(numerator), - Character.valueOf('/'), checkDenominatorBrackets(denominator)) - .toString(), this); + return new ASTNodeValue( + concat(checkBrackets(numerator), + Character.valueOf('/'), + checkDenominatorBrackets(denominator)).toString(), + this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#frac(int, int) */ public ASTNodeValue frac(int numerator, int denominator) { @@ -675,12 +562,8 @@ : compile(denominator, null)).toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#function(org.sbml.jsbml - * .FunctionDefinition, java.util.List) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#function(org.sbml.jsbml.FunctionDefinition, java.util.List) */ public ASTNodeValue function(FunctionDefinition func, List<ASTNode> nodes) throws SBMLException { @@ -718,96 +601,70 @@ .toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#geq(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#geq(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue geq(ASTNode left, ASTNode right) throws SBMLException { return new ASTNodeValue(relation(left, " >= ", right), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#getConstantAvogadro(java - * .lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getConstantAvogadro(java.lang.String) */ public ASTNodeValue getConstantAvogadro(String name) { return new ASTNodeValue("avogadro", this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getConstantE() */ public ASTNodeValue getConstantE() { return new ASTNodeValue(Character.toString('e'), this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getConstantFalse() */ public ASTNodeValue getConstantFalse() { return new ASTNodeValue(false, this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getConstantPi() */ public ASTNodeValue getConstantPi() { return new ASTNodeValue("pi", this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getConstantTrue() */ public ASTNodeValue getConstantTrue() { return new ASTNodeValue(true, this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getNegativeInfinity() */ public ASTNodeValue getNegativeInfinity() { return new ASTNodeValue(Double.NEGATIVE_INFINITY, this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#getPositiveInfinity() */ public ASTNodeValue getPositiveInfinity() { return new ASTNodeValue(Double.POSITIVE_INFINITY, this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#gt(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#gt(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue gt(ASTNode left, ASTNode right) throws SBMLException { return new ASTNodeValue(relation(left, " > ", right), this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#lambda(java.util.List) */ public ASTNodeValue lambda(List<ASTNode> nodes) throws SBMLException { @@ -835,43 +692,29 @@ return lambda.toString(); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#leq(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#leq(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue leq(ASTNode left, ASTNode right) throws SBMLException { return new ASTNodeValue(relation(left, " <= ", right), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#ln(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#ln(org.sbml.jsbml.ASTNode) */ public ASTNodeValue ln(ASTNode node) throws SBMLException { return function("log", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#log(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#log(org.sbml.jsbml.ASTNode) */ public ASTNodeValue log(ASTNode node) throws SBMLException { return function("log10", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#log(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#log(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue log(ASTNode left, ASTNode right) throws SBMLException { return function("log", left, right); @@ -904,20 +747,14 @@ return new ASTNodeValue(value.toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#lt(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#lt(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue lt(ASTNode left, ASTNode right) throws SBMLException { return new ASTNodeValue(relation(left, " < ", right), this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#minus(java.util.List) */ public ASTNodeValue minus(List<ASTNode> nodes) throws SBMLException { @@ -939,49 +776,35 @@ } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#neq(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#neq(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue neq(ASTNode left, ASTNode right) throws SBMLException { return new ASTNodeValue(relation(left, " != ", right), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#not(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#not(org.sbml.jsbml.ASTNode) */ public ASTNodeValue not(ASTNode node) throws SBMLException { return function("not", node); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#or(java.util.List) */ public ASTNodeValue or(List<ASTNode> nodes) throws SBMLException { return logicalOperation(" or ", nodes); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#piecewise(java.util.List) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#piecewise(java.util.List) */ public ASTNodeValue piecewise(List<ASTNode> nodes) throws SBMLException { return function("piecewise", nodes); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#plus(java.util.List) */ public ASTNodeValue plus(List<ASTNode> nodes) throws SBMLException { @@ -1002,26 +825,11 @@ } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#pow(org.sbml.jsbml.ASTNode, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#pow(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue pow(ASTNode left, ASTNode right) throws SBMLException { - - // Adding brackets all the time for the exponent/right ASTNode - - if (left.getChildCount() < 2) { - return new ASTNodeValue(StringTools.concat(left.compile(this), "^", "(", - right.compile(this), ")").toString(), this); - } else { - return new ASTNodeValue(StringTools.concat(Character.valueOf('('), - left.compile(this), Character.valueOf(')'), "^", "(", - right.compile(this), ")").toString(), this); - } - + return new ASTNodeValue(pow(left.compile(this), right.compile(this)).toString(), this); } /** @@ -1039,12 +847,8 @@ (right.isRelational()) ? brackets(right) : right).toString(); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#root(org.sbml.jsbml.ASTNode - * , org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#root(org.sbml.jsbml.ASTNode, org.sbml.jsbml.ASTNode) */ public ASTNodeValue root(ASTNode rootExponent, ASTNode radiant) throws SBMLException @@ -1057,15 +861,11 @@ rootExponent.compile(this), "))").toString(), this); } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#root(double, - * org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#root(double, org.sbml.jsbml.ASTNode) */ public ASTNodeValue root(double rootExponent, ASTNode radiant) - throws SBMLException - { + throws SBMLException { // Writing the root function as '(radiant)^(1/rootExponent)' return new ASTNodeValue(StringTools.concat(Character.valueOf('('), @@ -1073,95 +873,64 @@ rootExponent, ")").toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#sec(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#sec(org.sbml.jsbml.ASTNode) */ public ASTNodeValue sec(ASTNode node) throws SBMLException { return function("sec", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#sech(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#sech(org.sbml.jsbml.ASTNode) */ public ASTNodeValue sech(ASTNode node) throws SBMLException { return function("sech", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#sin(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#sin(org.sbml.jsbml.ASTNode) */ public ASTNodeValue sin(ASTNode node) throws SBMLException { return function("sin", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#sinh(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#sinh(org.sbml.jsbml.ASTNode) */ public ASTNodeValue sinh(ASTNode node) throws SBMLException { return function("sinh", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#sqrt(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#sqrt(org.sbml.jsbml.ASTNode) */ public ASTNodeValue sqrt(ASTNode node) throws SBMLException { return new ASTNodeValue(StringTools.concat(Character.valueOf('('), node.compile(this), Character.valueOf(')'), "^", "(0.5)").toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#symbolTime(java.lang.String - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#symbolTime(java.lang.String) */ public ASTNodeValue symbolTime(String time) { return new ASTNodeValue(time, this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#tan(org.sbml.jsbml.ASTNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#tan(org.sbml.jsbml.ASTNode) */ public ASTNodeValue tan(ASTNode node) throws SBMLException { return function("tan", node); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#tanh(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#tanh(org.sbml.jsbml.ASTNode) */ public ASTNodeValue tanh(ASTNode node) throws SBMLException { return function("tanh", node); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#times(java.util.List) */ public ASTNodeValue times(List<ASTNode> nodes) throws SBMLException { @@ -1173,21 +942,15 @@ return new ASTNodeValue(times(n).toString(), this); } - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#uMinus(org.sbml.jsbml.ASTNode - * ) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#uMinus(org.sbml.jsbml.ASTNode) */ public ASTNodeValue uMinus(ASTNode node) throws SBMLException { return new ASTNodeValue(concat(Character.valueOf('-'), checkBrackets(node)).toString(), this); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#unknownValue() */ public ASTNodeValue unknownValue() throws SBMLException { @@ -1195,12 +958,11 @@ "cannot write unknown syntax tree nodes to a formula String"); } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#xor(java.util.List) */ public ASTNodeValue xor(List<ASTNode> nodes) throws SBMLException { return logicalOperation(" xor ", nodes); } + } Modified: trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompilerNoPiecewise.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompilerNoPiecewise.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/util/compilers/FormulaCompilerNoPiecewise.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -55,14 +55,11 @@ * */ private String orReplacement = " | "; - - - /* - * (non-Javadoc) - * - * @see - * org.sbml.jsbml.util.compilers.ASTNodeCompiler#piecewise(java.util.List) + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.compilers.ASTNodeCompiler#piecewise(java.util.List) */ + @Override public ASTNodeValue piecewise(List<ASTNode> nodes) throws SBMLException { // create the piecewise output with if/then/else Modified: trunk/core/src/org/sbml/jsbml/util/compilers/MathMLXMLStreamCompiler.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/compilers/MathMLXMLStreamCompiler.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/util/compilers/MathMLXMLStreamCompiler.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -145,7 +145,7 @@ SBase sbase = astNode.getParentSBMLObject(); - if (sbase != null && sbase.getLevel() < 3) { + if ((sbase != null) && (sbase.getLevel() < 3)) { return false; } Modified: trunk/core/src/org/sbml/jsbml/util/filters/NameFilter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/filters/NameFilter.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/core/src/org/sbml/jsbml/util/filters/NameFilter.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -67,9 +67,7 @@ this.name = name; } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.util.Filter#fulfilsProperty(java.lang.Object) */ public boolean accepts(Object o) { Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -108,7 +108,7 @@ */ @Override public Compartment getNamedSBaseInstance() { - return (Compartment) getNamedSBaseInstance(); + return (Compartment) super.getNamedSBaseInstance(); } /** Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -55,26 +55,6 @@ /** * - */ - public ExtendedLayoutModel(Model model) { - super(model); - - this.model = model; - createListOfLayout(); - } - - /** - * Creates a new list of layout - */ - private void createListOfLayout() { - listOfLayouts = new ListOf<Layout>(); - listOfLayouts.addNamespace(LayoutConstant.namespaceURI); - listOfLayouts.setSBaseListType(ListOf.Type.other); - model.registerChild(listOfLayouts); - } - - /** - * * @param elm */ public ExtendedLayoutModel(ExtendedLayoutModel elm) { @@ -84,7 +64,16 @@ } } + /** + * + */ + public ExtendedLayoutModel(Model model) { + super(model); + this.model = model; + createListOfLayout(); + } + /** * * @param layout @@ -111,8 +100,36 @@ return new ExtendedLayoutModel(this); } - /* - * (non-Javadoc) + /** + * Creates a new layout and adds it to the current list of layouts. + * @return new layout. + */ + public Layout createLayout() { + return createLayout(null); + } + + /** + * + * @param id + * @return + */ + public Layout createLayout(String id) { + Layout layout = new Layout(id, model.getLevel(), model.getVersion()); + addLayout(layout); + return layout; + } + + /** + * Creates a new list of layout + */ + private void createListOfLayout() { + listOfLayouts = new ListOf<Layout>(); + listOfLayouts.addNamespace(LayoutConstant.namespaceURI); + listOfLayouts.setSBaseListType(ListOf.Type.other); + model.registerChild(listOfLayouts); + } + + /* (non-Javadoc) * @see org.sbml.jsbml.Model#equals(java.lang.Object) */ @Override @@ -131,16 +148,15 @@ } return equals; } - + /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getAllowsChildren() */ public boolean getAllowsChildren() { return true; } - - /* - * (non-Javadoc) + + /* (non-Javadoc) * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) */ public SBase getChildAt(int index) { @@ -149,9 +165,9 @@ } return null; } - - /* - * (non-Javadoc) + + + /* (non-Javadoc) * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() */ public int getChildCount() { @@ -162,6 +178,7 @@ return count; } + /** * * @param i @@ -170,8 +187,7 @@ public Layout getLayout(int i) { return listOfLayouts.get(i); } - - + /** * * @return @@ -182,12 +198,19 @@ } return listOfLayouts; } - - + + /** + * + * @return + */ + public Model getModel() { + return (Model) extendedSBase; + } + public Model getParent() { return model; } - + public Model getParentSBMLObject() { return model; } @@ -223,8 +246,7 @@ model.registerChild(listOfLayouts); } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override @@ -233,7 +255,7 @@ return null; } - /** + /** * Removes the {@link #listOfLayouts} from this {@link Model} and notifies * all registered instances of {@link TreeNodeChangeListener}. * @@ -249,33 +271,12 @@ } return false; } - - /* - * (non-Javadoc) + + /* (non-Javadoc) * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() */ public Map<String, String> writeXMLAttributes() { return null; } - - /** - * - * @return - */ - public Model getModel() { - return (Model) extendedSBase; - } - - - /** - * Creates a new layout and adds it to the current list of layouts. - * @return new layout. - */ - public Layout createLayout() { - Layout layout = new Layout(model.getLevel(), model.getVersion()); - addLayout(layout); - return layout; - } - } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -54,11 +54,11 @@ /** * */ - private ListOf<GraphicalObject> listOfAdditionalGraphicalObjects = new ListOf<GraphicalObject>(); + private Dimensions dimensions; /** * */ - private Dimensions dimensions; + private ListOf<GraphicalObject> listOfAdditionalGraphicalObjects = new ListOf<GraphicalObject>(); /** * */ @@ -94,7 +94,8 @@ initDefault(); } - /** + + /** * @param layout * */ @@ -121,8 +122,20 @@ } } + /** * + * @param id + * @param level + * @param version + */ + public Layout(String id, int level, int version) { + super(id, level, version); + initDefault(); + } + + /** + * * @param reactionGlyph */ public void add(ReactionGlyph reactionGlyph) { @@ -202,6 +215,49 @@ } /** + * + * @param compartment + * @return + */ + public boolean containsGlyph(Compartment compartment) { + return containsGlyph(listOfCompartmentGlyphs, compartment); + } + + /** + * + * @param listOfGlyphs + * @param nsb + * @return + */ + private <T extends NamedSBaseGlyph> boolean containsGlyph(ListOf<T> listOfGlyphs, + NamedSBase nsb) { + if ((nsb != null) && (listOfGlyphs != null) && !listOfGlyphs.isEmpty()) { + NamedSBaseReferenceFilter filter = new NamedSBaseReferenceFilter(nsb.getId()); + filter.setFilterForReference(true); + return listOfGlyphs.firstHit(filter) != null; + } + return false; + } + + /** + * + * @param reaction + * @return + */ + public boolean containsGlyph(Reaction reaction) { + return containsGlyph(listOfReactionGlyphs, reaction); + } + + /** + * + * @param species + * @return + */ + public boolean containsGlyph(Species species) { + return containsGlyph(listOfSpeciesGlyphs, species); + } + + /** * Creates and adds a new {@link CompartmentGlyph}. * @param compartment {@link Compartment} ID. * @return new {@link CompartmentGlyph}. @@ -241,7 +297,7 @@ addReactionGlyph(glyph); return glyph; } - + /** * Creates and adds a new {@link SpeciesGlyph}. * @param species {@link Species} ID. @@ -293,7 +349,7 @@ } return new ArrayList<T>(0); } - + /** * Searches all instances of {@link ReactionGlyph} within this {@link Layout} that * refer to the {@link Reaction} with the given id. @@ -317,7 +373,7 @@ public List<SpeciesGlyph> findSpeciesGlyphs(String speciesID) { return findGlyphs(listOfSpeciesGlyphs, speciesID); } - + /** * * @param i @@ -330,7 +386,7 @@ } return null; } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) */ @@ -383,7 +439,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @@ -423,7 +479,7 @@ } return null; } - + /** * * @param id @@ -435,7 +491,7 @@ } return null; } - + /** * * @return @@ -451,7 +507,7 @@ public ListOf<GraphicalObject> getListOfAdditionalGraphicalObjects() { return listOfAdditionalGraphicalObjects; } - + /** * * @return @@ -465,7 +521,8 @@ } return listOfCompartmentGlyphs; } - + + /** * * @return @@ -479,7 +536,7 @@ } return listOfReactionGlyphs; } - + /** * * @return @@ -493,7 +550,7 @@ } return listOfSpeciesGlyphs; } - + /** * * @return @@ -507,7 +564,7 @@ } return listOfTextGlyphs; } - + /** * * @param i @@ -520,7 +577,6 @@ } return null; } - /** * @@ -533,7 +589,7 @@ } return null; } - + /** * * @param i @@ -560,32 +616,34 @@ } return null; } - + + /** + * + */ private void initDefault() { - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstant.namespaceURI); - listOfCompartmentGlyphs.addNamespace(LayoutConstant.namespaceURI); - listOfCompartmentGlyphs.setSBaseListType(ListOf.Type.other); - registerChild(listOfCompartmentGlyphs); - - listOfSpeciesGlyphs.addNamespace(LayoutConstant.namespaceURI); - listOfSpeciesGlyphs.setSBaseListType(ListOf.Type.other); - registerChild(listOfSpeciesGlyphs); + listOfCompartmentGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfCompartmentGlyphs.setSBaseListType(ListOf.Type.other); + registerChild(listOfCompartmentGlyphs); - listOfReactionGlyphs.addNamespace(LayoutConstant.namespaceURI); - listOfReactionGlyphs.setSBaseListType(ListOf.Type.other); - registerChild(listOfReactionGlyphs); + listOfSpeciesGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfSpeciesGlyphs.setSBaseListType(ListOf.Type.other); + registerChild(listOfSpeciesGlyphs); - listOfTextGlyphs.addNamespace(LayoutConstant.namespaceURI); - listOfTextGlyphs.setSBaseListType(ListOf.Type.other); - registerChild(listOfTextGlyphs); + listOfReactionGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfReactionGlyphs.setSBaseListType(ListOf.Type.other); + registerChild(listOfReactionGlyphs); - listOfAdditionalGraphicalObjects.addNamespace(LayoutConstant.namespaceURI); - listOfAdditionalGraphicalObjects.setSBaseListType(ListOf.Type.other); - registerChild(listOfAdditionalGraphicalObjects); + listOfTextGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfTextGlyphs.setSBaseListType(ListOf.Type.other); + registerChild(listOfTextGlyphs); -} - + listOfAdditionalGraphicalObjects.addNamespace(LayoutConstant.namespaceURI); + listOfAdditionalGraphicalObjects.setSBaseListType(ListOf.Type.other); + registerChild(listOfAdditionalGraphicalObjects); + } + /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ @@ -600,14 +658,14 @@ public boolean isSetAddGraphicalObjects() { return (listOfAdditionalGraphicalObjects != null) && (listOfAdditionalGraphicalObjects.size() > 0); } - + /** * @return */ public boolean isSetDimensions() { return dimensions != null; } - + /** * @return */ @@ -628,7 +686,7 @@ public boolean isSetListOfReactionGlyphs() { return (listOfReactionGlyphs != null) && (listOfReactionGlyphs.size() > 0); } - + /** * * @return @@ -643,7 +701,7 @@ public boolean isSetListOfTextGlyphs() { return (listOfTextGlyphs != null) && (listOfTextGlyphs.size() > 0); } - + /** * @param attributeName * @param prefix @@ -657,49 +715,6 @@ value); return isAttributeRead; } - - /** - * - * @param compartment - * @return - */ - public boolean containsGlyph(Compartment compartment) { - return containsGlyph(listOfCompartmentGlyphs, compartment); - } - - /** - * - * @param listOfGlyphs - * @param nsb - * @return - */ - private <T extends NamedSBaseGlyph> boolean containsGlyph(ListOf<T> listOfGlyphs, - NamedSBase nsb) { - if ((nsb != null) && (listOfGlyphs != null) && !listOfGlyphs.isEmpty()) { - NamedSBaseReferenceFilter filter = new NamedSBaseReferenceFilter(nsb.getId()); - filter.setFilterForReference(true); - return listOfGlyphs.firstHit(filter) != null; - } - return false; - } - - /** - * - * @param reaction - * @return - */ - public boolean containsGlyph(Reaction reaction) { - return containsGlyph(listOfReactionGlyphs, reaction); - } - - /** - * - * @param species - * @return - */ - public boolean containsGlyph(Species species) { - return containsGlyph(listOfSpeciesGlyphs, species); - } /** * Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -210,7 +210,7 @@ */ @Override public Reaction getNamedSBaseInstance() { - return (Reaction) getNamedSBaseInstance(); + return (Reaction) super.getNamedSBaseInstance(); } /** Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -93,7 +93,7 @@ */ @Override public Species getNamedSBaseInstance() { - return (Species) getNamedSBaseInstance(); + return (Species) super.getNamedSBaseInstance(); } /** @@ -111,7 +111,7 @@ public Species getSpeciesInstance() { return getNamedSBaseInstance(); } - + /** * @return the {@link #speciesId} */ Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -184,7 +184,7 @@ */ @Override public SimpleSpeciesReference getNamedSBaseInstance() { - return (SimpleSpeciesReference) getNamedSBaseInstance(); + return (SimpleSpeciesReference) super.getNamedSBaseInstance(); } /** Modified: trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java =================================================================== --- trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java 2012-05-14 12:02:32 UTC (rev 1256) +++ trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java 2012-05-15 07:43:01 UTC (rev 1257) @@ -17,6 +17,7 @@ package org.sbml.jsbml.cdplugin; import java.beans.PropertyChangeEvent; +import java.text.MessageFormat; import java.util.Enumeration; import javax.swing.tree.TreeNode; @@ -498,7 +499,7 @@ pKlaw.setTimeUnits(klaw.getTimeUnits()); plugin.notifySBaseChanged(pKlaw); } else if (eventsource instanceof Model){ - logger.log(Level.DEBUG, String.format("Changing %s in the Model only supported with SBML version > 3.", eventsource.getClass().getSimpleName())); + logger.log(Level.DEBUG, MessageFormat.format("Changing {0} in the Model only supported with SBML version > 3.", eventsource.getClass().getSimpleName())); } } else if (prop.equals(TreeNodeChangeEvent.type)) { ASTNode n = (ASTNode) eventsource; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-05-23 10:17:47
|
Revision: 1273 http://jsbml.svn.sourceforge.net/jsbml/?rev=1273&view=rev Author: andreas-draeger Date: 2012-05-23 10:17:36 +0000 (Wed, 23 May 2012) Log Message: ----------- Removed override tags where these caused compilation problems with 1.5. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/xml/XMLNode.java trunk/core/src/org/sbml/jsbml/xml/XMLToken.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java Property Changed: ---------------- trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java Modified: trunk/core/src/org/sbml/jsbml/xml/XMLNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/XMLNode.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/core/src/org/sbml/jsbml/xml/XMLNode.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -262,7 +262,7 @@ * @param orig the {@link XMLNode} instance to copy. */ public XMLNode(XMLNode orig) { - super((XMLToken) orig); + super(orig); if (orig.childrenElements.size() > 0) { for (XMLNode origchildren : orig.childrenElements) { @@ -454,8 +454,7 @@ return OPERATION_SUCCESS; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.xml.XMLToken#clone() */ public XMLNode clone() { Modified: trunk/core/src/org/sbml/jsbml/xml/XMLToken.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/XMLToken.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/core/src/org/sbml/jsbml/xml/XMLToken.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -30,7 +30,7 @@ * Representation of a token in an XML stream. * <p> * <em style='color: #555'> - * This class of objects is defined by jsbml only and has no direct + * This class of objects is defined by JSBML only and has no direct * equivalent in terms of SBML components. This class is not prescribed by * the SBML specifications, although it is used to implement features * defined in SBML. @@ -542,16 +542,14 @@ } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#clone() */ @Override public abstract XMLToken clone(); - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractTreeNode#equals(java.lang.Object) */ @Override @@ -1524,8 +1522,7 @@ } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -42,9 +42,9 @@ clonePointAttributes(point, this); } -@Override + @Override public Position clone() { - return new Position(this); + return new Position(this); } } Modified: trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/qual/src/org/sbml/jsbml/xml/parsers/QualParser.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -273,6 +273,7 @@ /* (non-Javadoc) * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#writeElement(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) */ + @Override public void writeElement(SBMLObjectForXML xmlObject, Object sbmlElementToWrite) { @@ -282,7 +283,7 @@ logger.debug("writeElement : " + sbmlElementToWrite.getClass().getSimpleName()); } - if (sbmlElementToWrite instanceof FunctionTerm && + if ((sbmlElementToWrite instanceof FunctionTerm) && ((FunctionTerm) sbmlElementToWrite).isDefaultTerm()) { xmlObject.setName("defaultTerm"); Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -116,6 +116,7 @@ versionMinor = 0; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; @@ -249,34 +250,50 @@ return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) + */ + // @Override public boolean readAttribute(String attributeName, String prefix, String value) { // TODO Auto-generated method stub return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) + */ + // @Override public TreeNode getChildAt(int childIndex) { // TODO Auto-generated method stub return null; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() + */ + // @Override public int getChildCount() { // TODO Auto-generated method stub return 0; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getAllowsChildren() + */ + // @Override public boolean getAllowsChildren() { // TODO Auto-generated method stub return false; } - @Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() + */ + // @Override public Map<String, String> writeXMLAttributes() { // TODO Auto-generated method stub return null; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -162,7 +162,7 @@ return false; } - + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontFamily.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -27,6 +27,7 @@ * @since 1.0 * @date 16.05.2012 */ +//TODO: Set SVN properties. public enum FontFamily { serif, sans_serif, Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -26,6 +26,7 @@ * @since 1.0 * @date 16.05.2012 */ +//TODO: Set SVN properties. public interface FontRenderStyle { /** @@ -182,4 +183,5 @@ * otherwise <code>false</code> */ public abstract boolean unsetVTextAnchor(); + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -108,6 +108,7 @@ /** * clones this class */ + @Override public GlobalRenderInformation clone() { return new GlobalRenderInformation(this); } @@ -116,12 +117,14 @@ /** * Initializes the default values using the namespace. */ + @Override public void initDefaults() { addNamespace(RenderConstants.namespaceURI); // TODO: init default values here if necessary, e.g.: // bar = null; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -179,6 +179,7 @@ return false; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -235,7 +235,7 @@ /** * */ - + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -26,6 +26,7 @@ * @since 1.0 * @date 16.05.2012 */ +//TODO: Set SVN properties. public interface Point3D { /** @@ -182,4 +183,5 @@ * otherwise <code>false</code> */ public abstract boolean unsetZ(); + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -746,19 +746,29 @@ ry = 0d; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getAllowsChildren() + */ @Override public boolean getAllowsChildren() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildCount() + */ @Override public int getChildCount() { return 0; } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.render.GraphicalPrimitive1D#getChildAt(int) + */ @Override public SBase getChildAt(int childIndex) { if (childIndex < 0) { Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -36,6 +36,8 @@ * @date 08.05.2012 */ public class RenderCubicBezier extends RenderPoint { + + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; /** Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -530,7 +530,7 @@ } - + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -76,6 +76,7 @@ // bar = null; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -35,6 +35,7 @@ */ public class RenderModelPlugin extends AbstractRenderPlugin { + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderPoint.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -37,8 +37,11 @@ * @date 08.05.2012 */ public class RenderPoint extends AbstractSBase implements Point3D { + + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; + /** * */ Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -122,6 +122,7 @@ this.typeList = null; } + // TODO: Move to RenderConstants public static final int MIN_SBML_LEVEL = 3; public static final int MIN_SBML_VERSION = 1; Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Text.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -562,4 +562,5 @@ } return false; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/TextAnchor.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -30,6 +30,7 @@ * @since 1.0 * @date 16.05.2012 */ +// TODO: Set SVN properties. public enum TextAnchor { start, middle, Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -33,6 +33,7 @@ * @date 08.05.2012 */ public class Transformation extends AbstractSBase { + protected Double[] transform = new Double[12]; /* (non-Javadoc) @@ -52,4 +53,5 @@ // TODO Auto-generated method stub return null; } + } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/VTextAnchor.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -30,6 +30,7 @@ * @since 1.0 * @date 16.05.2012 */ +// TODO: Set SVN properties. public enum VTextAnchor { top, middle, Modified: trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java =================================================================== --- trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -1,6 +1,6 @@ /* - * $Id: FormulaTest.java 102 2009-12-13 19:52:50Z andreas-draeger $ - * $URL: https://jsbml.svn.sourceforge.net/svnroot/jsbml/trunk/src/org/sbml/jsbml/io/FormulaTest.java $ + * $Id$ + * $URL$ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. Property changes on: trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/SimpleApplication.java ___________________________________________________________________ Added: svn:keywords + Id URL Rev Modified: trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java =================================================================== --- trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java 2012-05-23 10:05:40 UTC (rev 1272) +++ trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java 2012-05-23 10:17:36 UTC (rev 1273) @@ -1,6 +1,6 @@ /* - * $Id: FormulaTest.java 102 2009-12-13 19:52:50Z andreas-draeger $ - * $URL: https://jsbml.svn.sourceforge.net/svnroot/jsbml/trunk/src/org/sbml/jsbml/io/FormulaTest.java $ + * $Id$ + * $URL$ * ---------------------------------------------------------------------------- * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> * for the latest version of JSBML and more information about SBML. Property changes on: trunk/modules/libSBMLio/test/org/sbml/jsbml/test/LibSBMLioTest.java ___________________________________________________________________ Added: svn:keywords + Id URL Rev This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-03 09:33:24
|
Revision: 1280 http://jsbml.svn.sourceforge.net/jsbml/?rev=1280&view=rev Author: andreas-draeger Date: 2012-06-03 09:33:15 +0000 (Sun, 03 Jun 2012) Log Message: ----------- The new specialized EventObject TreeNodeRemovedEvent has been implemented in order to make sure that deleted nodes do no longer have a pointer to their previous parent within the tree. At the same time, it is still possible to identify their previous location using the field in the new EventObject. SBasePlugin has now also become a TreeNodeWithChangeSupport and AbstractSBasePlugin in turn extends AbstractTreeNode. Modified Paths: -------------- trunk/core/NEWS.txt trunk/core/doc/img/FullTypeHierarchy.dot trunk/core/doc/img/FullTypeHierarchy.pdf trunk/core/doc/img/FullTypeHierarchy.png trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java trunk/core/src/org/sbml/jsbml/ListOf.java trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java trunk/core/test/org/sbml/jsbml/test/ListenerTest.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java trunk/modules/compare/test/org/sbml/jsbml/test/ReactionReadTest.java trunk/modules/compare/test/org/sbml/jsbml/test/SBMLReaderTest.java trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/LibSBMLChangeListener.java Added Paths: ----------- trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java Modified: trunk/core/NEWS.txt =================================================================== --- trunk/core/NEWS.txt 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/NEWS.txt 2012-06-03 09:33:15 UTC (rev 1280) @@ -6,6 +6,9 @@ * New Features: + - SBasePlugin has now also become a TreeNodeWithChangeSupport and + AbstractSBasePlugin in turn extends AbstractTreeNode. + - The Unit class has two new methods: removeOffset and removeMultiplier. The first one computes a new multiplier from the old offset, the old multiplier, and the scale and then sets @@ -169,6 +172,110 @@ map between ids and local parameters, instead of the remove method. ====================================================================== +Version 0.8.0 (15-05-2012) +====================================================================== + +* New Features: + + - The new specialized EventObject TreeNodeRemovedEvent has been + implemented in order to make sure that deleted nodes do no longer + have a pointer to their previous parent within the tree. At the + same time, it is still possible to identify their previous + location using the field in the new EventObject. + +* Bug Fixes: + + - There is now a rounding correction for multipliers when merging units + that tries to shift multipliers to the scale of a unit. This can only + be done if the logarithm to the base 10 of the multiplier is nearly + an integer number. Nearly means that the distance to the next integer + is not larger than the ensured double precision. + + - [Tracker item #3511439] : The cloning of a Species was not copying the + speciesType attribute. Thanks to Thomas Bernard who noticed and reported + the problem. + + - The units attribute on ASTNode was sometime not written out and the sbml + namespace was sometime missing from the mathML. It should be fine now. + +* Known issues : + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + - The RDF block at the top level of the annotation is considered to be the + official SBML annotation. + - SBML L3 packages are not supported and not kept. + +====================================================================== +Version 0.8-rc2 (12-04-2012) +====================================================================== + +* User visible changes : + + - Major improvements of the reading and writing speed for large models. + +* Bug Fixes: + + - It was forgotten to implement an unsetSubstanceUnits method on the Model + class. Thanks to Robert Byrnes for reporting this problem. + + - In the Reaction class, the setReversible method only accepted Boolean, + no boolean. + + - Several bug fixes and improvements to units derivation, merging and + simplifying. + + - There was a bug in KineticLaw that prevented a correct iteration + through all child elements. + + - When cloning JSBML wrongly assigned the same TreeNodeChangeListeners + to the new data structure. Now, the TreeNodeChangeListeners are not + copied when cloning a JSBML object. + + - The clone methods were corrected to register properly all entities + with an id. + + - QuantityWithUnit did not fire update events when changing its value + because of an incorrect comparison between the previous and the new + value. + + - Corrected a bug that made it impossible to set a kinetic law with an + existing list of local parameters as the new kinetic law in a + different reaction. + + - Meike Aichele detected and fixed the problem that some Listeners were + set too soon in the Model class, so that no Event was detected. + + - One rdf namespace declaration was missing when creating an History + element from scratch. + + - [Tracker item #3511439] : Model.getSpeciesType(String) was + corrected and it's speed improved. Thanks to Thomas Bernard who noticed + and reported the problem. + + - Annotation elements that are missing a proper namespace declaration will + be correctly read and not considered as improper SBML elements. + + - [Tracker item #3487517] : If one empty rdf Bag element was present in an + annotation read by jsbml, an XML element was not closed properly, + resulting in an invalid generated SBML. Thanks to Anna Zhukova to report + this problem. + + - [Tracker item #3434930] : The parsing of a Message as an XML String was + incorrect as the method was expecting only a notes element to enclose + the HTML. + + * Known issues : + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + - The RDF block at the top level of the annotation is considered to be the + official SBML annotation. + - SBML L3 packages are not supported and not kept. + +====================================================================== Version 0.8-rc1 (xx-xx-2011) ====================================================================== Modified: trunk/core/doc/img/FullTypeHierarchy.dot =================================================================== --- trunk/core/doc/img/FullTypeHierarchy.dot 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/doc/img/FullTypeHierarchy.dot 2012-06-03 09:33:15 UTC (rev 1280) @@ -160,6 +160,7 @@ AbstractMathContainer -> StoichiometryMath [dir=back,arrowtail=empty]; AbstractMathContainer -> Trigger [dir=back,arrowtail=empty]; AbstractTreeNode -> AbstractSBase [dir=back,arrowtail=empty]; + AbstractTreeNode -> AbstractSBasePlugin [dir=back,arrowtail=empty]; AbstractTreeNode -> AnnotationElement [dir=back,arrowtail=empty]; AbstractTreeNode -> ASTNode [dir=back,arrowtail=empty]; AbstractTreeNode -> TreeNodeAdapter [dir=back,arrowtail=empty]; @@ -174,7 +175,6 @@ CallableSBase -> Quantity [dir=back,arrowtail=empty,style=dashed]; CallableSBase -> FunctionDefinition [dir=back,arrowtail=empty,style=dashed]; CallableSBase -> Reaction [dir=back,arrowtail=empty,style=dashed]; - Cloneable -> SBasePlugin [dir=back,arrowtail=empty,style=dashed]; Cloneable -> TreeNodeWithChangeSupport [dir=back,arrowtail=empty,style=dashed]; ExplicitRule -> AssignmentRule [dir=back,arrowtail=empty]; ExplicitRule -> RateRule [dir=back,arrowtail=empty]; @@ -207,7 +207,6 @@ SBaseWithUnit -> KineticLaw [dir=back,arrowtail=empty,style=dashed]; SimpleSpeciesReference -> ModifierSpeciesReference [dir=back,arrowtail=empty]; SimpleSpeciesReference -> SpeciesReference [dir=back,arrowtail=empty]; - Serializable -> SBasePlugin [dir=back,arrowtail=empty,style=dashed]; Serializable -> TreeNodeWithChangeSupport [dir=back,arrowtail=empty,style=dashed]; Symbol -> Compartment [dir=back,arrowtail=empty]; Symbol -> Parameter [dir=back,arrowtail=empty]; @@ -216,6 +215,7 @@ TreeNodeChangeListener -> SimpleTreeNodeChangeListener [dir=back,arrowtail=empty,style=dashed]; TreeNodeWithChangeSupport -> AbstractTreeNode [dir=back,arrowtail=empty,style=dashed]; TreeNodeWithChangeSupport -> SBase [dir=back,arrowtail=empty,style=dashed]; + TreeNodeWithChangeSupport -> SBasePlugin [dir=back,arrowtail=empty,style=dashed]; UniqueNamedSBase -> CompartmentType [dir=back,arrowtail=empty,style=dashed]; UniqueNamedSBase -> Event [dir=back,arrowtail=empty,style=dashed]; UniqueNamedSBase -> FunctionDefinition [dir=back,arrowtail=empty,style=dashed]; Modified: trunk/core/doc/img/FullTypeHierarchy.pdf =================================================================== (Binary files differ) Modified: trunk/core/doc/img/FullTypeHierarchy.png =================================================================== (Binary files differ) Modified: trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -34,6 +34,7 @@ import org.sbml.jsbml.util.StringTools; import org.sbml.jsbml.util.TreeNodeChangeEvent; import org.sbml.jsbml.util.TreeNodeChangeListener; +import org.sbml.jsbml.util.TreeNodeRemovedEvent; import org.sbml.jsbml.util.TreeNodeWithChangeSupport; import org.sbml.jsbml.util.filters.Filter; @@ -47,47 +48,46 @@ */ public abstract class AbstractTreeNode implements TreeNodeWithChangeSupport { - /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = 8629109724566600238L; - /** - * Searches the given child in the list of sub-nodes of the parent element. - * - * @param parent - * @param child - * @return the index of the child in the parent's list of childs or -1 if no - * such child can be found. - */ - @SuppressWarnings("unchecked") - public static int indexOf(TreeNode parent, TreeNode child) { - if (child == null) { - throw new IllegalArgumentException("Argument is null."); - } - // linear search - Enumeration<TreeNode> e = parent.children(); - for (int i = 0; e.hasMoreElements(); i++) { - TreeNode elem = e.nextElement(); - if ((child == elem) || child.equals(elem)) { - return i; - } - } - // not found => node is not a child. - return -1; - } - + * Generated serial version identifier. + */ + private static final long serialVersionUID = 8629109724566600238L; + /** - * {@link List} of listeners for this component - */ - protected List<TreeNodeChangeListener> listOfListeners; + * Searches the given child in the list of sub-nodes of the parent element. + * + * @param parent + * @param child + * @return the index of the child in the parent's list of children or -1 if no + * such child can be found. + */ + public static int indexOf(TreeNode parent, TreeNode child) { + if (child == null) { + throw new IllegalArgumentException("Argument is null."); + } + // linear search + Enumeration<TreeNode> e = parent.children(); + for (int i = 0; e.hasMoreElements(); i++) { + TreeNode elem = e.nextElement(); + if ((child == elem) || child.equals(elem)) { + return i; + } + } + // not found => node is not a child. + return -1; + } /** - * The parent element of this {@link Annotation}. - */ - protected TreeNode parent; + * {@link List} of listeners for this component + */ + protected List<TreeNodeChangeListener> listOfListeners; /** + * The parent element of this {@link Annotation}. + */ + protected TreeNode parent; + + /** * Any kind of {@link Object} that can be stored in addition to all other * features of this {@link AbstractTreeNode} in form of key-value pairs. * Note that things stored here will not be written to SBML files. This @@ -97,321 +97,339 @@ private Map<Object, Object> userObjects; /** - * Creates an empty {@link AbstractTreeNode} without child nodes and an - * empty list of {@link TreeNodeChangeListener}s. The pointer to the parent - * of this node is set to <code>null</code>. - */ - public AbstractTreeNode() { - super(); - this.listOfListeners = new LinkedList<TreeNodeChangeListener>(); - this.parent = null; - } - + * Creates an empty {@link AbstractTreeNode} without child nodes and an + * empty list of {@link TreeNodeChangeListener}s. The pointer to the parent + * of this node is set to <code>null</code>. + */ + public AbstractTreeNode() { + super(); + this.listOfListeners = new LinkedList<TreeNodeChangeListener>(); + this.parent = null; + } + /** - * Constructor for cloning. {@link AbstractTreeNode} has two properties: - * {@link #parent} and {@link #listOfListeners}. Both of them are not cloned - * by this method, for two reasons: - * <ul> - * <li>The {@link #parent} is not cloned and is left as <code>null</code> - * because the new {@link AbstractTreeNode} will get a parent set as soon as - * it is added/linked again to a {@link Model}. Note that only the top-level - * element of the cloned sub-tree will have a <code>null</code> value as its - * parent. All sub-element will point to their correct parent element.</li> - * <li>{@link #listOfListeners} is needed in all other setXX() methods. - * Cloning these might lead to strange and unexpected behavior, because when - * doing a deep cloning, the listeners of the old object would suddenly be - * informed about all value changes within this new object. Since we do - * cloning, all values of all child elements have to be touched, i.e., all - * listeners would be informed many times, but each time receive the identical - * value as it was before. Since it is totally unclear of which type listeners - * are, a deep cloning of these is not possible.</li> - * </ul> - * Therefore, it is necessary to keep in mind that the parent of the clone - * will be null and that you have to care by yourself if you are using - * {@link TreeNodeChangeListener}s. - * - * @param node - * The original {@link TreeNode} to be cloned. - */ - public AbstractTreeNode(TreeNode node) { - this(); - // the parent is not cloned and is left as null - // The Object will get a parent set as soon as it is added/linked - // again to a model somehow. - // this.parent = node.getParent(); + * Constructor for cloning. {@link AbstractTreeNode} has two properties: + * {@link #parent} and {@link #listOfListeners}. Both of them are not cloned + * by this method, for two reasons: + * <ul> + * <li>The {@link #parent} is not cloned and is left as <code>null</code> + * because the new {@link AbstractTreeNode} will get a parent set as soon as + * it is added/linked again to a {@link Model}. Note that only the top-level + * element of the cloned sub-tree will have a <code>null</code> value as its + * parent. All sub-element will point to their correct parent element.</li> + * <li>{@link #listOfListeners} is needed in all other setXX() methods. + * Cloning these might lead to strange and unexpected behavior, because when + * doing a deep cloning, the listeners of the old object would suddenly be + * informed about all value changes within this new object. Since we do + * cloning, all values of all child elements have to be touched, i.e., all + * listeners would be informed many times, but each time receive the identical + * value as it was before. Since it is totally unclear of which type listeners + * are, a deep cloning of these is not possible.</li> + * </ul> + * Therefore, it is necessary to keep in mind that the parent of the clone + * will be null and that you have to care by yourself if you are using + * {@link TreeNodeChangeListener}s. + * + * @param node + * The original {@link TreeNode} to be cloned. + */ + public AbstractTreeNode(TreeNode node) { + this(); + // the parent is not cloned and is left as null + // The Object will get a parent set as soon as it is added/linked + // again to a model somehow. + // this.parent = node.getParent(); - /* listOfListeners is needed in all other setXX() methods. - * Cloning these might lead to strange and unexpected behavior. - * This is actually not deep cloning anyway: - */ - if (node instanceof AbstractTreeNode) { - AbstractTreeNode anode = (AbstractTreeNode) node; - // Do not clone listeners! - // this.listOfListeners.addAll(anode.listOfListeners); - if (anode.isSetUserObjects()) { - this.userObjects = new HashMap<Object, Object>(); - this.userObjects.putAll(anode.userObjects); - } - } - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addAllChangeListeners(java.util.Collection) - */ - public boolean addAllChangeListeners( - Collection<TreeNodeChangeListener> listeners) { - boolean success = listOfListeners.addAll(listeners); - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - success &= ((TreeNodeWithChangeSupport) node) - .addAllChangeListeners(listeners); - } - } - return success; - } + /* listOfListeners is needed in all other setXX() methods. + * Cloning these might lead to strange and unexpected behavior. + * This is actually not deep cloning anyway: + */ + if (node instanceof AbstractTreeNode) { + AbstractTreeNode anode = (AbstractTreeNode) node; + // Do not clone listeners! + // this.listOfListeners.addAll(anode.listOfListeners); + if (anode.isSetUserObjects()) { + this.userObjects = new HashMap<Object, Object>(); + this.userObjects.putAll(anode.userObjects); + } + } + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) - */ - public void addTreeNodeChangeListener(TreeNodeChangeListener listener) { - if (!listOfListeners.contains(listener)) { - listOfListeners.add(listener); - } - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); - } - } - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#children() - */ - public Enumeration<TreeNode> children() { - return new Enumeration<TreeNode>() { - /** - * Total number of children in this enumeration. - */ - private int childCount = getChildCount(); - /** - * Current position in the list of children. - */ - private int index; + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addAllChangeListeners(java.util.Collection) + */ + //@Override + public boolean addAllChangeListeners( + Collection<TreeNodeChangeListener> listeners) { + boolean success = listOfListeners.addAll(listeners); + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + success &= ((TreeNodeWithChangeSupport) node) + .addAllChangeListeners(listeners); + } + } + return success; + } - /* (non-Javadoc) - * @see java.util.Enumeration#hasMoreElements() - */ - public boolean hasMoreElements() { - return index < childCount; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) + */ + //@Override + public void addTreeNodeChangeListener(TreeNodeChangeListener listener) { + if (!listOfListeners.contains(listener)) { + listOfListeners.add(listener); + } + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); + } + } + } - /* (non-Javadoc) - * @see java.util.Enumeration#nextElement() - */ - public TreeNode nextElement() { - synchronized (this) { - if (index < childCount) { - return getChildAt(index++); - } - } - throw new NoSuchElementException("Enumeration"); - } - }; - } + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#children() + */ + //@Override + public Enumeration<TreeNode> children() { + return new Enumeration<TreeNode>() { + /** + * Total number of children in this enumeration. + */ + private int childCount = getChildCount(); + /** + * Current position in the list of children. + */ + private int index; - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#clearUserObjects() - */ + /* (non-Javadoc) + * @see java.util.Enumeration#hasMoreElements() + */ + //@Override + public boolean hasMoreElements() { + return index < childCount; + } + + /* (non-Javadoc) + * @see java.util.Enumeration#nextElement() + */ + //@Override + public TreeNode nextElement() { + synchronized (this) { + if (index < childCount) { + return getChildAt(index++); + } + } + throw new NoSuchElementException("Enumeration"); + } + }; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#clearUserObjects() + */ + //@Override public void clearUserObjects() { if (isSetUserObjects()) { userObjects.clear(); } } - /* (non-Javadoc) - * @see java.lang.Object#clone() - */ - @Override - public abstract TreeNode clone(); + /* (non-Javadoc) + * @see java.lang.Object#clone() + */ + @Override + public abstract TreeNode clone(); - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#containsUserObjectKey(java.lang.Object) - */ + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#containsUserObjectKey(java.lang.Object) + */ + //@Override public boolean containsUserObjectKey(Object key) { return userObjects.containsKey(key); } - /* (non-Javadoc) - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object object) { - // Check if the given object is a pointer to precisely the same object: - if (super.equals(object)) { - return true; - } - // Check if the given object is of identical class and not null: - if ((object == null) || (!getClass().equals(object.getClass()))) { - return false; - } - // Check all child nodes recursively: - if (object instanceof TreeNode) { - TreeNode stn = (TreeNode) object; - int childCount = getChildCount(); - boolean equal = stn.isLeaf() == isLeaf(); - /* - * This is not good because cloned AbstractTreeNodes may not point - * to the same parent as the original and would hence not be equal - * to the cloned object. - */ - // equal &= ((stn.getParent() == null) && isRoot()) - // || (stn.getParent() == getParent()); - equal &= stn.getChildCount() == childCount; - if (equal && (childCount > 0)) { - for (int i = 0; i < childCount; i++) { - if (!stn.getChildAt(i).equals(getChildAt(i))) { - return false; - } - } - } - return equal; - } - return false; - } + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + // Check if the given object is a pointer to precisely the same object: + if (super.equals(object)) { + return true; + } + // Check if the given object is of identical class and not null: + if ((object == null) || (!getClass().equals(object.getClass()))) { + return false; + } + // Check all child nodes recursively: + if (object instanceof TreeNode) { + TreeNode stn = (TreeNode) object; + int childCount = getChildCount(); + boolean equal = stn.isLeaf() == isLeaf(); + /* + * This is not good because cloned AbstractTreeNodes may not point + * to the same parent as the original and would hence not be equal + * to the cloned object. + */ + // equal &= ((stn.getParent() == null) && isRoot()) + // || (stn.getParent() == getParent()); + equal &= stn.getChildCount() == childCount; + if (equal && (childCount > 0)) { + for (int i = 0; i < childCount; i++) { + if (!stn.getChildAt(i).equals(getChildAt(i))) { + return false; + } + } + } + return equal; + } + return false; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter) - */ - public List<? extends TreeNode> filter(Filter filter) { - return filter(filter, false); - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter) + */ + //@Override + public List<? extends TreeNode> filter(Filter filter) { + return filter(filter, false); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter, boolean) - */ - public List<TreeNode> filter(Filter filter, boolean retainInternalNodes) { - List<TreeNode> list = new LinkedList<TreeNode>(), childList; - TreeNode child; - boolean accepts = filter.accepts(this); - if (accepts) { - list.add(this); - } - for (int i = 0; i < getChildCount(); i++) { - child = getChildAt(i); - if (child instanceof TreeNodeWithChangeSupport) { - childList = ((TreeNodeWithChangeSupport) child).filter(filter, retainInternalNodes); - if (!accepts && retainInternalNodes && (childList.size() > 0)) { - list.add(this); - // prevent adding the current node more often than once: - accepts = true; - } - list.addAll(childList); - } - } - return list; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#filter(org.sbml.jsbml.util.filters.Filter, boolean) + */ + //@Override + public List<TreeNode> filter(Filter filter, boolean retainInternalNodes) { + List<TreeNode> list = new LinkedList<TreeNode>(), childList; + TreeNode child; + boolean accepts = filter.accepts(this); + if (accepts) { + list.add(this); + } + for (int i = 0; i < getChildCount(); i++) { + child = getChildAt(i); + if (child instanceof TreeNodeWithChangeSupport) { + childList = ((TreeNodeWithChangeSupport) child).filter(filter, retainInternalNodes); + if (!accepts && retainInternalNodes && (childList.size() > 0)) { + list.add(this); + // prevent adding the current node more often than once: + accepts = true; + } + list.addAll(childList); + } + } + return list; + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeAddedEvent() - */ - public void fireNodeAddedEvent() { - for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeAdded(this); - } - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeAddedEvent() + */ + //@Override + public void fireNodeAddedEvent() { + for (TreeNodeChangeListener listener : listOfListeners) { + listener.nodeAdded(this); + } + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeRemovedEvent() - */ - public void fireNodeRemovedEvent() { - for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeRemoved(this); - } - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#fireNodeRemovedEvent() + */ + //@Override + public void fireNodeRemovedEvent() { + TreeNode previousParent = getParent(); + parent = null; + for (TreeNodeChangeListener listener : listOfListeners) { + listener.nodeRemoved(new TreeNodeRemovedEvent(this, previousParent)); + } + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) - */ - public void firePropertyChange(String propertyName, Object oldValue, - Object newValue) { - if (listOfListeners.size() > 0) { - short changeType = -1; // no property change at all - if ((oldValue == null) && (newValue != null)) { - changeType = 0; // element added - } else if ((oldValue != null) && (newValue == null)) { - changeType = 1; // element removed - } else if ((oldValue != null) && !oldValue.equals(newValue)) { - changeType = 2; // real property change - } - if (-1 < changeType) { - boolean newValTreeNode = newValue instanceof TreeNodeWithChangeSupport; - boolean oldValTreeNode = oldValue instanceof TreeNodeWithChangeSupport; - if ((changeType == 0) && newValTreeNode) { - ((TreeNodeWithChangeSupport) newValue).fireNodeAddedEvent(); - } else if ((changeType == 1) && oldValTreeNode) { - ((TreeNodeWithChangeSupport) oldValue).fireNodeRemovedEvent(); - } else { - // TODO: check if notifying and updating the metaId is necessary - // because of the method AbstractSBase.setThisAsParentSBMLObject - if (oldValTreeNode && newValTreeNode) { - notifyChildChange((TreeNode) oldValue, (TreeNode) newValue); - } - /* - * It is not necessary to add the metaId of the new value to - * the SBMLDocument because this is already done in the - * method setThisAsParentSBMLObject, a method that is called - * to link a new element to an existing SBML tree. - */ - // Now we can notify all listeners about the change: - TreeNodeChangeEvent changeEvent = new TreeNodeChangeEvent(this, - propertyName, oldValue, newValue); - for (TreeNodeChangeListener listener : listOfListeners) { - listener.propertyChange(changeEvent); - } - } - } - } - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode) - */ - public int getIndex(TreeNode node) { - return indexOf(this, node); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getListOfTreeNodeChangeListeners() - */ - public List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners() { - return listOfListeners; - } + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#firePropertyChange(java.lang.String, java.lang.Object, java.lang.Object) + */ + //@Override + public void firePropertyChange(String propertyName, Object oldValue, + Object newValue) { + if (listOfListeners.size() > 0) { + short changeType = -1; // no property change at all + if ((oldValue == null) && (newValue != null)) { + changeType = 0; // element added + } else if ((oldValue != null) && (newValue == null)) { + changeType = 1; // element removed + } else if ((oldValue != null) && !oldValue.equals(newValue)) { + changeType = 2; // real property change + } + if (-1 < changeType) { + boolean newValTreeNode = newValue instanceof TreeNodeWithChangeSupport; + boolean oldValTreeNode = oldValue instanceof TreeNodeWithChangeSupport; + if ((changeType == 0) && newValTreeNode) { + ((TreeNodeWithChangeSupport) newValue).fireNodeAddedEvent(); + } else if ((changeType == 1) && oldValTreeNode) { + ((TreeNodeWithChangeSupport) oldValue).fireNodeRemovedEvent(); + } else { + // TODO: check if notifying and updating the metaId is necessary + // because of the method AbstractSBase.setThisAsParentSBMLObject + if (oldValTreeNode && newValTreeNode) { + notifyChildChange((TreeNode) oldValue, (TreeNode) newValue); + } + /* + * It is not necessary to add the metaId of the new value to + * the SBMLDocument because this is already done in the + * method setThisAsParentSBMLObject, a method that is called + * to link a new element to an existing SBML tree. + */ + // Now we can notify all listeners about the change: + TreeNodeChangeEvent changeEvent = new TreeNodeChangeEvent(this, + propertyName, oldValue, newValue); + for (TreeNodeChangeListener listener : listOfListeners) { + listener.propertyChange(changeEvent); + } + } + } + } + } - /** - * Returns the number of child elements of this {@link TreeNode}. - * - * @return the number of children TreeNodes the receiver contains. - * @deprecated use {@link #getChildCount()} - */ - @Deprecated - public int getNumChildren() { - return getChildCount(); - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#getParent() - */ - public TreeNode getParent() { - return parent; - } + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#getIndex(javax.swing.tree.TreeNode) + */ + //@Override + public int getIndex(TreeNode node) { + return indexOf(this, node); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getUserObject(java.lang.Object) - */ + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getListOfTreeNodeChangeListeners() + */ + //@Override + public List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners() { + return listOfListeners; + } + + /** + * Returns the number of child elements of this {@link TreeNode}. + * + * @return the number of children TreeNodes the receiver contains. + * @deprecated use {@link #getChildCount()} + */ + @Deprecated + public int getNumChildren() { + return getChildCount(); + } + + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#getParent() + */ + //@Override + public TreeNode getParent() { + return parent; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getUserObject(java.lang.Object) + */ + //@Override public Object getUserObject(Object key) { if (userObjects == null) { userObjects = new HashMap<Object, Object>(); @@ -419,90 +437,93 @@ return userObjects.get(key); } - /* (non-Javadoc) - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - // A constant and arbitrary, sufficiently large prime number: - final int prime = 769; - /* - * This method is implemented as suggested in the JavaDoc API - * documentation of the List interface. - */ - - // Compute the initial hashCode based on the name of the actual class. - int hashCode = getClass().getName().hashCode(); - /* - * The following start wouldn't work because it will compute the - * hashCode from the address in memory of the object. - */ - // int hashCode = super.hashCode(); - - // Recursively compute the hashCode for each child node: - TreeNode child; - for (int i = 0; i < getChildCount(); i++) { - child = getChildAt(i); - hashCode = prime * hashCode + (child == null ? 0 : child.hashCode()); - } - - return hashCode; - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#isLeaf() - */ - public boolean isLeaf() { - return getChildCount() == 0; - } - - /** - * Opposite of {@link #isSetParent()}. - * - * Returns <code>true</code> if this {@link AbstractTreeNode} is the root - * node of a tree, <code>false</code> otherwise. - * - * @return <code>True</code> if this {@link AbstractTreeNode} is the root - * node of a tree, <code>false</code> otherwise. - * - * @see #isSetParent() - */ - public boolean isRoot() { - return !isSetParent(); - } - - /** - * - * @return - */ - public boolean isSetParent() { - return parent != null; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isSetUserObjects() - */ + /* (non-Javadoc) + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + // A constant and arbitrary, sufficiently large prime number: + final int prime = 769; + /* + * This method is implemented as suggested in the JavaDoc API + * documentation of the List interface. + */ + + // Compute the initial hashCode based on the name of the actual class. + int hashCode = getClass().getName().hashCode(); + /* + * The following start wouldn't work because it will compute the + * hashCode from the address in memory of the object. + */ + // int hashCode = super.hashCode(); + + // Recursively compute the hashCode for each child node: + TreeNode child; + for (int i = 0; i < getChildCount(); i++) { + child = getChildAt(i); + hashCode = prime * hashCode + (child == null ? 0 : child.hashCode()); + } + + return hashCode; + } + + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#isLeaf() + */ + //@Override + public boolean isLeaf() { + return getChildCount() == 0; + } + + /** + * Opposite of {@link #isSetParent()}. + * + * Returns <code>true</code> if this {@link AbstractTreeNode} is the root + * node of a tree, <code>false</code> otherwise. + * + * @return <code>True</code> if this {@link AbstractTreeNode} is the root + * node of a tree, <code>false</code> otherwise. + * + * @see #isSetParent() + */ + public boolean isRoot() { + return !isSetParent(); + } + + /** + * + * @return + */ + public boolean isSetParent() { + return parent != null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isSetUserObjects() + */ + //@Override public boolean isSetUserObjects() { return (userObjects != null) && !userObjects.isEmpty(); } - - /** - * This method is called when one child has been swapped with another one - * and can be used to check certain properties of the resulting changed - * tree. - * - * @param oldChild - * the element that was a child of this node before the change. - * @param newChild - * the new child whose new parent is this node. - */ - protected void notifyChildChange(TreeNode oldChild, TreeNode newChild) { - // default: empty body, nothing to do. - } + /** + * This method is called when one child has been swapped with another one + * and can be used to check certain properties of the resulting changed + * tree. + * + * @param oldChild + * the element that was a child of this node before the change. + * @param newChild + * the new child whose new parent is this node. + */ + protected void notifyChildChange(TreeNode oldChild, TreeNode newChild) { + // default: empty body, nothing to do. + } + /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#putUserObject(java.lang.Object, java.lang.Object) - */ + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#putUserObject(java.lang.Object, java.lang.Object) + */ + //@Override public void putUserObject(Object key, Object userObject) { if (userObjects == null) { userObjects = new HashMap<Object, Object>(); @@ -511,30 +532,33 @@ firePropertyChange(key.toString(), oldObject, userObject); } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeAllTreeNodeChangeListeners() - */ - public void removeAllTreeNodeChangeListeners() { - listOfListeners.clear(); - } - /* (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) - */ - public void removeTreeNodeChangeListener(TreeNodeChangeListener l) { - listOfListeners.remove(l); - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(l); - } - } - } - - /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeAllTreeNodeChangeListeners() + */ + //@Override + public void removeAllTreeNodeChangeListeners() { + listOfListeners.clear(); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) + */ + //@Override + public void removeTreeNodeChangeListener(TreeNodeChangeListener l) { + listOfListeners.remove(l); + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(l); + } + } + } + + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeUserObject(java.lang.Object) */ + //@Override public Object removeUserObject(Object key) { if (userObjects != null) { return userObjects.remove(key); @@ -543,26 +567,27 @@ } /** - * @param parent - * the parent to set - */ - protected void setParent(TreeNode parent) { - TreeNode oldValue = this.parent; - this.parent = parent; - this.firePropertyChange(TreeNodeChangeEvent.parentSBMLObject, oldValue, this.parent); - } + * @param parent + * the parent to set + */ + protected void setParent(TreeNode parent) { + TreeNode oldValue = this.parent; + this.parent = parent; + this.firePropertyChange(TreeNodeChangeEvent.parentSBMLObject, oldValue, this.parent); + } /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - return StringTools.firstLetterLowerCase(getClass().getSimpleName()); - } + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return StringTools.firstLetterLowerCase(getClass().getSimpleName()); + } - /* (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#userObjectKeySet() */ + //@Override public Set<Object> userObjectKeySet() { return userObjects.keySet(); } Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -50,7 +50,7 @@ * listXXX is a SBML package extension, the SBaseListType value to set would * be 'other'. * - * @author marine + * @author Marine Dumousseau * */ public static enum Type { Modified: trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/ext/AbstractSBasePlugin.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -20,11 +20,7 @@ */ package org.sbml.jsbml.ext; -import java.util.Enumeration; -import java.util.NoSuchElementException; - -import javax.swing.tree.TreeNode; - +import org.sbml.jsbml.AbstractTreeNode; import org.sbml.jsbml.SBase; @@ -35,7 +31,7 @@ * @since 1.0 * @date 28.10.2011 */ -public abstract class AbstractSBasePlugin implements SBasePlugin { +public abstract class AbstractSBasePlugin extends AbstractTreeNode implements SBasePlugin { /** * Generated serial version identifier. @@ -63,150 +59,58 @@ this.extendedSBase = extendedSBase; } - /** - * Returns the SBase object that is extended by this plug-in. - * - * @return the SBase object that is extended by this plug-in. + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getExtendedSBase() */ + //@Override public SBase getExtendedSBase() { return extendedSBase; } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#children() - */ - public Enumeration<TreeNode> children() { - return new Enumeration<TreeNode>() { - /** - * Total number of children in this enumeration. - */ - private int childCount = getChildCount(); - /** - * Current position in the list of children. - */ - private int index; - /* - * (non-Javadoc) - * - * @see java.util.Enumeration#hasMoreElements() - */ - public boolean hasMoreElements() { - return index < childCount; - } - - /* - * (non-Javadoc) - * - * @see java.util.Enumeration#nextElement() - */ - public TreeNode nextElement() { - synchronized (this) { - if (index < childCount) { - return getChildAt(index++); - } - } - throw new NoSuchElementException("Enumeration"); - } - }; - } - - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#clone() */ @Override - public abstract SBasePlugin clone(); + public abstract AbstractSBasePlugin clone(); - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#equals(java.lang.Object) */ @Override public boolean equals(Object object) { - // Check if the given object is a pointer to precisely the same object: - if (super.equals(object)) { - return true; - } - // Check if the given object is of identical class and not null: - if ((object == null) || (!getClass().equals(object.getClass()))) { - return false; - } + boolean equal = super.equals(object); + // Check all child nodes recursively: - if (object instanceof SBase) { - SBase stn = (SBase) object; - int childCount = getChildCount(); - boolean equal = stn.isLeaf() == isLeaf(); - /* - * This is not good because cloned SBase may not point - * to the same parent as the original and would hence not be equal - * to the cloned object. - */ - // equal &= ((stn.getParent() == null) && isRoot()) - // || (stn.getParent() == getParent()); - equal &= stn.getChildCount() == childCount; - if (equal && (childCount > 0)) { - for (int i = 0; i < childCount; i++) { - if (!stn.getChildAt(i).equals(getChildAt(i))) { - return false; - } - } + if (equal && (object instanceof SBasePlugin)) { + SBasePlugin stn = (SBasePlugin) object; + equal &= stn.isSetExtendedSBase() == isSetExtendedSBase(); + if (equal && isSetExtendedSBase()) { + equal &= stn.getExtendedSBase().equals(getExtendedSBase()); } - return equal; } - return false; + return equal; } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getIndex(org.sbml.jsbml.SBase) + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#isSetExtendedSBase() */ - public int getIndex(SBase node) { - // TODO Auto-generated method stub - return 0; + //@Override + public boolean isSetExtendedSBase() { + return extendedSBase != null; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#hashCode() */ @Override public int hashCode() { // A constant and arbitrary, sufficiently large prime number: final int prime = 769; - /* - * This method is implemented as suggested in the JavaDoc API - * documentation of the List interface. - */ - - // Compute the initial hashCode based on the name of the actual class. - int hashCode = getClass().getName().hashCode(); - /* - * The following start wouldn't work because it will compute the - * hashCode from the address in memory of the object. - */ - // int hashCode = super.hashCode(); - - // Recursively compute the hashCode for each child node: - TreeNode child; - for (int i = 0; i < getChildCount(); i++) { - child = getChildAt(i); - hashCode = prime * hashCode + (child == null ? 0 : child.hashCode()); + int hashCode = super.hashCode(); + if (isSetExtendedSBase()) { + hashCode += prime * getExtendedSBase().hashCode(); } - return hashCode; } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#isLeaf() - */ - public boolean isLeaf() { - return getChildCount() == 0; - } - - } Modified: trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/ext/SBasePlugin.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -20,13 +20,10 @@ */ package org.sbml.jsbml.ext; -import java.io.Serializable; -import java.util.Enumeration; import java.util.Map; -import javax.swing.tree.TreeNode; - import org.sbml.jsbml.SBase; +import org.sbml.jsbml.util.TreeNodeWithChangeSupport; /** * Defines the methods necessary for an SBase Plugin. When a SBML level 3 is extending @@ -38,9 +35,42 @@ * @version $Rev$ * @since 1.0 */ -public interface SBasePlugin extends Cloneable, Serializable { +public interface SBasePlugin extends TreeNodeWithChangeSupport { /** + * + * @return + */ + public SBasePlugin clone(); + + /** + * + * @param obj + * @return + */ + public boolean equals(Object obj); + + /** + * Returns the SBase object that is extended by this plug-in. + * + * @return the SBase object that is extended by this plug-in. + */ + public SBase getExtendedSBase(); + + /** + * + * @return + */ + public int hashCode(); + + /** + * Check whether an extended SBase has been set. + * + * @return + */ + public boolean isSetExtendedSBase(); + + /** * Reads and sets the attribute if it is know from this {@link SBasePlugin}. * * @param attributeName @@ -51,53 +81,13 @@ * : value of the XML attribute * @return true if the attribute has been successfully read. */ - public boolean readAttribute(String attributeName, String prefix, - String value); + public boolean readAttribute(String attributeName, String prefix, String value); /** - * Returns the child <code>TreeNode</code> at index - * <code>childIndex</code>. - */ - public TreeNode getChildAt(int childIndex); - - /** - * Returns the number of children <code>TreeNode</code>s the receiver - * contains. - */ - public int getChildCount(); - - /** - * Returns the index of <code>node</code> in the receivers children. - * If the receiver does not contain <code>node</code>, -1 will be - * returned. - */ - public int getIndex(SBase node); - - /** - * Returns true if the receiver allows children. - */ - public boolean getAllowsChildren(); - - /** - * Returns true if the receiver is a leaf. - */ - public boolean isLeaf(); - - /** - * Returns the children of the receiver as an <code>Enumeration</code>. - */ - public Enumeration<TreeNode> children(); - - /** * Returns a {@link Map} containing the XML attributes of this object. * * @return a {@link Map} containing the XML attributes of this object. */ public Map<String, String> writeXMLAttributes(); - - public boolean equals(Object obj); - - public int hashCode(); - - public SBasePlugin clone(); + } Modified: trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -21,6 +21,7 @@ package org.sbml.jsbml.util; import java.beans.PropertyChangeEvent; +import java.text.MessageFormat; import javax.swing.tree.TreeNode; @@ -38,7 +39,7 @@ public class SimpleTreeNodeChangeListener implements TreeNodeChangeListener { /** - * + * A {@link Logger} for this class. */ private Logger logger; @@ -58,34 +59,34 @@ return logger; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeAdded(javax.swing.tree.TreeNode) */ + //@Override public void nodeAdded(TreeNode sb) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[ADD]\t%s", sb)); - } + if (logger.isDebugEnabled()) { + logger.debug(MessageFormat.format("[ADD]\t{0}", sb)); + } } - /* - * (non-Javadoc) - * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(javax.swing.tree.TreeNode) + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeChangeListener#nodeRemoved(org.sbml.jsbml.util.TreeNodeRemovedEvent) */ - public void nodeRemoved(TreeNode sb) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[DEL]\t%s", sb)); - } + //@Override + public void nodeRemoved(TreeNodeRemovedEvent evt) { + if (logger.isDebugEnabled()) { + logger.debug(MessageFormat.format("[DEL]\t{0}", evt.getSource())); + } } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent) */ + //@Override public void propertyChange(PropertyChangeEvent ev) { - if (logger.isDebugEnabled()) { - logger.debug(String.format("[CHG]\t%s", ev)); - } + if (logger.isDebugEnabled()) { + logger.debug(MessageFormat.format("[CHG]\t{0}", ev)); + } } } Modified: trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java 2012-06-01 15:30:31 UTC (rev 1279) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeChangeListener.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -24,8 +24,6 @@ import javax.swing.tree.TreeNode; -import org.sbml.jsbml.SBMLDocument; - /** * A listener interface that allows applications to get notified if the state of * any {@link TreeNode} object changes. @@ -36,23 +34,26 @@ */ public interface TreeNodeChangeListener extends PropertyChangeListener { - /** - * The {@link T} passed to this method has just been added to the - * {@link SBMLDocument} or another containing element. - * - * @param node - * This element is now part of the {@link SBMLDocument}. - */ - public void nodeAdded(TreeNode node); + /** + * The {@link TreeNode} passed to this method has just been added to the + * a containing element. + * + * @param node + * This element is now part of the {@link SBMLDocument}. + */ + public void nodeAdded(TreeNode node); - /** - * The {@link T} passed to this method has been removed from a - * containing parent and does hence no longer belong to the - * {@link SBMLDocument} anymore. - * - * @param node - * This element is not longer part of the {@link SBMLDocument}. - */ - public void nodeRemoved(TreeNode node); + /** + * The {@link TreeNodeRemovedEvent} passed to this method provides information + * about the node that has been removed from a + * containing parent and does hence no longer belong to the + * {@link SBMLDocument} anymore. In addition, a pointer to its previous parent + * is also provided. In this way, an implementing class + * can identify the location within the tree where it was before. + * + * @param node + * This element is not longer part of the {@link SBMLDocument}. + */ + public void nodeRemoved(TreeNodeRemovedEvent evt); } Added: trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java 2012-06-03 09:33:15 UTC (rev 1280) @@ -0,0 +1,134 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2011 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.util; + +import java.util.EventObject; + +import javax.swing.tree.TreeNode; + + +/** + * A special {@link EventObject} to notify a {@link TreeNodeChangeListener} + * about a removed node and its previous position within the tree. To this end, + * this {@link TreeNodeRemovedEvent} contains a pointer to both the actual + * removed node and its previous parent node. Note that when removing an element + * from the SBML tree, its pointer to its parent is set to {@code null}. + * To give an example why information about the previous parent is necessary: + * Imagine, an instance of {@code speciesReference} has been removed from + * the SBML tree. After removing it, the model does no longer point to an + * element with its id. Many {@code reaction}s + * might have been the origin of this removed node. If a + * {@link TreeNodeChangeListener} wants to, e.g., undo this change, + * it is necessary to identify the previous position of the node within the + * tree. That's why this class has two important + * methods, namely {@link #getSource()} and {@link #getPreviosParent()}. + * + * @author Andreas Dräger + * @version $Rev$ + * @since 0.8 + * @date 02.06.2012 + */ +public class TreeNodeRemovedEvent extends EventObject { + + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 4860717212990689980L; + + /** + * The previous parent node in the tree, i.e., the node that was the parent of + * the deleted node (see {@link #getSource()}) before the deletion. + */ + private TreeNode previosParent; + + /** + * Creates a new {@link TreeNodeRemovedEvent} that contains information about + * an element that has just been removed from a tree together with its + * previous parent node. + * + * @param source + * the node that has just been removed from the tree. + * @param previousParent + * the node that was the parent node of the removed element, may be + * {@code null} if the node didn't have a parent. + */ + public TreeNodeRemovedEvent(TreeNode source, TreeNode previousParent) { + super(source); + this.previosParent = previousParent; + } + + /** + * Clone constructor. + * ... [truncated message content] |
From: <and...@us...> - 2012-06-10 07:02:05
|
Revision: 1296 http://jsbml.svn.sourceforge.net/jsbml/?rev=1296&view=rev Author: andreas-draeger Date: 2012-06-10 07:01:58 +0000 (Sun, 10 Jun 2012) Log Message: ----------- Renamed LayoutConstant to LayoutConstants because there are multiple constants within this class. Changed the default return type of the conversion method from Class<? extends SBase> to the listOf type from "none" to "other", because this is necessary for the packages. If some SBase is given, the listOf type should be "other", not "none". The default listOf type should still be "none", but not if a specific Class is given that is derived from SBase. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/ListOf.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java Added Paths: ----------- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java Removed Paths: ------------- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstant.java Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -171,9 +171,6 @@ return listOfModifiers; } else if (type.equals(Parameter.class)) { return listOfParameters; - } else if (type.equals(SpeciesReference.class)) { - // Can be reactant or product! - return other; } else if (type.equals(Reaction.class)) { return listOfReactions; } else if (type.equals(Rule.class)) { @@ -187,7 +184,7 @@ } else if (type.equals(Unit.class)) { return listOfUnits; } - return none; + return other; } /** Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -55,7 +55,7 @@ * */ public BoundingBox() { - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -248,7 +248,7 @@ if (isSetId()) { attributes.remove("id"); - attributes.put(LayoutConstant.shortLabel + ":id", getId()); + attributes.put(LayoutConstants.shortLabel + ":id", getId()); } if (isSetName()) { // Problem !!! no name defined officially Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -121,7 +121,7 @@ if (!isAttributeRead) { - if (attributeName.equals(LayoutConstant.compartment)) { + if (attributeName.equals(LayoutConstants.compartment)) { setCompartment(value); } else { return false; @@ -164,8 +164,8 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetCompartment()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.compartment, getCompartment()); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.compartment, getCompartment()); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -61,9 +61,9 @@ */ public Curve() { super(); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); - listOfCurveSegments.addNamespace(LayoutConstant.namespaceURI); + listOfCurveSegments.addNamespace(LayoutConstants.namespaceURI); listOfCurveSegments.setSBaseListType(ListOf.Type.other); registerChild(listOfCurveSegments); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -51,7 +51,7 @@ */ public CurveSegment() { super(); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -54,7 +54,7 @@ * */ public Dimensions() { - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -96,7 +96,7 @@ */ public Dimensions(int level, int version) { super(level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -107,7 +107,7 @@ */ public Dimensions(String id, int level, int version) { super(id, level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /* (non-Javadoc) @@ -221,15 +221,15 @@ { //isAttributeRead = true; - if(attributeName.equals(LayoutConstant.width)) + if(attributeName.equals(LayoutConstants.width)) { setWidth(StringTools.parseSBMLDouble(value)); } - else if(attributeName.equals(LayoutConstant.height)) + else if(attributeName.equals(LayoutConstants.height)) { setHeight(StringTools.parseSBMLDouble(value)); } - else if(attributeName.equals(LayoutConstant.depth)) + else if(attributeName.equals(LayoutConstants.depth)) { setDepth(StringTools.parseSBMLDouble(value)); } @@ -251,7 +251,7 @@ public void setDepth(double depth) { Double oldDepth = this.depth; this.depth = depth; - firePropertyChange(LayoutConstant.depth, oldDepth, this.depth); + firePropertyChange(LayoutConstants.depth, oldDepth, this.depth); } /** @@ -261,7 +261,7 @@ public void setHeight(double height) { Double oldHeight = this.height; this.height = height; - firePropertyChange(LayoutConstant.height, oldHeight, this.height); + firePropertyChange(LayoutConstants.height, oldHeight, this.height); } /** @@ -271,7 +271,7 @@ public void setWidth(double width) { Double oldWidth = this.width; this.width = width; - firePropertyChange(LayoutConstant.width, oldWidth, this.width); + firePropertyChange(LayoutConstants.width, oldWidth, this.width); } /* (non-Javadoc) @@ -283,20 +283,20 @@ if (isSetId()) { attributes.remove("id"); - attributes.put(LayoutConstant.shortLabel + ":id", getId()); + attributes.put(LayoutConstants.shortLabel + ":id", getId()); } if (isSetDepth()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.depth, StringTools.toString(depth)); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.depth, StringTools.toString(depth)); } if (isSetHeight()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.height, StringTools.toString(height)); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.height, StringTools.toString(height)); } if (isSetWidth()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.width, StringTools.toString(width)); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.width, StringTools.toString(width)); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -124,7 +124,7 @@ */ private void createListOfLayout() { listOfLayouts = new ListOf<Layout>(); - listOfLayouts.addNamespace(LayoutConstant.namespaceURI); + listOfLayouts.addNamespace(LayoutConstants.namespaceURI); listOfLayouts.setSBaseListType(ListOf.Type.other); model.registerChild(listOfLayouts); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -51,7 +51,7 @@ */ public GraphicalObject() { super(); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -70,7 +70,7 @@ */ public GraphicalObject(int level, int version) { super(level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -78,7 +78,7 @@ */ public GraphicalObject(String id) { super(id); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -89,7 +89,7 @@ */ public GraphicalObject(String id, int level, int version) { super(id, level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /* (non-Javadoc) @@ -250,7 +250,7 @@ if (isSetId()) { attributes.remove("id"); - attributes.put(LayoutConstant.shortLabel + ":id", getId()); + attributes.put(LayoutConstants.shortLabel + ":id", getId()); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -600,7 +600,7 @@ public ListOf<GraphicalObject> getListOfAdditionalGraphicalObjects() { if (!isSetListOfAdditionalGraphicalObjects()) { listOfAdditionalGraphicalObjects = ListOf.newInstance(this, GraphicalObject.class); - listOfAdditionalGraphicalObjects.addNamespace(LayoutConstant.namespaceURI); + listOfAdditionalGraphicalObjects.addNamespace(LayoutConstants.namespaceURI); } return listOfAdditionalGraphicalObjects; } @@ -612,7 +612,7 @@ public ListOf<CompartmentGlyph> getListOfCompartmentGlyphs() { if (!isSetListOfCompartmentGlyphs()) { listOfCompartmentGlyphs = ListOf.newInstance(this, CompartmentGlyph.class); - listOfCompartmentGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfCompartmentGlyphs.addNamespace(LayoutConstants.namespaceURI); } return listOfCompartmentGlyphs; } @@ -625,7 +625,7 @@ public ListOf<ReactionGlyph> getListOfReactionGlyphs() { if (!isSetListOfReactionGlyphs()) { listOfReactionGlyphs = ListOf.newInstance(this, ReactionGlyph.class); - listOfReactionGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfReactionGlyphs.addNamespace(LayoutConstants.namespaceURI); } return listOfReactionGlyphs; } @@ -637,7 +637,7 @@ public ListOf<SpeciesGlyph> getListOfSpeciesGlyphs() { if (!isSetListOfSpeciesGlyphs()) { listOfSpeciesGlyphs = ListOf.newInstance(this, SpeciesGlyph.class); - listOfSpeciesGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfSpeciesGlyphs.addNamespace(LayoutConstants.namespaceURI); } return listOfSpeciesGlyphs; } @@ -649,7 +649,7 @@ public ListOf<TextGlyph> getListOfTextGlyphs() { if (!isSetListOfTextGlyphs()) { listOfTextGlyphs = ListOf.newInstance(this, TextGlyph.class); - listOfTextGlyphs.addNamespace(LayoutConstant.namespaceURI); + listOfTextGlyphs.addNamespace(LayoutConstants.namespaceURI); } return listOfTextGlyphs; } @@ -721,7 +721,7 @@ * */ private void initDefault() { - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /* (non-Javadoc) Deleted: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstant.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstant.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstant.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -1,87 +0,0 @@ -/* - * $Id$ - * $URL$ - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ -package org.sbml.jsbml.ext.layout; - -public class LayoutConstant { - - /** - * The namespace URI of this parser. - */ - public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/layout/version1"; - public static final String namespaceURI_L2 = "http://projects.eml.org/bcb/sbml/level2"; - - public static final String shortLabel = "layout"; - - public static final String listOfLayouts = "listOfLayouts"; - public static final String listOfCompartmentGlyphs = "listOfCompartmentGlyphs"; - public static final String listOfSpeciesGlyphs = "listOfSpeciesGlyphs"; - public static final String listOfReactionGlyphs = "listOfReactionGlyphs"; - public static final String listOfTextGlyphs = "listOfTextGlyphs"; - public static final String listOfAdditionalGraphicalObjects = "listOfAdditionalGraphicalObjects"; - public static final String listOfCurveSegments = "listOfCurveSegments"; - public static final String listOfSpeciesReferenceGlyphs = "listOfSpeciesReferenceGlyphs"; - - public static final String layout = "layout"; - public static final String compartmentGlyph = "compartmentGlyph"; - public static final String speciesGlyph = "speciesGlyph"; - public static final String reactionGlyph = "reactionGlyph"; - public static final String textGlyph = "textGlyph"; - public static final String speciesReferenceGlyph = "speciesReferenceGlyph"; - public static final String boundingBox = "boundingBox"; - public static final String position = "position"; - public static final String dimensions = "dimensions"; - public static final String start = "start"; - public static final String end = "end"; - public static final String curve = "curve"; - public static final String curveSegment = "curveSegment"; - - // Attribute names of the Point XML type - public static final String x = "x"; - public static final String y = "y"; - public static final String z = "z"; - - // Attribute names of the Dimensions XML type - public static final String depth = "depth"; - public static final String width = "width"; - public static final String height = "height"; - - // Attribute names of the CompartmentGlyph XML type - public static final String compartment = "compartment"; - - // Attribute names of the speciesGlyph XML type - public static final String species = "species"; - - // Attribute names of the textGlyph XML type - public static final String graphicalObject = "graphicalObject"; - public static final String text = "text"; - public static final String originOfText = "originOfText"; - - // Attribute names of the speciesReferenceGlyph XML type - public static final String speciesReference = "speciesReference"; - public static final String role = "role"; - - - public static final String basePoint1 = "basePoint1"; - public static final String basePoint2 = "basePoint2"; - public static final String reaction = "reaction"; - - - -} Copied: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java (from rev 1293, trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstant.java) =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java (rev 0) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -0,0 +1,91 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.layout; + +/** + * + * @author + * @version $Rev$ + * @since 1.0 + */ +public class LayoutConstants { + + /** + * The namespace URI of this parser. + */ + public static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/layout/version1"; + public static final String namespaceURI_L2 = "http://projects.eml.org/bcb/sbml/level2"; + + public static final String shortLabel = "layout"; + + public static final String listOfLayouts = "listOfLayouts"; + public static final String listOfCompartmentGlyphs = "listOfCompartmentGlyphs"; + public static final String listOfSpeciesGlyphs = "listOfSpeciesGlyphs"; + public static final String listOfReactionGlyphs = "listOfReactionGlyphs"; + public static final String listOfTextGlyphs = "listOfTextGlyphs"; + public static final String listOfAdditionalGraphicalObjects = "listOfAdditionalGraphicalObjects"; + public static final String listOfCurveSegments = "listOfCurveSegments"; + public static final String listOfSpeciesReferenceGlyphs = "listOfSpeciesReferenceGlyphs"; + + public static final String layout = "layout"; + public static final String compartmentGlyph = "compartmentGlyph"; + public static final String speciesGlyph = "speciesGlyph"; + public static final String reactionGlyph = "reactionGlyph"; + public static final String textGlyph = "textGlyph"; + public static final String speciesReferenceGlyph = "speciesReferenceGlyph"; + public static final String boundingBox = "boundingBox"; + public static final String position = "position"; + public static final String dimensions = "dimensions"; + public static final String start = "start"; + public static final String end = "end"; + public static final String curve = "curve"; + public static final String curveSegment = "curveSegment"; + + // Attribute names of the Point XML type + public static final String x = "x"; + public static final String y = "y"; + public static final String z = "z"; + + // Attribute names of the Dimensions XML type + public static final String depth = "depth"; + public static final String width = "width"; + public static final String height = "height"; + + // Attribute names of the CompartmentGlyph XML type + public static final String compartment = "compartment"; + + // Attribute names of the speciesGlyph XML type + public static final String species = "species"; + + // Attribute names of the textGlyph XML type + public static final String graphicalObject = "graphicalObject"; + public static final String text = "text"; + public static final String originOfText = "originOfText"; + + // Attribute names of the speciesReferenceGlyph XML type + public static final String speciesReference = "speciesReference"; + public static final String role = "role"; + + + public static final String basePoint1 = "basePoint1"; + public static final String basePoint2 = "basePoint2"; + public static final String reaction = "reaction"; + +} Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -184,7 +184,7 @@ * */ public void unsetNamedSBase() { - setNamedSBase(null); + setNamedSBase((String) null); } } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -57,7 +57,7 @@ */ public Point() { super(); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); x = y = z = Double.NaN; } @@ -96,7 +96,7 @@ */ public Point(int level, int version) { super(level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); x = y = z = Double.NaN; } @@ -235,14 +235,14 @@ isAttributeRead = true; - if (attributeName.equals(LayoutConstant.x)) { + if (attributeName.equals(LayoutConstants.x)) { setX(StringTools.parseSBMLDouble(value)); } - else if(attributeName.equals(LayoutConstant.y)) + else if(attributeName.equals(LayoutConstants.y)) { setY(StringTools.parseSBMLDouble(value)); } - else if(attributeName.equals(LayoutConstant.z)) + else if(attributeName.equals(LayoutConstants.z)) { setZ(StringTools.parseSBMLDouble(value)); } @@ -261,7 +261,7 @@ public void setX(double x) { Double oldX = this.x; this.x = x; - firePropertyChange(LayoutConstant.x, oldX, this.x); + firePropertyChange(LayoutConstants.x, oldX, this.x); } /** @@ -271,7 +271,7 @@ public void setY(double y) { Double oldY = this.y; this.y = y; - firePropertyChange(LayoutConstant.y, oldY, this.y); + firePropertyChange(LayoutConstants.y, oldY, this.y); } /** @@ -281,7 +281,7 @@ public void setZ(double z) { Double oldZ = this.z; this.z = z; - firePropertyChange(LayoutConstant.z, oldZ, this.z); + firePropertyChange(LayoutConstants.z, oldZ, this.z); } /* (non-Javadoc) @@ -301,20 +301,20 @@ if (isSetId()) { attributes.remove("id"); - attributes.put(LayoutConstant.shortLabel + ":id", getId()); + attributes.put(LayoutConstants.shortLabel + ":id", getId()); } if (isSetX()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.x, StringTools.toString(Locale.ENGLISH, x)); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.x, StringTools.toString(Locale.ENGLISH, x)); } if (isSetY()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.y, StringTools.toString(Locale.ENGLISH, y)); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.y, StringTools.toString(Locale.ENGLISH, y)); } if (isSetZ()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.z, StringTools.toString(Locale.ENGLISH, z)); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.z, StringTools.toString(Locale.ENGLISH, z)); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -56,7 +56,7 @@ */ public ReactionGlyph() { super(); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -198,7 +198,7 @@ public ListOf<SpeciesReferenceGlyph> getListOfSpeciesReferenceGlyphs() { if (!isSetListOfSpeciesReferencesGlyph()) { listOfSpeciesReferencesGlyph = new ListOf<SpeciesReferenceGlyph>(); - listOfSpeciesReferencesGlyph.addNamespace(LayoutConstant.namespaceURI); + listOfSpeciesReferencesGlyph.addNamespace(LayoutConstants.namespaceURI); listOfSpeciesReferencesGlyph.setSBaseListType(ListOf.Type.other); registerChild(listOfSpeciesReferencesGlyph); } @@ -302,7 +302,7 @@ * @param reaction */ public void setReaction(String reaction) { - setNamedSBase(reaction, LayoutConstant.reaction); + setNamedSBase(reaction, LayoutConstants.reaction); } /** @@ -331,8 +331,8 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetReaction()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.reaction, getReaction()); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.reaction, getReaction()); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -165,10 +165,10 @@ if (isSetId()) { attributes.remove("id"); - attributes.put(LayoutConstant.shortLabel + ":id", getId()); + attributes.put(LayoutConstants.shortLabel + ":id", getId()); } if (isSetSpecies()) { - attributes.put(LayoutConstant.shortLabel + ":species", getSpecies()); + attributes.put(LayoutConstants.shortLabel + ":species", getSpecies()); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -267,21 +267,21 @@ isAttributeRead = true; - if(attributeName.equals(LayoutConstant.speciesReference)) + if(attributeName.equals(LayoutConstants.speciesReference)) { setSpeciesReference(value); } - else if(attributeName.equals(LayoutConstant.speciesGlyph)) + else if(attributeName.equals(LayoutConstants.speciesGlyph)) { setSpeciesGlyph(value); } - else if(attributeName.equals(LayoutConstant.role)) + else if(attributeName.equals(LayoutConstants.role)) { try { setRole(SpeciesReferenceRole.valueOf(value.toUpperCase())); } catch (Exception e) { throw new SBMLException("Could not recognized the value '" + value - + "' for the attribute " + LayoutConstant.role + + "' for the attribute " + LayoutConstants.role + " on the 'SpeciesReferenceGlyph' element."); } } @@ -301,7 +301,7 @@ public void setCurve(Curve curve) { Curve oldCurve = this.curve; this.curve = curve; - firePropertyChange(LayoutConstant.curve, oldCurve, this.role); + firePropertyChange(LayoutConstants.curve, oldCurve, this.role); registerChild(this.curve); } @@ -312,7 +312,7 @@ public void setRole(SpeciesReferenceRole valueOf) { SpeciesReferenceRole oldRole = this.role; this.role = valueOf; - firePropertyChange(LayoutConstant.role, oldRole, this.role); + firePropertyChange(LayoutConstants.role, oldRole, this.role); } /** @@ -322,7 +322,7 @@ public void setSpeciesGlyph(String speciesGlyph) { String oldValue = this.speciesGlyph; this.speciesGlyph = speciesGlyph; - firePropertyChange(LayoutConstant.speciesGlyph, oldValue, this.speciesGlyph); + firePropertyChange(LayoutConstants.speciesGlyph, oldValue, this.speciesGlyph); } /** @@ -338,7 +338,7 @@ * @param speciesReference */ public void setSpeciesReference(String speciesReference) { - setNamedSBase(speciesReference, LayoutConstant.speciesReference); + setNamedSBase(speciesReference, LayoutConstants.speciesReference); } /** @@ -356,16 +356,16 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetSpeciesGlyph()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.speciesGlyph, speciesGlyph); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.speciesGlyph, speciesGlyph); } if (isSetSpeciesReference()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.speciesReference, getSpeciesReference()); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.speciesReference, getSpeciesReference()); } if (isSetSpeciesReferenceRole()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.role, role.toString().toLowerCase()); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.role, role.toString().toLowerCase()); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -54,7 +54,7 @@ */ public TextGlyph() { super(); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -64,7 +64,7 @@ */ public TextGlyph(int level, int version) { super(level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -73,7 +73,7 @@ */ public TextGlyph(String id) { super(id); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -84,7 +84,7 @@ */ public TextGlyph(String id, int level, int version) { super(id, level, version); - addNamespace(LayoutConstant.namespaceURI); + addNamespace(LayoutConstants.namespaceURI); } /** @@ -210,15 +210,15 @@ if(!isAttributeRead) { - if(attributeName.equals(LayoutConstant.graphicalObject)) + if(attributeName.equals(LayoutConstants.graphicalObject)) { setGraphicalObject(value); } - else if(attributeName.equals(LayoutConstant.text)) + else if(attributeName.equals(LayoutConstants.text)) { setText(value); } - else if(attributeName.equals(LayoutConstant.originOfText)) + else if(attributeName.equals(LayoutConstants.originOfText)) { setOriginOfText(value); } @@ -240,7 +240,7 @@ public void setGraphicalObject(String graphicalObject) { String oldValue = this.graphicalObject; this.graphicalObject = graphicalObject; - firePropertyChange(LayoutConstant.graphicalObject, oldValue, this.graphicalObject); + firePropertyChange(LayoutConstants.graphicalObject, oldValue, this.graphicalObject); } /** @@ -266,7 +266,7 @@ public void setText(String text) { String oldText = this.text; this.text = text; - firePropertyChange(LayoutConstant.text, oldText, this.text); + firePropertyChange(LayoutConstants.text, oldText, this.text); } /* (non-Javadoc) @@ -277,16 +277,16 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetGraphicalObject()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.graphicalObject, graphicalObject); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.graphicalObject, graphicalObject); } if (isSetText()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.text, text); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.text, text); } if (isSetOriginOfText()) { - attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.originOfText, getOriginOfText()); + attributes.put(LayoutConstants.shortLabel + ":" + + LayoutConstants.originOfText, getOriginOfText()); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java 2012-06-10 06:46:51 UTC (rev 1295) +++ trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java 2012-06-10 07:01:58 UTC (rev 1296) @@ -19,30 +19,30 @@ */ package org.sbml.jsbml.xml.parsers; -import static org.sbml.jsbml.ext.layout.LayoutConstant.basePoint1; -import static org.sbml.jsbml.ext.layout.LayoutConstant.basePoint2; -import static org.sbml.jsbml.ext.layout.LayoutConstant.boundingBox; -import static org.sbml.jsbml.ext.layout.LayoutConstant.compartmentGlyph; -import static org.sbml.jsbml.ext.layout.LayoutConstant.curve; -import static org.sbml.jsbml.ext.layout.LayoutConstant.curveSegment; -import static org.sbml.jsbml.ext.layout.LayoutConstant.dimensions; -import static org.sbml.jsbml.ext.layout.LayoutConstant.end; -import static org.sbml.jsbml.ext.layout.LayoutConstant.layout; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfAdditionalGraphicalObjects; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfCompartmentGlyphs; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfCurveSegments; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfLayouts; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfReactionGlyphs; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfSpeciesGlyphs; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfSpeciesReferenceGlyphs; -import static org.sbml.jsbml.ext.layout.LayoutConstant.listOfTextGlyphs; -import static org.sbml.jsbml.ext.layout.LayoutConstant.namespaceURI; -import static org.sbml.jsbml.ext.layout.LayoutConstant.position; -import static org.sbml.jsbml.ext.layout.LayoutConstant.reactionGlyph; -import static org.sbml.jsbml.ext.layout.LayoutConstant.speciesGlyph; -import static org.sbml.jsbml.ext.layout.LayoutConstant.speciesReferenceGlyph; -import static org.sbml.jsbml.ext.layout.LayoutConstant.start; -import static org.sbml.jsbml.ext.layout.LayoutConstant.textGlyph; +import static org.sbml.jsbml.ext.layout.LayoutConstants.basePoint1; +import static org.sbml.jsbml.ext.layout.LayoutConstants.basePoint2; +import static org.sbml.jsbml.ext.layout.LayoutConstants.boundingBox; +import static org.sbml.jsbml.ext.layout.LayoutConstants.compartmentGlyph; +import static org.sbml.jsbml.ext.layout.LayoutConstants.curve; +import static org.sbml.jsbml.ext.layout.LayoutConstants.curveSegment; +import static org.sbml.jsbml.ext.layout.LayoutConstants.dimensions; +import static org.sbml.jsbml.ext.layout.LayoutConstants.end; +import static org.sbml.jsbml.ext.layout.LayoutConstants.layout; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfAdditionalGraphicalObjects; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfCompartmentGlyphs; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfCurveSegments; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfLayouts; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfReactionGlyphs; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfSpeciesGlyphs; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfSpeciesReferenceGlyphs; +import static org.sbml.jsbml.ext.layout.LayoutConstants.listOfTextGlyphs; +import static org.sbml.jsbml.ext.layout.LayoutConstants.namespaceURI; +import static org.sbml.jsbml.ext.layout.LayoutConstants.position; +import static org.sbml.jsbml.ext.layout.LayoutConstants.reactionGlyph; +import static org.sbml.jsbml.ext.layout.LayoutConstants.speciesGlyph; +import static org.sbml.jsbml.ext.layout.LayoutConstants.speciesReferenceGlyph; +import static org.sbml.jsbml.ext.layout.LayoutConstants.start; +import static org.sbml.jsbml.ext.layout.LayoutConstants.textGlyph; import java.util.ArrayList; @@ -62,7 +62,7 @@ import org.sbml.jsbml.ext.layout.ExtendedLayoutModel; import org.sbml.jsbml.ext.layout.GraphicalObject; import org.sbml.jsbml.ext.layout.Layout; -import org.sbml.jsbml.ext.layout.LayoutConstant; +import org.sbml.jsbml.ext.layout.LayoutConstants; import org.sbml.jsbml.ext.layout.Position; import org.sbml.jsbml.ext.layout.ReactionGlyph; import org.sbml.jsbml.ext.layout.SpeciesGlyph; @@ -90,11 +90,11 @@ * @return the namespaceURI of this parser. */ public String getNamespaceURI() { - return LayoutConstant.namespaceURI; + return LayoutConstants.namespaceURI; } public String getShortLabel() { - return LayoutConstant.shortLabel; + return LayoutConstants.shortLabel; } private Logger logger = Logger.getLogger(L3LayoutParser.class); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-10 06:46:39
|
Revision: 1294 http://jsbml.svn.sourceforge.net/jsbml/?rev=1294&view=rev Author: andreas-draeger Date: 2012-06-10 06:46:32 +0000 (Sun, 10 Jun 2012) Log Message: ----------- TextGlyph has now also become an instance of NamedSBaseGlyph. The methods returning an instance of core elements, e.g., getSpeciesInstance() in all derivatives of NamedSBaseGlyph have been removed because it is possible to let ids point to NamedSBases from other packages. Many classes that extend AbstractNamedSBase now have also become UniqueNamedSBase in order to better support their registration in the model. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/Model.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/ReactionRule.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeInstance.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeRestriction.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeSpecies.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/SymbolicValue.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java Modified: trunk/core/src/org/sbml/jsbml/Model.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Model.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/core/src/org/sbml/jsbml/Model.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -3929,8 +3929,9 @@ success &= registerId((UnitDefinition) newNsb, !delete); } else { // in L3 packages we might have different id namespaces - logger.error("registerIds : the object " + newNsb.getClass().getCanonicalName() + " is neither " + - "a UniqueNamedSBase, a LocalParameter or a UnitDefinition so it's id will not be registered in the Model."); + logger.error(MessageFormat.format( + "registerIds: the object {0} is neither a UniqueNamedSBase, a LocalParameter or a UnitDefinition so its id will not be registered in the Model.", + newNsb.getClass().getCanonicalName())); } } else if (!newNsb.isIdMandatory()) { // do nothing Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -95,14 +95,6 @@ return getNamedSBase(); } - /** - * - * @return - */ - public Compartment getCompartmentInstance() { - return getNamedSBaseInstance(); - } - /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.NamedSBaseGlyph#getNamedSBaseInstance() */ Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -31,6 +31,7 @@ import org.sbml.jsbml.NamedSBase; import org.sbml.jsbml.Reaction; import org.sbml.jsbml.Species; +import org.sbml.jsbml.UniqueNamedSBase; import org.sbml.jsbml.util.TreeNodeChangeListener; import org.sbml.jsbml.util.filters.NameFilter; @@ -43,7 +44,7 @@ * @since 1.0 * @version $Rev$ */ -public class Layout extends AbstractNamedSBase { +public class Layout extends AbstractNamedSBase implements UniqueNamedSBase { /** * Generated serial version identifier. @@ -58,6 +59,7 @@ /** * */ + // TODO: Why are there methods called addGraphicalObjects and additionalGraphicalObjects? private ListOf<GraphicalObject> listOfAdditionalGraphicalObjects; /** * @@ -157,7 +159,7 @@ public void addAdditionalGraphical(GraphicalObject object) { if (object != null) { registerChild(object); - listOfAdditionalGraphicalObjects.add(object); + getListOfAdditionalGraphicalObjects().add(object); } } @@ -179,7 +181,7 @@ public void addReactionGlyph(ReactionGlyph reactionGlyph) { if (reactionGlyph != null) { registerChild(reactionGlyph); - listOfReactionGlyphs.add(reactionGlyph); + getListOfReactionGlyphs().add(reactionGlyph); } } @@ -190,7 +192,7 @@ public void addSpeciesGlyph(SpeciesGlyph speciesGlyph) { if (speciesGlyph != null) { registerChild(speciesGlyph); - listOfSpeciesGlyphs.add(speciesGlyph); + getListOfSpeciesGlyphs().add(speciesGlyph); } } @@ -201,7 +203,7 @@ public void addTextGlyph(TextGlyph TextGlyph) { if (TextGlyph != null) { registerChild(TextGlyph); - listOfTextGlyphs.add(TextGlyph); + getListOfTextGlyphs().add(TextGlyph); } } @@ -262,15 +264,11 @@ * * @param id * the identifier of the {@link CompartmentGlyph} to be created. - * @param compartment - * {@link Compartment} ID. * @return a new {@link CompartmentGlyph}. + * @see #createCompartmentGlyph(String, String) */ - public CompartmentGlyph createCompartmentGlyph(String id, String compartment) { - CompartmentGlyph glyph = new CompartmentGlyph(id, getLevel(), getVersion()); - glyph.setCompartment(compartment); - addCompartmentGlyph(glyph); - return glyph; + public CompartmentGlyph createCompartmentGlyph(String id) { + return createCompartmentGlyph(id, null); } /** @@ -278,11 +276,15 @@ * * @param id * the identifier of the {@link CompartmentGlyph} to be created. + * @param compartment + * {@link Compartment} ID. * @return a new {@link CompartmentGlyph}. - * @see #createCompartmentGlyph(String, String) */ - public CompartmentGlyph createCompartmentGlyph(String id) { - return createCompartmentGlyph(id, null); + public CompartmentGlyph createCompartmentGlyph(String id, String compartment) { + CompartmentGlyph glyph = new CompartmentGlyph(id, getLevel(), getVersion()); + glyph.setCompartment(compartment); + addCompartmentGlyph(glyph); + return glyph; } /** @@ -325,6 +327,18 @@ * * @param id * the identifier of the {@link ReactionGlyph} to be created. + * @return a new {@link ReactionGlyph}. + * @see #createReactionGlyph(String, String) + */ + public ReactionGlyph createReactionGlyph(String id) { + return createReactionGlyph(id, null); + } + + /** + * Creates and adds a new {@link ReactionGlyph}. + * + * @param id + * the identifier of the {@link ReactionGlyph} to be created. * @param reaction * {@link Reaction} ID. * @return a new {@link ReactionGlyph}. @@ -335,19 +349,19 @@ addReactionGlyph(glyph); return glyph; } - + /** - * Creates and adds a new {@link ReactionGlyph}. + * Creates and adds a new {@link SpeciesGlyph} with the given identifier. * * @param id - * the identifier of the {@link ReactionGlyph} to be created. - * @return a new {@link ReactionGlyph}. - * @see #createReactionGlyph(String, String) + * the identifier for the {@link SpeciesGlyph} to be created. + * @return a new {@link SpeciesGlyph}. + * @see #createSpeciesGlyph(String, String) */ - public ReactionGlyph createReactionGlyph(String id) { - return createReactionGlyph(id, null); + public SpeciesGlyph createSpeciesGlyph(String id) { + return createSpeciesGlyph(id, null); } - + /** * Creates and adds a new {@link SpeciesGlyph}. * @@ -363,19 +377,19 @@ addSpeciesGlyph(glyph); return glyph; } - + /** - * Creates and adds a new {@link SpeciesGlyph} with the given identifier. + * Creates and adds a new {@link TextGlyph}. * * @param id - * the identifier for the {@link SpeciesGlyph} to be created. - * @return a new {@link SpeciesGlyph}. - * @see #createSpeciesGlyph(String, String) + * the identifier for the {@link TextGlyph} to be created. + * @return a new {@link TextGlyph}. + * @see #createTextGlyph(String, String) */ - public SpeciesGlyph createSpeciesGlyph(String id) { - return createSpeciesGlyph(id, null); + public TextGlyph createTextGlyph(String id) { + return createTextGlyph(id, null); } - + /** * Creates and adds a new {@link TextGlyph}. * @@ -393,18 +407,6 @@ } /** - * Creates and adds a new {@link TextGlyph}. - * - * @param id - * the identifier for the {@link TextGlyph} to be created. - * @return a new {@link TextGlyph}. - * @see #createTextGlyph(String, String) - */ - public TextGlyph createTextGlyph(String id) { - return createTextGlyph(id, null); - } - - /** * Searches all instances of {@link CompartmentGlyph} within this {@link Layout} that * refer to the {@link Compartment} with the given id. * @@ -424,14 +426,14 @@ */ @SuppressWarnings("unchecked") private <T> List<T> findGlyphs(ListOf<? extends T> listOfGlyphs, String id) { - if (isSetListOfReactionGlyphs()) { + if (isSetListOfReactionGlyphs() && (listOfGlyphs != null) && (!listOfGlyphs.isEmpty())) { NamedSBaseReferenceFilter filter = new NamedSBaseReferenceFilter(id); filter.setFilterForReference(true); return (List<T>) listOfReactionGlyphs.filter(filter); } return new ArrayList<T>(0); } - + /** * Searches all instances of {@link ReactionGlyph} within this {@link Layout} that * refer to the {@link Reaction} with the given id. @@ -443,7 +445,7 @@ public List<ReactionGlyph> findReactionGlyphs(String reactionID) { return findGlyphs(listOfReactionGlyphs, reactionID); } - + /** * Searches all instances of {@link SpeciesGlyph} within this {@link Layout} that * refer to the {@link Species} with the given id. @@ -455,6 +457,19 @@ public List<SpeciesGlyph> findSpeciesGlyphs(String speciesID) { return findGlyphs(listOfSpeciesGlyphs, speciesID); } + + /** + * Searches within the {@link #listOfTextGlyphs} for {@link TextGlyph}s whose + * {@link TextGlyph#getOriginOfText()} points to the given id. + * + * @param id + * the identifier of the element for which {@link TextGlyph}s are to be + * found. + * @return all {@link TextGlyph}s associated to an element with the given id. + */ + public List<TextGlyph> findTextGlyphs(String id) { + return findGlyphs(listOfTextGlyphs, id); + } /** * @@ -683,7 +698,28 @@ /** * + * @param i + * @return */ + public TextGlyph getTextGlyph(int i) { + return getListOfTextGlyphs().get(i); + } + + /** + * + * @param id + * @return + */ + public TextGlyph getTextGlyph(String id) { + if (isSetListOfTextGlyphs()) { + return listOfTextGlyphs.firstHit(new NameFilter(id)); + } + return null; + } + + /** + * + */ private void initDefault() { addNamespace(LayoutConstant.namespaceURI); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -144,6 +144,14 @@ public boolean isSetNamedSBase() { return (sbaseID != null) && (sbaseID.length() > 0); } + + /** + * + * @param namedSBase + */ + public void setNamedSBase(NamedSBase namedSBase) { + setNamedSBase(namedSBase.getId()); + } /** * Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -222,16 +222,8 @@ } /** - * * @return */ - public Reaction getReactionInstance() { - return getNamedSBaseInstance(); - } - - /** - * @return - */ public boolean isSetCurve() { return curve != null; } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -103,14 +103,6 @@ public String getSpecies() { return getNamedSBase(); } - - /** - * - * @return - */ - public Species getSpeciesInstance() { - return getNamedSBaseInstance(); - } /** * @return the {@link #speciesId} Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -204,16 +204,8 @@ } /** - * * @return */ - public SimpleSpeciesReference getSpeciesReferenceInstance() { - return getNamedSBaseInstance(); - } - - /** - * @return - */ public SpeciesReferenceRole getSpeciesReferenceRole() { return role; } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -21,8 +21,10 @@ import java.util.Map; +import org.sbml.jsbml.NamedSBase; + /** * @author Nicolas Rodriguez * @author Sebastian Frölich @@ -30,7 +32,7 @@ * @since 1.0 * @version $Rev$ */ -public class TextGlyph extends GraphicalObject { +public class TextGlyph extends NamedSBaseGlyph { /** * Generated serial version identifier. @@ -45,11 +47,6 @@ /** * */ - private String originOfText; - - /** - * - */ private String text; /** @@ -96,12 +93,12 @@ */ public TextGlyph(TextGlyph textGlyph) { super(textGlyph); - - // TODO : use the iSet methods - - this.graphicalObject = new String(textGlyph.getGraphicalObject()); - this.originOfText = new String(textGlyph.getOriginOfText()); - this.text = new String(textGlyph.getText()); + if (textGlyph.isSetGraphicalObject()) { + this.graphicalObject = new String(textGlyph.getGraphicalObject()); + } + if (textGlyph.isSetText()) { + this.text = new String(textGlyph.getText()); + } } /* (non-Javadoc) @@ -149,7 +146,7 @@ * @return */ public String getOriginOfText() { - return originOfText; + return getNamedSBase(); } /** @@ -191,7 +188,7 @@ * @return */ public boolean isSetOriginOfText() { - return originOfText != null; + return isSetNamedSBase(); } /** @@ -250,10 +247,16 @@ * * @param originOfText */ + public void setOriginOfText(NamedSBase originOfText) { + setNamedSBase(originOfText); + } + + /** + * + * @param originOfText + */ public void setOriginOfText(String originOfText) { - String oldOriginOfText = this.originOfText; - this.originOfText = originOfText; - firePropertyChange(LayoutConstant.originOfText, oldOriginOfText, this.originOfText); + setNamedSBase(originOfText); } /** @@ -283,7 +286,7 @@ } if (isSetOriginOfText()) { attributes.put(LayoutConstant.shortLabel + ":" - + LayoutConstant.originOfText, originOfText); + + LayoutConstant.originOfText, getOriginOfText()); } return attributes; Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/ReactionRule.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/ReactionRule.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/ReactionRule.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -8,7 +8,12 @@ public class ReactionRule extends AbstractNamedSBase { - ListOf<SpeciesTypeRestrictionReference> listOfConditions; + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 7757296070294814156L; + + ListOf<SpeciesTypeRestrictionReference> listOfConditions; ListOf<SpeciesTypeRestrictionReference> listOfResults; // TODO : add a kineticLaw @@ -113,10 +118,17 @@ return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.NamedSBase#isIdMandatory() + */ + //@Override public boolean isIdMandatory() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() + */ @Override public AbstractSBase clone() { // TODO Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeInstance.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeInstance.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeInstance.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -6,7 +6,12 @@ public class SpeciesTypeInstance extends AbstractNamedSBase { - private double initialAmount; + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 1775590492963078468L; + + private double initialAmount; private double initialConcentration; Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeRestriction.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeRestriction.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeRestriction.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -5,7 +5,11 @@ public class SpeciesTypeRestriction extends AbstractNamedSBase { - private String speciesTypeInstance; + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -6703552149441215128L; + private String speciesTypeInstance; /** * Returns the speciesTypeInstance. @@ -25,11 +29,17 @@ this.speciesTypeInstance = speciesTypeInstance; } - + /* (non-Javadoc) + * @see org.sbml.jsbml.NamedSBase#isIdMandatory() + */ + //@Override public boolean isIdMandatory() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() + */ @Override public AbstractSBase clone() { // TODO Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -15,6 +15,11 @@ public class SpeciesTypeState extends AbstractNamedSBase implements UniqueNamedSBase { /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 7110790636241167977L; + + /** * */ private String speciesType; Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -23,6 +23,10 @@ public class StateFeature extends AbstractNamedSBase implements UniqueNamedSBase { /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -1796119514784158560L; + /** * */ ListOf<PossibleValue> listOfPossibleValues; Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -11,7 +11,12 @@ public class StateFeatureInstance extends AbstractNamedSBase { - private String stateFeature; + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = 3961860838884568696L; + + private String stateFeature; private ListOf<StateFeatureValue> listOfStateFeatureValues; @@ -23,10 +28,17 @@ initDefaults(); } + /* (non-Javadoc) + * @see org.sbml.jsbml.NamedSBase#isIdMandatory() + */ + //@Override public boolean isIdMandatory() { return false; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#clone() + */ @Override public AbstractSBase clone() { // TODO Modified: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeSpecies.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeSpecies.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeSpecies.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -40,7 +40,7 @@ * @since 1.0 * @date $Date$ */ -public class QualitativeSpecies extends AbstractNamedSBase implements UniqueNamedSBase{ +public class QualitativeSpecies extends AbstractNamedSBase implements UniqueNamedSBase { /** * Generated serial version identifier. Modified: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/SymbolicValue.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/SymbolicValue.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/SymbolicValue.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -35,7 +35,7 @@ * @since 1.0 * @date $Date$ */ -public class SymbolicValue extends AbstractNamedSBase implements UniqueNamedSBase{ +public class SymbolicValue extends AbstractNamedSBase implements UniqueNamedSBase { /** * Generated serial version identifier. @@ -210,6 +210,7 @@ /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#readAttribute(java.lang.String, java.lang.String, java.lang.String) */ + @Override public boolean readAttribute(String attributeName, String prefix, String value) { boolean isAttributeRead = super.readAttribute(attributeName, prefix, value); @@ -230,6 +231,7 @@ /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() */ + @Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -28,6 +28,7 @@ import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.SBase; +import org.sbml.jsbml.UniqueNamedSBase; /** @@ -39,7 +40,7 @@ * @since 1.0 * @date 08.05.2012 */ -public class GradientBase extends AbstractNamedSBase { +public class GradientBase extends AbstractNamedSBase implements UniqueNamedSBase { /** * Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -29,6 +29,7 @@ import org.sbml.jsbml.ListOf; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; +import org.sbml.jsbml.UniqueNamedSBase; import org.sbml.jsbml.util.filters.NameFilter; /** @@ -40,7 +41,7 @@ * @since 1.0 * @date 04.05.2012 */ -public class RenderInformationBase extends AbstractNamedSBase { +public class RenderInformationBase extends AbstractNamedSBase implements UniqueNamedSBase { /** * Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-06-08 14:48:51 UTC (rev 1293) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java 2012-06-10 06:46:32 UTC (rev 1294) @@ -26,6 +26,7 @@ import org.sbml.jsbml.LevelVersionError; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.SBase; +import org.sbml.jsbml.UniqueNamedSBase; /** * @author Eugen Netz @@ -36,7 +37,7 @@ * @since 1.0 * @date 08.05.2012 */ -public class Style extends AbstractNamedSBase { +public class Style extends AbstractNamedSBase implements UniqueNamedSBase { /** * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-11 12:48:04
|
Revision: 1299 http://jsbml.svn.sourceforge.net/jsbml/?rev=1299&view=rev Author: andreas-draeger Date: 2012-06-11 12:47:53 +0000 (Mon, 11 Jun 2012) Log Message: ----------- Solved the problem that sometimes non-English locale was used leading to incorrectly spelled double numbers. Added some missing convenient methods. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/ListOf.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-11 12:40:40 UTC (rev 1298) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-11 12:47:53 UTC (rev 1299) @@ -268,9 +268,7 @@ list.setVersion(parent.getVersion()); } list.setSBaseListType(type); - if (parent instanceof AbstractSBase) { - ((AbstractSBase) parent).registerChild(list); - } + parent.registerChild(list); return list; } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java 2012-06-11 12:40:40 UTC (rev 1298) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java 2012-06-11 12:47:53 UTC (rev 1299) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.layout; +import java.util.Locale; import java.util.Map; import org.sbml.jsbml.AbstractNamedSBase; @@ -287,16 +288,16 @@ } if (isSetDepth()) { - attributes.put(LayoutConstants.shortLabel + ":" - + LayoutConstants.depth, StringTools.toString(depth)); + attributes.put(LayoutConstants.shortLabel + ':' + + LayoutConstants.depth, StringTools.toString(Locale.ENGLISH, depth)); } if (isSetHeight()) { - attributes.put(LayoutConstants.shortLabel + ":" - + LayoutConstants.height, StringTools.toString(height)); + attributes.put(LayoutConstants.shortLabel + ':' + + LayoutConstants.height, StringTools.toString(Locale.ENGLISH, height)); } if (isSetWidth()) { - attributes.put(LayoutConstants.shortLabel + ":" - + LayoutConstants.width, StringTools.toString(width)); + attributes.put(LayoutConstants.shortLabel + ':' + + LayoutConstants.width, StringTools.toString(Locale.ENGLISH, width)); } return attributes; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java 2012-06-11 12:40:40 UTC (rev 1298) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java 2012-06-11 12:47:53 UTC (rev 1299) @@ -189,6 +189,14 @@ } /** + * + * @return + */ + public int getLayoutCount() { + return isSetListOfLayouts() ? listOfLayouts.size() : 0; + } + + /** * * @return */ @@ -229,7 +237,7 @@ return false; } - /** + /** * * @param listOfLayouts */ @@ -254,7 +262,7 @@ // TODO Auto-generated method stub return null; } - + /** * Removes the {@link #listOfLayouts} from this {@link Model} and notifies * all registered instances of {@link TreeNodeChangeListener}. @@ -271,7 +279,7 @@ } return false; } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() */ Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-11 12:40:40 UTC (rev 1298) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-11 12:47:53 UTC (rev 1299) @@ -158,7 +158,6 @@ */ public void addAdditionalGraphical(GraphicalObject object) { if (object != null) { - registerChild(object); getListOfAdditionalGraphicalObjects().add(object); } } @@ -169,7 +168,6 @@ */ public void addCompartmentGlyph(CompartmentGlyph compartmentGlyph) { if (compartmentGlyph != null) { - registerChild(compartmentGlyph); getListOfCompartmentGlyphs().add(compartmentGlyph); } } @@ -180,7 +178,6 @@ */ public void addReactionGlyph(ReactionGlyph reactionGlyph) { if (reactionGlyph != null) { - registerChild(reactionGlyph); getListOfReactionGlyphs().add(reactionGlyph); } } @@ -191,7 +188,6 @@ */ public void addSpeciesGlyph(SpeciesGlyph speciesGlyph) { if (speciesGlyph != null) { - registerChild(speciesGlyph); getListOfSpeciesGlyphs().add(speciesGlyph); } } @@ -202,7 +198,6 @@ */ public void addTextGlyph(TextGlyph TextGlyph) { if (TextGlyph != null) { - registerChild(TextGlyph); getListOfTextGlyphs().add(TextGlyph); } } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java 2012-06-11 12:40:40 UTC (rev 1298) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LayoutConstants.java 2012-06-11 12:47:53 UTC (rev 1299) @@ -87,5 +87,18 @@ public static final String basePoint1 = "basePoint1"; public static final String basePoint2 = "basePoint2"; public static final String reaction = "reaction"; + + /** + * + * @param level + * @param version + * @return + */ + public static String getNamespaceURI(int level, int version) { + if (level < 3) { + return namespaceURI_L2; + } + return namespaceURI; + } } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java 2012-06-11 12:40:40 UTC (rev 1298) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Point.java 2012-06-11 12:47:53 UTC (rev 1299) @@ -289,7 +289,7 @@ */ @Override public String toString() { - return "Point [" + x + ", " + y + ", " + z + "]"; + return "Point [" + x + ", " + y + ", " + z + ']'; } /* (non-Javadoc) @@ -305,15 +305,15 @@ } if (isSetX()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.x, StringTools.toString(Locale.ENGLISH, x)); } if (isSetY()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.y, StringTools.toString(Locale.ENGLISH, y)); } if (isSetZ()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.z, StringTools.toString(Locale.ENGLISH, z)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-12 06:21:38
|
Revision: 1301 http://jsbml.svn.sourceforge.net/jsbml/?rev=1301&view=rev Author: andreas-draeger Date: 2012-06-12 06:21:26 +0000 (Tue, 12 Jun 2012) Log Message: ----------- Added several convenient methods and avoided null pointer exceptions when dealing with user objects. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java trunk/core/src/org/sbml/jsbml/SBO.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java Modified: trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -61,6 +61,7 @@ * @return the index of the child in the parent's list of children or -1 if no * such child can be found. */ + @SuppressWarnings("unchecked") public static int indexOf(TreeNode parent, TreeNode child) { if (child == null) { throw new IllegalArgumentException("Argument is null."); @@ -249,7 +250,7 @@ */ //@Override public boolean containsUserObjectKey(Object key) { - return userObjects.containsKey(key); + return isSetUserObjects() ? userObjects.containsKey(key) : false; } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/SBO.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBO.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/core/src/org/sbml/jsbml/SBO.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -700,6 +700,15 @@ return 534; } + /** + * Physical compartment. + * + * @return + */ + public static int getCompartment() { + return 290; + } + /** * * @return Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -94,14 +94,6 @@ public String getCompartment() { return getNamedSBase(); } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.layout.NamedSBaseGlyph#getNamedSBaseInstance() - */ - @Override - public Compartment getNamedSBaseInstance() { - return (Compartment) super.getNamedSBaseInstance(); - } /** * @return Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -479,6 +479,14 @@ return null; } + /** + * + * @return + */ + public int getAdditionalGraphicalObjectCount() { + return isSetListOfAdditionalGraphicalObjects() ? listOfAdditionalGraphicalObjects.size() : 0; + } + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) */ @@ -531,7 +539,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @@ -558,7 +566,7 @@ } return count; } - + /** * * @param i @@ -567,7 +575,7 @@ public CompartmentGlyph getCompartmentGlyph(int i) { return getListOfCompartmentGlyphs().get(i); } - + /** * * @param id @@ -584,10 +592,19 @@ * * @return */ + public int getCompartmentGlyphCount() { + return isSetListOfCompartmentGlyphs() ? listOfCompartmentGlyphs.size() : 0; + } + + /** + * + * @return + */ public Dimensions getDimensions() { return dimensions; } - + + /** * * @return @@ -599,7 +616,7 @@ } return listOfAdditionalGraphicalObjects; } - + /** * * @return @@ -611,7 +628,6 @@ } return listOfCompartmentGlyphs; } - /** * @@ -624,7 +640,7 @@ } return listOfReactionGlyphs; } - + /** * * @return @@ -669,16 +685,24 @@ } return null; } - + /** * + * @return + */ + public int getReactionGlyphCount() { + return isSetListOfReactionGlyphs() ? listOfReactionGlyphs.size() : 0; + } + + /** + * * @param i * @return */ public SpeciesGlyph getSpeciesGlyph(int i) { return getListOfSpeciesGlyphs().get(i); } - + /** * * @param id @@ -690,16 +714,24 @@ } return null; } - + /** * + * @return + */ + public int getSpeciesGlyphCount() { + return isSetListOfSpeciesGlyphs() ? listOfSpeciesGlyphs.size() : 0; + } + + /** + * * @param i * @return */ public TextGlyph getTextGlyph(int i) { return getListOfTextGlyphs().get(i); } - + /** * * @param id @@ -711,14 +743,22 @@ } return null; } - + /** * + * @return */ + public int getTextGlyphCount() { + return isSetListOfTextGlyphs() ? listOfTextGlyphs.size() : 0; + } + + /** + * + */ private void initDefault() { addNamespace(LayoutConstants.namespaceURI); } - + /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ @@ -726,21 +766,21 @@ // See "Including Layout Information in SBML Files" Version 2.2, p. 6 return true; } - + /** * @return */ public boolean isSetAddGraphicalObjects() { return (listOfAdditionalGraphicalObjects != null) && (listOfAdditionalGraphicalObjects.size() > 0); } - + /** * @return */ public boolean isSetDimensions() { return dimensions != null; } - + /** * @return */ @@ -769,14 +809,14 @@ public boolean isSetListOfSpeciesGlyphs() { return (listOfSpeciesGlyphs != null) && (listOfSpeciesGlyphs.size() > 0); } - + /** * @return */ public boolean isSetListOfTextGlyphs() { return (listOfTextGlyphs != null) && (listOfTextGlyphs.size() > 0); } - + /** * @param attributeName * @param prefix @@ -814,7 +854,7 @@ this.dimensions = dimensions; registerChild(this.dimensions); } - + /** * * @param AdditionalGraphicalObjects @@ -827,7 +867,7 @@ registerChild(this.listOfAdditionalGraphicalObjects); } } - + /** * * @param compartmentGlyphs @@ -840,7 +880,7 @@ } registerChild(this.listOfCompartmentGlyphs); } - + /** * * @param reactionGlyphs @@ -853,7 +893,7 @@ registerChild(this.listOfReactionGlyphs); } } - + /** * * @param speciesGlyphs @@ -870,7 +910,7 @@ registerChild(this.listOfSpeciesGlyphs); } } - + /** * * @param textGlyphs @@ -883,7 +923,7 @@ registerChild(this.listOfTextGlyphs); } } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#toString() */ @@ -891,7 +931,7 @@ public String toString() { return getElementName(); } - + /** * Removes the {@link #listOfAdditionalGraphicalObjects} from this {@link Model} and notifies * all registered instances of {@link TreeNodeChangeListener}. @@ -925,7 +965,7 @@ } return false; } - + /** * Removes the {@link #listOfReactionGlyphs} from this {@link Model} and notifies * all registered instances of {@link TreeNodeChangeListener}. @@ -959,7 +999,7 @@ } return false; } - + /** * Removes the {@link #listOfTextGlyphs} from this {@link Model} and notifies * all registered instances of {@link TreeNodeChangeListener}. Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -205,14 +205,6 @@ return listOfSpeciesReferencesGlyph; } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.layout.NamedSBaseGlyph#getNamedSBaseInstance() - */ - @Override - public Reaction getNamedSBaseInstance() { - return (Reaction) super.getNamedSBaseInstance(); - } - /** * * @return @@ -331,7 +323,7 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetReaction()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.reaction, getReaction()); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -87,14 +87,6 @@ public SpeciesGlyph clone() { return new SpeciesGlyph(this); } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.layout.NamedSBaseGlyph#getNamedSBaseInstance() - */ - @Override - public Species getNamedSBaseInstance() { - return (Species) super.getNamedSBaseInstance(); - } /** * Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -179,14 +179,6 @@ return curve; } - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.layout.NamedSBaseGlyph#getNamedSBaseInstance() - */ - @Override - public SimpleSpeciesReference getNamedSBaseInstance() { - return (SimpleSpeciesReference) super.getNamedSBaseInstance(); - } - /** * * @return @@ -356,15 +348,15 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetSpeciesGlyph()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.speciesGlyph, speciesGlyph); } if (isSetSpeciesReference()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.speciesReference, getSpeciesReference()); } if (isSetSpeciesReferenceRole()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.role, role.toString().toLowerCase()); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-11 19:29:10 UTC (rev 1300) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-12 06:21:26 UTC (rev 1301) @@ -285,15 +285,15 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (isSetGraphicalObject()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.graphicalObject, graphicalObject); } if (isSetText()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.text, text); } if (isSetOriginOfText()) { - attributes.put(LayoutConstants.shortLabel + ":" + attributes.put(LayoutConstants.shortLabel + ':' + LayoutConstants.originOfText, getOriginOfText()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <the...@us...> - 2012-06-12 09:40:30
|
Revision: 1302 http://jsbml.svn.sourceforge.net/jsbml/?rev=1302&view=rev Author: thesentry Date: 2012-06-12 09:40:18 +0000 (Tue, 12 Jun 2012) Log Message: ----------- * first draft implementation of the render extension writer/parser * fixed some minor bugs * added render extension to PackageParserNamespaces.xml * added test class for the RenderParser (writing) Modified Paths: -------------- trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml trunk/core/src/org/sbml/jsbml/ListOf.java trunk/core/src/org/sbml/jsbml/util/StringTools.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java Added Paths: ----------- trunk/extensions/render/test/org/ trunk/extensions/render/test/org/sbml/ trunk/extensions/render/test/org/sbml/jsbml/ trunk/extensions/render/test/org/sbml/jsbml/ext/ trunk/extensions/render/test/org/sbml/jsbml/ext/render/ trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java Removed Paths: ------------- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java Modified: trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml =================================================================== --- trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml 2012-06-12 09:40:18 UTC (rev 1302) @@ -42,6 +42,7 @@ <entry key="http://www.sbml.org/sbml/level3/version1/qual/version1">org.sbml.jsbml.xml.parsers.QualParser</entry> <entry key="http://www.sbml.org/sbml/level3/version1/layout/version1">org.sbml.jsbml.xml.parsers.L3LayoutParser</entry> <entry key="http://www.sbml.org/sbml/level3/version1/multi/version1">org.sbml.jsbml.xml.parsers.MultiParser</entry> + <entry key="http://www.sbml.org/sbml/level3/version1/render/version1">org.sbml.jsbml.xml.parsers.RenderParser</entry> <!-- Core parsers Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -923,7 +923,9 @@ if (listType.equals(Type.other) && size() > 0) { String className = get(0).getClass().getSimpleName(); - return "listOf" + className + (className.endsWith("s") ? "" : "s"); + return "listOf" + className + + ((className.endsWith("s") || className.toLowerCase().endsWith( + "information")) ? "" : "s"); } return listType.toString(); Modified: trunk/core/src/org/sbml/jsbml/util/StringTools.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/StringTools.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/core/src/org/sbml/jsbml/util/StringTools.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -410,7 +410,7 @@ * @return the {@link String} as an short. If the {@link String} is not a * valid short number, 0 is returned. */ - public static int parseSBMLShort(String value) { + public static short parseSBMLShort(String value) { short v = 0; try { v = Short.parseShort(value.trim()); Modified: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -62,7 +62,6 @@ super(model); } - /** * Adds a {@link QualitativeSpecies} to the model. * Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -43,14 +43,15 @@ private Short versionMinor; private GlobalRenderInformation renderInformation; - /** - * Creates an AbstractRenderPlugin instance - */ - public AbstractRenderPlugin() { - super(); - initDefaults(); - } + /** + * Creates an AbstractRenderPlugin instance + */ + public AbstractRenderPlugin(SBase extendedElement) { + super(extendedElement); + initDefaults(); + } + /** * Creates a AbstractRenderPlugin instance with a level and version. * Deleted: trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/ExtendedRenderModel.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -1,465 +0,0 @@ -/* - * $Id$ - * $URL$ - * - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ -package org.sbml.jsbml.ext.render; - -import java.text.MessageFormat; -import java.util.Map; - -import org.sbml.jsbml.ListOf; -import org.sbml.jsbml.SBase; -import org.sbml.jsbml.ext.AbstractSBasePlugin; -import org.sbml.jsbml.util.filters.NameFilter; - - -/** - * @author Eugen Netz - * @author Alexander Diamantikos - * @author Jakob Matthes - * @author Jan Rudolph - * @version $Rev$ - * @since 1.0 - * @date 14.05.2012 - */ -public class ExtendedRenderModel extends AbstractSBasePlugin { - /** - * - */ - private static final long serialVersionUID = -7046023464349980639L; - - private ListOf<LocalRenderInformation> listOfLocalRenderInformation; - private ListOf<GlobalRenderInformation> listOfGlobalRenderInformation; - private Integer versionMajor; - private Integer versionMinor; - - /** - * Creates an ExtendedRenderModel instance - */ - public ExtendedRenderModel() { - super(); - initDefaults(); - } - - /** - * Creates a ExtendedRenderModel instance with a level and version. - * - * @param level - * @param version - */ - public ExtendedRenderModel(int level, int version) { - this(null, null, level, version); - } - - /** - * Creates a ExtendedRenderModel instance with an id, level, and version. - * - * @param id - * @param level - * @param version - */ - public ExtendedRenderModel(String id, int level, int version) { - this(id, null, level, version); - } - - /** - * Creates a ExtendedRenderModel instance with an id, name, level, and version. - * - * @param id - * @param name - * @param level - * @param version - */ - public ExtendedRenderModel(String id, String name, int level, int version) { - super(); - /*if (getLevelAndVersion().compareTo(Integer.valueOf(MIN_SBML_LEVEL), - Integer.valueOf(MIN_SBML_VERSION)) < 0) { - throw new LevelVersionError(getElementName(), level, version); - } */ - initDefaults(); - } - - /** - * Clone constructor - */ - public ExtendedRenderModel(ExtendedRenderModel obj) { - super(); - versionMajor = obj.versionMajor; - versionMinor = obj.versionMinor; - listOfGlobalRenderInformation = obj.listOfGlobalRenderInformation; - listOfLocalRenderInformation = obj.listOfLocalRenderInformation; - } - - /** - * clones this class - */ - @Override - public ExtendedRenderModel clone() { - return new ExtendedRenderModel(this); - } - - /** - * Initializes the default values using the namespace. - */ - public void initDefaults() { - //addNamespace(RenderConstants.namespaceURI); - versionMajor = 0; - versionMinor = 0; - } - - /** - * @return the value of versionMinor - */ - public int getVersionMinor() { - return versionMinor; - } - /** - * @return whether versionMinor is set - */ - public boolean isSetVersionMinor() { - return true; - } - - /** - * Set the value of versionMinor - */ - public void setVersionMinor(int versionMinor) { -// int oldVersionMinor = this.versionMinor; - this.versionMinor = versionMinor; - // FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); - } - - /** - * Unsets the variable versionMinor - * @return <code>true</code>, if versionMinor was set before, - * otherwise <code>false</code> - */ - public boolean unsetVersionMinor() { - if (isSetVersionMinor()) { -// int oldVersionMinor = this.versionMinor; - //FIXME firePropertyChange(RenderConstants.versionMinor, oldVersionMinor, this.versionMinor); - return true; - } - return false; - } - - - /** - * @return the value of versionMajor - */ - public int getVersionMajor() { - return versionMajor; - } - - /** - * @return whether versionMajor is set - */ - public boolean isSetVersionMajor() { - return true; - } - - /** - * Set the value of versionMajor - */ - public void setVersionMajor(int versionMajor) { -// int oldVersionMajor = this.versionMajor; - this.versionMajor = versionMajor; - //firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); - } - - /** - * Unsets the variable versionMajor - * @return <code>true</code>, if versionMajor was set before, - * otherwise <code>false</code> - */ - public boolean unsetVersionMajor() { - if (isSetVersionMajor()) { -// int oldVersionMajor = this.versionMajor; - //firePropertyChange(RenderConstants.versionMajor, oldVersionMajor, this.versionMajor); - return true; - } - return false; - } - - - /** - * @return <code>true</code>, if listOfGlobalRenderInformation contains at least one element, - * otherwise <code>false</code> - */ - public boolean isSetListOfGlobalRenderInformation() { - if ((listOfGlobalRenderInformation == null) || listOfGlobalRenderInformation.isEmpty()) { - return false; - } - return true; - } - - /** - * @return the listOfGlobalRenderInformation - */ - public ListOf<GlobalRenderInformation> getListOfGlobalRenderInformation() { - if (!isSetListOfGlobalRenderInformation()) { - listOfGlobalRenderInformation = new ListOf<GlobalRenderInformation>(); - listOfGlobalRenderInformation.addNamespace(RenderConstants.namespaceURI); - listOfGlobalRenderInformation.setSBaseListType(ListOf.Type.other); - //FIXME registerChild(listOfGlobalRenderInformation); - } - return listOfGlobalRenderInformation; - } - - /** - * @param listOfGlobalRenderInformation - */ - public void setListOfGlobalRenderInformation(ListOf<GlobalRenderInformation> listOfGlobalRenderInformation) { - unsetListOfGlobalRenderInformation(); - this.listOfGlobalRenderInformation = listOfGlobalRenderInformation; - //FIXME registerChild(this.listOfGlobalRenderInformation); - } - - /** - * @return <code>true</code>, if listOfGlobalRenderInformation contained at least one element, - * otherwise <code>false</code> - */ - public boolean unsetListOfGlobalRenderInformation() { - if (isSetListOfGlobalRenderInformation()) { - ListOf<GlobalRenderInformation> oldGlobalRenderInformation = this.listOfGlobalRenderInformation; - this.listOfGlobalRenderInformation = null; - oldGlobalRenderInformation.fireNodeRemovedEvent(); - return true; - } - return false; - } - - /** - * @param globalRenderInformation - */ - public boolean addGlobalRenderInformation(GlobalRenderInformation globalRenderInformation) { - return getListOfGlobalRenderInformation().add(globalRenderInformation); - } - - /** - * @param globalRenderInformation - */ - public boolean removeGlobalRenderInformation(GlobalRenderInformation globalRenderInformation) { - if (isSetListOfGlobalRenderInformation()) { - return getListOfGlobalRenderInformation().remove(globalRenderInformation); - } - return false; - } - - /** - * @param i - */ - public void removeGlobalRenderInformation(int i) { - if (!isSetListOfGlobalRenderInformation()) { - throw new IndexOutOfBoundsException(Integer.toString(i)); - } - getListOfGlobalRenderInformation().remove(i); - } - - /** - * - * @param id - */ - public void removeGlobalRenderInformation(String id) { - getListOfGlobalRenderInformation().removeFirst(new NameFilter(id)); - } - - /** - * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list - * <p><b>NOTE:</b> - * only use this method, if ID is not mandatory in GlobalRenderInformation - * otherwise use @see createGlobalRenderInformation(String id)!</p> - */ - public GlobalRenderInformation createGlobalRenderInformation() { - return createGlobalRenderInformation(null); - } - - /** - * create a new GlobalRenderInformation element and adds it to the ListOfGlobalRenderInformation list - */ - public GlobalRenderInformation createGlobalRenderInformation(String id) { - GlobalRenderInformation globalRenderInformation = new GlobalRenderInformation(id); - addGlobalRenderInformation(globalRenderInformation); - return globalRenderInformation; - } - - /** - * @return <code>true</code>, if listOfLocalRenderInformation contains at least one element, - * otherwise <code>false</code> - */ - public boolean isSetListOfLocalRenderInformation() { - if ((listOfLocalRenderInformation == null) || listOfLocalRenderInformation.isEmpty()) { - return false; - } - return true; - } - - /** - * @return the listOfLocalRenderInformation - */ - public ListOf<LocalRenderInformation> getListOfLocalRenderInformation() { - if (!isSetListOfLocalRenderInformation()) { - listOfLocalRenderInformation = new ListOf<LocalRenderInformation>(); - listOfLocalRenderInformation.addNamespace(RenderConstants.namespaceURI); - listOfLocalRenderInformation.setSBaseListType(ListOf.Type.other); - //FIXME registerChild(listOfLocalRenderInformation); - } - return listOfLocalRenderInformation; - } - - /** - * @param listOfLocalRenderInformation - */ - public void setListOfLocalRenderInformation(ListOf<LocalRenderInformation> listOfLocalRenderInformation) { - unsetListOfLocalRenderInformation(); - this.listOfLocalRenderInformation = listOfLocalRenderInformation; - // FIXME registerChild(this.listOfLocalRenderInformation); - } - - /** - * @return <code>true</code>, if listOfLocalRenderInformation contained at least one element, - * otherwise <code>false</code> - */ - public boolean unsetListOfLocalRenderInformation() { - if (isSetListOfLocalRenderInformation()) { - ListOf<LocalRenderInformation> oldLocalRenderInformation = this.listOfLocalRenderInformation; - this.listOfLocalRenderInformation = null; - oldLocalRenderInformation.fireNodeRemovedEvent(); - return true; - } - return false; - } - - /** - * @param localRenderInformation - */ - public boolean addLocalRenderInformation(LocalRenderInformation localRenderInformation) { - return getListOfLocalRenderInformation().add(localRenderInformation); - } - - /** - * @param localRenderInformation - */ - public boolean removeLocalRenderInformation(LocalRenderInformation localRenderInformation) { - if (isSetListOfLocalRenderInformation()) { - return getListOfLocalRenderInformation().remove(localRenderInformation); - } - return false; - } - - /** - * @param i - */ - public void removeLocalRenderInformation(int i) { - if (!isSetListOfLocalRenderInformation()) { - throw new IndexOutOfBoundsException(Integer.toString(i)); - } - getListOfLocalRenderInformation().remove(i); - } - - /** - * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list - * <p><b>NOTE:</b> - * only use this method, if ID is not mandatory in LocalRenderInformation - * otherwise use @see createLocalRenderInformation(String id)!</p> - */ - public LocalRenderInformation createLocalRenderInformation() { - return createLocalRenderInformation(null); - } - - /** - * create a new LocalRenderInformation element and adds it to the ListOfLocalRenderInformation list - */ - public LocalRenderInformation createLocalRenderInformation(String id) { - LocalRenderInformation localRenderInformation = new LocalRenderInformation(id); - addLocalRenderInformation(localRenderInformation); - return localRenderInformation; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getAllowsChildren() - */ - //@Override - public boolean getAllowsChildren() { - return true; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getChildCount() - */ - //@Override - public int getChildCount() { - int count = 0; - - if (isSetListOfGlobalRenderInformation()) { - count++; - } - if (isSetListOfLocalRenderInformation()) { - count++; - } - - return count; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getChildAt(int) - */ - //@Override - public SBase getChildAt(int childIndex) { - if (childIndex < 0) { - throw new IndexOutOfBoundsException(childIndex + " < 0"); - } - - int pos = 0; - if (isSetListOfGlobalRenderInformation()) { - if (pos == childIndex) { - return getListOfLocalRenderInformation(); - } - pos++; - } - if (isSetListOfLocalRenderInformation()) { - if (pos == childIndex) { - return getListOfLocalRenderInformation(); - } - pos++; - } - - throw new IndexOutOfBoundsException(MessageFormat.format( - "Index {0,number,integer} >= {1,number,integer}", childIndex, - +Math.min(pos, 0))); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#readAttribute(java.lang.String, java.lang.String, java.lang.String) - */ - //@Override - public boolean readAttribute(String attributeName, String prefix, - String value) { - return false; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#writeXMLAttributes() - */ - //@Override - public Map<String, String> writeXMLAttributes() { - return null; - } - -} Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -45,7 +45,7 @@ * Creates an RenderLayoutPlugin instance */ public RenderLayoutPlugin(Layout layout) { - super(); + super(layout); initDefaults(); } Modified: trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderModelPlugin.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -50,7 +50,7 @@ * Creates an RenderModelPlugin instance */ public RenderModelPlugin(ListOf<Layout> listOfLayouts) { - super(); + super(listOfLayouts); initDefaults(); } Modified: trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-06-12 06:21:26 UTC (rev 1301) +++ trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -20,9 +20,25 @@ */ package org.sbml.jsbml.xml.parsers; +import java.util.ArrayList; +import java.util.Enumeration; import java.util.List; +import javax.swing.tree.TreeNode; + +import org.apache.log4j.Logger; +import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.ListOf.Type; +import org.sbml.jsbml.Model; import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.ext.SBasePlugin; +import org.sbml.jsbml.ext.layout.Layout; +import org.sbml.jsbml.ext.qual.FunctionTerm; +import org.sbml.jsbml.ext.qual.QualConstant; +import org.sbml.jsbml.ext.qual.QualitativeModel; +import org.sbml.jsbml.ext.render.RenderConstants; +import org.sbml.jsbml.ext.render.RenderLayoutPlugin; +import org.sbml.jsbml.ext.render.RenderModelPlugin; import org.sbml.jsbml.xml.stax.SBMLObjectForXML; @@ -35,104 +51,108 @@ * @since 1.0 * @date 04.06.2012 */ -public class RenderParser implements ReadingParser, WritingParser { - - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.WritingParser#getListOfSBMLElementsToWrite(java.lang.Object) +public class RenderParser extends AbstractReaderWriter { + + /** + * The logger for this RenderParser */ - public List<Object> getListOfSBMLElementsToWrite(Object objectToWrite) { - // TODO Auto-generated method stub - return null; - } + private Logger logger = Logger.getLogger(RenderParser.class); - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeAttributes(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) + * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#getListOfSBMLElementsToWrite(java.lang.Object) */ - public void writeAttributes(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) { - // TODO Auto-generated method stub - } + @Override + public ArrayList<Object> getListOfSBMLElementsToWrite(Object sbase) { + if (logger.isDebugEnabled()) { + logger.debug("getListOfSBMLElementsToWrite : " + sbase.getClass().getCanonicalName()); + } + + ArrayList<Object> listOfElementsToWrite = new ArrayList<Object>(); - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeCharacters(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) - */ - public void writeCharacters(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) { - // TODO Auto-generated method stub - } + if (sbase instanceof SBMLDocument) { + // nothing to do + // TODO : the 'required' attribute is written even if there is no plugin class for the SBMLDocument, so I am not totally sure how this is done. + } + else if (sbase instanceof ListOf<?>) { + // if the sbase is a ListOf, we could have a RenderModelPlugin attached to it + ListOf<?> listOf = (ListOf<?>)sbase; + if (listOf.getSBaseListType() == Type.other) { + + SBasePlugin plugin = listOf.getExtension(RenderConstants.namespaceURI); + + if (plugin != null) { + RenderModelPlugin rmp = (RenderModelPlugin) plugin; + // then add its extension children to the list of elements to write + Enumeration<TreeNode> children = rmp.children(); + while (children.hasMoreElements()) { + listOfElementsToWrite.add(children.nextElement()); + } + } + } + } + else if (sbase instanceof Layout) { + // if the sbase is a Layout get its extension + RenderLayoutPlugin rlp = (RenderLayoutPlugin)((Layout)sbase).getExtension(RenderConstants.namespaceURI); + + // then add its extension children to the list of elements to write + Enumeration<TreeNode> children = rlp.children(); + while (children.hasMoreElements()) { + listOfElementsToWrite.add(children.nextElement()); + } + } + else if (sbase instanceof TreeNode) { + Enumeration<TreeNode> children = ((TreeNode) sbase).children(); + + while (children.hasMoreElements()) { + listOfElementsToWrite.add(children.nextElement()); + } + } + + if (listOfElementsToWrite.isEmpty()) { + listOfElementsToWrite = null; + } else if (logger.isDebugEnabled()) { + logger.debug("getListOfSBMLElementsToWrite size = " + listOfElementsToWrite.size()); + } - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeElement(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) - */ - public void writeElement(SBMLObjectForXML xmlObject, Object sbmlElementToWrite) { - // TODO Auto-generated method stub + return listOfElementsToWrite; } - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeNamespaces(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) + * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#processStartElement(java.lang.String, java.lang.String, boolean, boolean, java.lang.Object) */ - public void writeNamespaces(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) { + @Override + public Object processStartElement(String elementName, String prefix, + boolean hasAttributes, boolean hasNamespaces, Object contextObject) { // TODO Auto-generated method stub + return null; } - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processAttribute(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, java.lang.Object) + * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#processEndElement(java.lang.String, java.lang.String, boolean, java.lang.Object) */ - public void processAttribute(String elementName, String attributeName, - String value, String prefix, boolean isLastAttribute, Object contextObject) { - // TODO Auto-generated method stub - } - - - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processCharactersOf(java.lang.String, java.lang.String, java.lang.Object) - */ - public void processCharactersOf(String elementName, String characters, - Object contextObject) { - // TODO Auto-generated method stub - } - - - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndDocument(org.sbml.jsbml.SBMLDocument) - */ - public void processEndDocument(SBMLDocument sbmlDocument) { - // TODO Auto-generated method stub - } - - - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndElement(java.lang.String, java.lang.String, boolean, java.lang.Object) - */ + @Override public boolean processEndElement(String elementName, String prefix, boolean isNested, Object contextObject) { // TODO Auto-generated method stub - return false; + return super.processEndElement(elementName, prefix, isNested, contextObject); } - - + /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processNamespace(java.lang.String, java.lang.String, java.lang.String, java.lang.String, boolean, boolean, java.lang.Object) + * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#getShortLabel() */ - public void processNamespace(String elementName, String URI, String prefix, - String localName, boolean hasAttributes, boolean isLastNamespace, - Object contextObject) { - // TODO Auto-generated method stub + @Override + public String getShortLabel() { + return RenderConstants.shortLabel; } - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processStartElement(java.lang.String, java.lang.String, boolean, boolean, java.lang.Object) + * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#getNamespaceURI() */ - public Object processStartElement(String elementName, String prefix, - boolean hasAttributes, boolean hasNamespaces, Object contextObject) { - // TODO Auto-generated method stub - return null; + @Override + public String getNamespaceURI() { + return RenderConstants.namespaceURI; } + } Added: trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java =================================================================== --- trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java (rev 0) +++ trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java 2012-06-12 09:40:18 UTC (rev 1302) @@ -0,0 +1,61 @@ +/* + * $Id$ + * $URL$ + * + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2011 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.render; + +import javax.xml.stream.XMLStreamException; + +import org.sbml.jsbml.Model; +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.SBMLException; +import org.sbml.jsbml.SBMLWriter; +import org.sbml.jsbml.ext.layout.ExtendedLayoutModel; +import org.sbml.jsbml.ext.layout.Layout; +import org.sbml.jsbml.ext.layout.LayoutConstants; + + +/** + * @author Florian Mittag + * @author Andreas Dräger + * @version $Rev$ + * @since 0.8 + * @date 12.06.2012 + */ +public class RenderWriteTest { + + /** + * @param args + * @throws XMLStreamException + * @throws SBMLException + */ + public static void main(String[] args) throws SBMLException, XMLStreamException { + SBMLDocument doc = new SBMLDocument(3, 1); + Model m = doc.createModel("m1"); + ExtendedLayoutModel elm = new ExtendedLayoutModel(m); + m.addExtension(LayoutConstants.getNamespaceURI(m.getLevel(), m.getVersion()), elm); + Layout l1 = elm.createLayout("l1"); + + RenderLayoutPlugin rlp = new RenderLayoutPlugin(l1); + rlp.createLocalRenderInformation("info1"); + l1.addExtension(RenderConstants.namespaceURI, rlp); + + SBMLWriter.write(doc, System.out, ' ', (short) 2); + } +} Property changes on: trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:keywords + Rev Id URL date tags This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2012-06-12 16:01:27
|
Revision: 1305 http://jsbml.svn.sourceforge.net/jsbml/?rev=1305&view=rev Author: niko-rodrigue Date: 2012-06-12 16:01:16 +0000 (Tue, 12 Jun 2012) Log Message: ----------- corrected AbstractSBase.addExtension to not add the extension namespace to the list of namespaces and stax/SBMLWriter to use the namespaces from the extensions Map instead of the SBase list of namespaces (which should a single namespace in fact) + cleaned a bit the RenderParser Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-06-12 13:15:01 UTC (rev 1304) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-06-12 16:01:16 UTC (rev 1305) @@ -280,7 +280,6 @@ */ public void addExtension(String namespace, SBasePlugin sbase) { this.extensions.put(namespace, sbase); - addNamespace(namespace); firePropertyChange(TreeNodeChangeEvent.addExtension, null, sbase); } Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java 2012-06-12 13:15:01 UTC (rev 1304) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java 2012-06-12 16:01:16 UTC (rev 1305) @@ -175,6 +175,9 @@ listOfElementsToWrite.add(children.nextElement()); } + logger.debug("getListOfSBMLElementsToWrite : nb children = " + listOfElementsToWrite.size()); + logger.debug("getListOfSBMLElementsToWrite : children = " + listOfElementsToWrite); + if (listOfElementsToWrite.isEmpty()) { listOfElementsToWrite = null; } @@ -223,6 +226,14 @@ if (sbmlElementToWrite instanceof SBase) { SBase sbase = (SBase) sbmlElementToWrite; + logger.debug("writeElement : sbase.namespaces size = " + sbase.getNamespaces().size()); + logger.debug("writeElement : sbase.namespaces = " + sbase.getNamespaces()); + + if (!sbase.getNamespaces().contains(getNamespaceURI())) { + logger.debug("writeElement : rejected element"); + return; + } + if (!xmlObject.isSetName()) { if (sbase instanceof ListOf<?>) { ListOf<?> listOf = (ListOf<?>) sbase; Modified: trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java 2012-06-12 13:15:01 UTC (rev 1304) +++ trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java 2012-06-12 16:01:16 UTC (rev 1305) @@ -290,7 +290,7 @@ if (object instanceof SBase) { SBase sbase = (SBase) object; - packageNamespaces = sbase.getNamespaces(); + packageNamespaces = sbase.getExtensionPackages().keySet(); } else if (object instanceof Annotation) { Annotation annotation = (Annotation) object; packageNamespaces = annotation.getNamespaces(); Modified: trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-06-12 13:15:01 UTC (rev 1304) +++ trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-06-12 16:01:16 UTC (rev 1305) @@ -58,67 +58,7 @@ */ private Logger logger = Logger.getLogger(RenderParser.class); - /* (non-Javadoc) - * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#getListOfSBMLElementsToWrite(java.lang.Object) - */ - @Override - public ArrayList<Object> getListOfSBMLElementsToWrite(Object sbase) { - if (logger.isDebugEnabled()) { - logger.debug("getListOfSBMLElementsToWrite : " + sbase.getClass().getCanonicalName()); - } - - ArrayList<Object> listOfElementsToWrite = new ArrayList<Object>(); - - if (sbase instanceof SBMLDocument) { - // nothing to do - // TODO : the 'required' attribute is written even if there is no plugin class for the SBMLDocument, so I am not totally sure how this is done. - } - else if (sbase instanceof ListOf<?>) { - // if the sbase is a ListOf, we could have a RenderModelPlugin attached to it - ListOf<?> listOf = (ListOf<?>)sbase; - if (listOf.getSBaseListType() == Type.other) { - - SBasePlugin plugin = listOf.getExtension(RenderConstants.namespaceURI); - - if (plugin != null) { - RenderModelPlugin rmp = (RenderModelPlugin) plugin; - - // then add its extension children to the list of elements to write - Enumeration<TreeNode> children = rmp.children(); - while (children.hasMoreElements()) { - listOfElementsToWrite.add(children.nextElement()); - } - } - } - } - else if (sbase instanceof Layout) { - // if the sbase is a Layout get its extension - RenderLayoutPlugin rlp = (RenderLayoutPlugin)((Layout)sbase).getExtension(RenderConstants.namespaceURI); - - // then add its extension children to the list of elements to write - Enumeration<TreeNode> children = rlp.children(); - while (children.hasMoreElements()) { - listOfElementsToWrite.add(children.nextElement()); - } - } - else if (sbase instanceof TreeNode) { - Enumeration<TreeNode> children = ((TreeNode) sbase).children(); - - while (children.hasMoreElements()) { - listOfElementsToWrite.add(children.nextElement()); - } - } - - if (listOfElementsToWrite.isEmpty()) { - listOfElementsToWrite = null; - } else if (logger.isDebugEnabled()) { - logger.debug("getListOfSBMLElementsToWrite size = " + listOfElementsToWrite.size()); - } - - return listOfElementsToWrite; - } - /* (non-Javadoc) * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#processStartElement(java.lang.String, java.lang.String, boolean, boolean, java.lang.Object) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-14 07:07:39
|
Revision: 1307 http://jsbml.svn.sourceforge.net/jsbml/?rev=1307&view=rev Author: andreas-draeger Date: 2012-06-14 07:07:30 +0000 (Thu, 14 Jun 2012) Log Message: ----------- Corrected a typo in a method's name. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java Modified: trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java 2012-06-14 07:07:16 UTC (rev 1306) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeRemovedEvent.java 2012-06-14 07:07:30 UTC (rev 1307) @@ -39,7 +39,7 @@ * {@link TreeNodeChangeListener} wants to, e.g., undo this change, * it is necessary to identify the previous position of the node within the * tree. That's why this class has two important - * methods, namely {@link #getSource()} and {@link #getPreviosParent()}. + * methods, namely {@link #getSource()} and {@link #getPreviousParent()}. * * @author Andreas Dräger * @version $Rev$ @@ -81,7 +81,7 @@ * @param treeNodeRemovedEvent */ public TreeNodeRemovedEvent(TreeNodeRemovedEvent treeNodeRemovedEvent) { - this(treeNodeRemovedEvent.getSource(), treeNodeRemovedEvent.getPreviosParent()); + this(treeNodeRemovedEvent.getSource(), treeNodeRemovedEvent.getPreviousParent()); } /* (non-Javadoc) @@ -99,7 +99,7 @@ * @return the previosParent * @see #getSource() */ - public TreeNode getPreviosParent() { + public TreeNode getPreviousParent() { return previosParent; } Modified: trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java =================================================================== --- trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java 2012-06-14 07:07:16 UTC (rev 1306) +++ trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginChangeListener.java 2012-06-14 07:07:30 UTC (rev 1307) @@ -1199,7 +1199,7 @@ //@Override public void nodeRemoved(TreeNodeRemovedEvent evt) { TreeNode node = evt.getSource(); - TreeNode parent = evt.getPreviosParent(); + TreeNode parent = evt.getPreviousParent(); if (node instanceof AbstractSBase) { if (node instanceof AbstractNamedSBase) { if (node instanceof CompartmentType) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-14 10:14:33
|
Revision: 1308 http://jsbml.svn.sourceforge.net/jsbml/?rev=1308&view=rev Author: andreas-draeger Date: 2012-06-14 10:14:23 +0000 (Thu, 14 Jun 2012) Log Message: ----------- Corrected an error in TreeNodeAdapter that was introduced when adding general userObjects to all SBML elements: By mistake a method that was already present in TreeNodeAdapter was overridden (isSetUserObjects). Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLObjectForXML.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java Modified: trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java 2012-06-14 07:07:30 UTC (rev 1307) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java 2012-06-14 10:14:23 UTC (rev 1308) @@ -107,6 +107,7 @@ /* (non-Javadoc) * @see org.sbml.jsbml.AbstractTreeNode#clone() */ + //@Override public TreeNode clone() { return new TreeNodeAdapter(this); } @@ -120,7 +121,7 @@ if (equals) { TreeNodeAdapter node = (TreeNodeAdapter) object; equals &= node.isUserObjectRecursiveDataType() == isUserObjectRecursiveDataType(); - if (equals && isSetUserObjects() && !isUserObjectRecursiveDataType()) { + if (equals && isSetUserObject() && !isUserObjectRecursiveDataType()) { equals &= node.getUserObject().equals(getUserObject()); } } @@ -130,8 +131,9 @@ /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getAllowsChildren() */ + //@Override public boolean getAllowsChildren() { - if (isSetUserObjects() && (userObject instanceof Collection<?>)) { + if (isSetUserObject() && (userObject instanceof Collection<?>)) { return true; } return false; @@ -140,11 +142,12 @@ /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getChildAt(int) */ + //@Override public TreeNode getChildAt(int childIndex) { if (childIndex < 0) { throw new IndexOutOfBoundsException(childIndex + " < 0"); } - if (isSetUserObjects()) { + if (isSetUserObject()) { if (userObject instanceof TreeNode) { return ((TreeNode) userObject).getChildAt(childIndex); } @@ -179,8 +182,9 @@ /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getChildCount() */ + //@Override public int getChildCount() { - if (isSetUserObjects()) { + if (isSetUserObject()) { if (userObject instanceof Collection<?>) { return ((Collection<?>) userObject).size(); } @@ -219,23 +223,23 @@ /** * @return */ - public boolean isSetUserObjects() { + public boolean isSetUserObject() { return userObject != null; } /** * Checks whether or not the user's object has been set (see - * {@link #isSetUserObjects()}) and if so if it belongs to those elements + * {@link #isSetUserObject()}) and if so if it belongs to those elements * returned by the method {@link #getChildAt(int)}. * * @return <code>true</code> if the user's object has been defined and * belongs to those classes that are returned by the method * {@link #getChildAt(int)}. * @see #getChildAt(int) - * @see #isSetUserObjects() + * @see #isSetUserObject() */ public boolean isUserObjectRecursiveDataType() { - return isSetUserObjects() + return isSetUserObject() && ((userObject instanceof Collection<?>) || (userObject instanceof Map<?, ?>) || (userObject instanceof TreeNode)); } @@ -253,7 +257,7 @@ */ @Override public String toString() { - if (isSetUserObjects()) { + if (isSetUserObject()) { if (userObject instanceof Collection<?>) { Collection<?> collection = (Collection<?>) userObject; if (ListOf.isDebugMode()) { @@ -262,11 +266,10 @@ if (collection.size() > 0) { String name = collection.iterator().next().getClass() .getSimpleName(); - if (!name.endsWith("s")) { - name += "s"; + if (!name.endsWith("s") && !name.toLowerCase().endsWith("information")) { + name += 's'; } - String type = collection instanceof List<?> ? "listOf" - : "collectionOf"; + String type = collection instanceof List<?> ? "listOf" : "collectionOf"; return type + name; } return collection.getClass().getSimpleName(); Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java 2012-06-14 07:07:30 UTC (rev 1307) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/AbstractReaderWriter.java 2012-06-14 10:14:23 UTC (rev 1308) @@ -240,8 +240,8 @@ if (listOf.size() > 0) { String listOfName = "listOf" + listOf.get(0).getClass().getSimpleName(); - if (!listOfName.endsWith("s")) { - listOfName += "s"; + if (!listOfName.endsWith("s") && !listOfName.toLowerCase().endsWith("information")) { + listOfName += 's'; } xmlObject.setName(listOfName); } Modified: trunk/core/src/org/sbml/jsbml/xml/stax/SBMLObjectForXML.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/SBMLObjectForXML.java 2012-06-14 07:07:30 UTC (rev 1307) +++ trunk/core/src/org/sbml/jsbml/xml/stax/SBMLObjectForXML.java 2012-06-14 10:14:23 UTC (rev 1308) @@ -185,8 +185,7 @@ this.prefix = prefix; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override Modified: trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java 2012-06-14 07:07:30 UTC (rev 1307) +++ trunk/core/src/org/sbml/jsbml/xml/stax/SBMLWriter.java 2012-06-14 10:14:23 UTC (rev 1308) @@ -30,6 +30,7 @@ import java.io.OutputStream; import java.io.StringReader; import java.io.StringWriter; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; @@ -72,6 +73,7 @@ import org.sbml.jsbml.SBMLException; import org.sbml.jsbml.SBase; import org.sbml.jsbml.UnitDefinition; +import org.sbml.jsbml.ext.SBasePlugin; import org.sbml.jsbml.util.JAXPFacade; import org.sbml.jsbml.util.StringTools; import org.sbml.jsbml.util.compilers.MathMLXMLStreamCompiler; @@ -121,7 +123,7 @@ if (args.length < 1) { System.out.println( - "Usage : java org.sbml.jsbml.xml.stax.SBMLWriter sbmlFileName"); + "Usage: java org.sbml.jsbml.xml.stax.SBMLWriter sbmlFileName"); System.exit(0); } @@ -167,8 +169,8 @@ } else { System.out.println("It took " + nbSecondes + " secondes."); } - System.out.println("Reading : " + nbSecondesRead + " secondes."); - System.out.println("Writing : " + nbSecondesWrite + " secondes."); + System.out.println("Reading: " + nbSecondesRead + " secondes."); + System.out.println("Writing: " + nbSecondesWrite + " secondes."); } /** @@ -286,7 +288,7 @@ Set<String> packageNamespaces = null; - // logger.debug("getInitializedParsers : name space, object = " + name space + ", " + object); + // logger.debug("getInitializedParsers: name space, object = " + name space + ", " + object); if (object instanceof SBase) { SBase sbase = (SBase) object; @@ -295,7 +297,7 @@ Annotation annotation = (Annotation) object; packageNamespaces = annotation.getNamespaces(); } else { - logger.warn("getInitializedParsers : I don't know what to do with " + object); + logger.warn("getInitializedParsers: I don't know what to do with " + object); } ArrayList<WritingParser> sbmlParsers = new ArrayList<WritingParser>(); @@ -380,8 +382,8 @@ */ public void setIndentationChar(char indentSymbol) { if ((indentSymbol != ' ') && (indentSymbol != '\t')) { - throw new IllegalArgumentException(String.format( - "Invalid argument '%s'. Only the blank symbols '\\t' and ' ' are allowed for indentation.", + throw new IllegalArgumentException(MessageFormat.format( + "Invalid argument \"{0}\". Only the blank symbols '\\t' and ' ' are allowed for indentation.", indentSymbol)); } this.indentChar = indentSymbol; @@ -401,8 +403,8 @@ */ public void setIndentationCount(short indentCount) { if (indentCount < 0) { - throw new IllegalArgumentException(String.format( - "Indent count must be non-negative. Invalid argument %d.", + throw new IllegalArgumentException(MessageFormat.format( + "Indent count must be non-negative. Invalid argument {0,number}.", indentCount)); } this.indentCount = indentCount; @@ -447,9 +449,9 @@ * Writes the SBMLDocument in a SBML file. * * @param sbmlDocument - * : the SBMLDocument to write + * the SBMLDocument to write * @param stream - * : a stream where to write the content of the model to. + * a stream where to write the content of the model to. * @throws XMLStreamException * @throws SBMLException * @throws IOException @@ -513,11 +515,10 @@ * which version of JSBML was used for this purpose. */ if ((programName != null) && (programName.length() > 0)) { - String date = String.format("%1$tY-%1$tm-%1$td %1$tR", Calendar - .getInstance().getTime()); - String msg = " Created by %s version %s on %s with jsbml version %s. "; + String date = String.format("%1$tY-%1$tm-%1$td %1$tR", Calendar.getInstance().getTime()); + String msg = " Created by {0} version {1} on {2} with JSBML version {3}. "; outputDocument.addComment( - String.format(msg, programName, (programVersion != null) + MessageFormat.format(msg, programName, (programVersion != null) && (programVersion.length() > 0) ? programVersion : "?", date, JSBML.getJSBMLDottedVersion())); outputDocument.addCharacters("\n"); @@ -542,14 +543,14 @@ Map.Entry<String, String> entry = it.next(); if (!entry.getKey().equals("xmlns")) { - logger.debug(" SBML name spaces : " + entry.getKey() + " = " + logger.debug(" SBML name spaces: " + entry.getKey() + " = " + entry.getValue()); String namespacePrefix = entry.getKey().substring( entry.getKey().indexOf(":") + 1); streamWriter.setPrefix(namespacePrefix, entry.getValue()); - logger.debug(" SBML namespaces : " + namespacePrefix + " = " + logger.debug(" SBML namespaces: " + namespacePrefix + " = " + entry.getValue()); } @@ -582,9 +583,9 @@ * Writes the XML representation of an {@link SBMLDocument} in a SBML file. * * @param sbmlDocument - * : the SBMLDocument to write + * the SBMLDocument to write * @param fileName - * : the name of the file where to write the {@link SBMLDocument} + * the name of the file where to write the {@link SBMLDocument} * * * @throws XMLStreamException @@ -666,13 +667,13 @@ * Writes the annotation of this sbase component. * * @param sbase - * : the sbase component + * the sbase component * @param element - * : the matching SMOutputElement + * the matching SMOutputElement * @param writer - * : the XMLStreamWriter2 + * the XMLStreamWriter2 * @param sbmlNamespace - * : the SBML namespace. + * the SBML namespace. * @param indent * the number of indent white spaces of this annotation. * @throws XMLStreamException @@ -737,7 +738,7 @@ // that is not yet linked to a SBMLDocument. allNamespacesDefined = false; } - // TODO : to be able to write broken annotations where the namespace declaration is missing + // TODO: to be able to write broken annotations where the namespace declaration is missing // we need to add dummy namespace here !! Or remove the namespace awareness on the writer !! StringTools.append(annotationBeginning, Character.valueOf('>'), @@ -758,7 +759,7 @@ domConversionDone = true; } catch (SAXException e) { e.printStackTrace(); - // TODO : log error or send SBMLException + // TODO: log error or send SBMLException logger.warn("Cannot parse the following XML\n@" + annotationString + "@"); logger.warn("NonRDFannotation =\n@" + annotation.getNonRDFannotation() + "@"); @@ -773,7 +774,7 @@ domConversionDone = true; } catch (SAXException e2) { e.printStackTrace(); - // TODO : log error or send SBMLException + // TODO: log error or send SBMLException } } } finally { @@ -805,8 +806,8 @@ * or the SBase is derived from a different SBase implementation, it * could fail. */ - logger.info(String.format( - "Could not write RDF annotation of %s due to missing metaid.", + logger.info(MessageFormat.format( + "Could not write RDF annotation of {0} due to missing metaid.", sbase.getElementName())); } } @@ -819,11 +820,11 @@ * Writes the listOfCVTerms. * * @param listOfCVTerms - * : the list of CVTerms to write + * the list of CVTerms to write * @param rdfNamespaces - * : the RDF name spaces and prefixes + * the RDF name spaces and prefixes * @param writer - * : the XMLStreamWriter2 + * the XMLStreamWriter2 * @param indent * @throws XMLStreamException */ @@ -902,11 +903,11 @@ * Writes the history represented by this History instance. * * @param history - * : the history to write + * the history to write * @param rdfNamespaces - * : contains the RDF namespaces and their prefixes. + * contains the RDF namespaces and their prefixes. * @param writer - * : the XMLStreamWriter2 + * the XMLStreamWriter2 * @param indent * @throws XMLStreamException */ @@ -1039,7 +1040,7 @@ // Writing the current modified dates. if (history.isSetModifiedDate()) { - for (int i = 0; i < history.getNumModifiedDates(); i++) { + for (int i = 0; i < history.getModifiedDateCount(); i++) { writeW3CDate(writer, indent, DateParser.getIsoDateNoMillis(history .getModifiedDate(i)), "modified", dctermPrefix, @@ -1057,11 +1058,11 @@ * component. * * @param m - * : the sbase component + * the sbase component * @param element - * : the matching SMOutputElement + * the matching SMOutputElement * @param writer - * : the XMLStreamWriter + * the XMLStreamWriter * @param indent * @throws XMLStreamException * @@ -1083,7 +1084,7 @@ writer, createIndentationString(indent + indentCount)); boolean isSBMLNamespaceNeeded = compiler.isSBMLNamespaceNeeded(m.getMath()); - // TODO : add all other namespaces !! + // TODO: add all other namespaces !! if (isSBMLNamespaceNeeded) { // writing the SBML namespace @@ -1096,7 +1097,7 @@ sbmlNamespace = doc.getSBMLDocumentNamespaces().get("xmlns"); if (sbmlNamespace == null) { - logger.warn("writeMathML : the SBML namespace of this SBMLDocument" + + logger.warn("writeMathML: the SBML namespace of this SBMLDocument" + " could not be found, using the default namespace (" + SBMLDocument.URI_NAMESPACE_L3V1Core + ") instead."); sbmlNamespace = SBMLDocument.URI_NAMESPACE_L3V1Core; @@ -1120,13 +1121,13 @@ * Writes the message of this Constraint. * * @param sbase - * : the Constraint component + * the Constraint component * @param element - * : the matching SMOUtputElement + * the matching SMOUtputElement * @param writer - * : the XMLStreamWriter2 + * the XMLStreamWriter2 * @param sbmlNamespace - * : the SBML namespace + * the SBML namespace * @throws XMLStreamException */ private void writeMessage(Constraint sbase, SMOutputElement element, @@ -1158,13 +1159,13 @@ * Writes the notes of this sbase component. * * @param sbase - * : the SBase component + * the SBase component * @param element - * : the matching SMOUtputElement + * the matching SMOUtputElement * @param writer - * : the XMLStreamWriter2 + * the XMLStreamWriter2 * @param sbmlNamespace - * : the SBML namespace + * the SBML namespace * @param indent * @throws XMLStreamException */ @@ -1181,11 +1182,11 @@ * Writes the RDF annotation contained in 'annotation'. * * @param annotation - * : the annotation to write + * the annotation to write * @param annotationElement - * : the matching SMOutputElement + * the matching SMOutputElement * @param writer - * : the XMLStreamWriter. + * the XMLStreamWriter. * @param indent * @throws XMLStreamException */ @@ -1217,7 +1218,7 @@ } // Checking if all the necessary namespaces are defined - // TODO : In fact, we could remove the rdfNamespaces map ? + // TODO: In fact, we could remove the rdfNamespaces map ? if (rdfNamespaces.get(Annotation.URI_RDF_SYNTAX_NS) == null || rdfNamespaces.get(Annotation.URI_RDF_SYNTAX_NS).equals("xmlns")) @@ -1286,21 +1287,21 @@ rdfElement.addCharacters(whiteSpace); annotationElement.addCharacters("\n"); } - + /** * Writes the SBML elements. * * @param parentXmlObject - * : contains the XML information of the parentElement. + * contains the XML information of the parentElement. * @param smOutputParentElement - * : SMOutputElement of the parentElement. + * SMOutputElement of the parentElement. * @param streamWriter * @param objectToWrite - * : the Object to write. + * the Object to write. * @param notesParser - * : the WritingParser to parse the notes. + * the WritingParser to parse the notes. * @param MathMLparser - * : the WritingParser to parse the MathML expressions. + * the WritingParser to parse the MathML expressions. * @param indent * The number of white spaces to indent this element. * @throws XMLStreamException @@ -1315,16 +1316,16 @@ String whiteSpaces = createIndentationString(indent); // Get the list of parsers to use. - ArrayList<WritingParser> listOfPackages = getWritingParsers( + List<WritingParser> listOfPackages = getWritingParsers( objectToWrite, smOutputParentElement.getNamespace().getURI()); if (logger.isDebugEnabled()) { - logger.debug("writeSBMLElements : xmlObject = " + parentXmlObject); - logger.debug("writeSBMLElements : parentElement = " + logger.debug("writeSBMLElements: xmlObject = " + parentXmlObject); + logger.debug("writeSBMLElements: parentElement = " + smOutputParentElement.getLocalName() + ", " + smOutputParentElement.getNamespace().getURI()); - logger.debug("writeSBMLElements : objectToWrite = " + objectToWrite + '\n'); - logger.debug("writeSBMLElements : listOfPackages = " + listOfPackages + '\n'); + logger.debug("writeSBMLElements: objectToWrite = " + objectToWrite + '\n'); + logger.debug("writeSBMLElements: listOfPackages = " + listOfPackages + '\n'); } Iterator<WritingParser> iterator = listOfPackages.iterator(); @@ -1334,12 +1335,12 @@ .getListOfSBMLElementsToWrite(objectToWrite); if (logger.isDebugEnabled()) { - logger.debug("writeSBMLElements : parser = " + parser); - logger.debug("writeSBMLElements : elementsToWrite = " + sbmlElementsToWrite); + logger.debug("writeSBMLElements: parser = " + parser); + logger.debug("writeSBMLElements: elementsToWrite = " + sbmlElementsToWrite); } if (sbmlElementsToWrite == null) { - // TODO : test if there are some characters to write ? + // TODO: test if there are some characters to write ? // to allow the XML parser to prune empty elements, this indent should not be added. // streamWriter.writeCharacters(whiteSpaces.substring(0, @@ -1388,8 +1389,8 @@ if (listType == Type.none) { // Prevent writing invalid SBML if list types are // not set appropriately. - throw new SBMLException(String.format( - "Unknown ListOf type \"%s\".", + throw new SBMLException(MessageFormat.format( + "Unknown ListOf type \"{0}\".", toTest.getElementName())); } if (listType.equals(ListOf.Type.listOfReactants) @@ -1416,7 +1417,7 @@ if (parentXmlObject.isSetName()) { boolean isClosedMathContainer = false, isClosedAnnotation = false; - // TODO : problem here as a children does not have the same namespace as his parent all the time !! + // TODO: problem here as a children does not have the same namespace as his parent all the time !! // use ((SBase) nextObjectToWrite).getNamespaces(); ?? if (parentXmlObject.isSetNamespace()) { @@ -1539,7 +1540,16 @@ return stream.toString(); } - + /** + * + * @param writer + * @param indent + * @param dateISO + * @param dcterm + * @param dctermPrefix + * @param rdfPrefix + * @throws XMLStreamException + */ private void writeW3CDate(XMLStreamWriter writer, int indent, String dateISO, String dcterm, String dctermPrefix, String rdfPrefix) throws XMLStreamException { @@ -1560,7 +1570,7 @@ writer.writeCharacters("\n"); } - // TODO : test a bit more Xstream and using Qname to see how it + // TODO: test a bit more Xstream and using Qname to see how it // can deal with math or rdf bloc } Modified: trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java =================================================================== --- trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java 2012-06-14 07:07:30 UTC (rev 1307) +++ trunk/extensions/render/test/org/sbml/jsbml/ext/render/RenderWriteTest.java 2012-06-14 10:14:23 UTC (rev 1308) @@ -51,7 +51,7 @@ ExtendedLayoutModel elm = new ExtendedLayoutModel(m); m.addExtension(LayoutConstants.getNamespaceURI(m.getLevel(), m.getVersion()), elm); Layout l1 = elm.createLayout("l1"); - + l1.createCompartmentGlyph("test"); RenderLayoutPlugin rlp = new RenderLayoutPlugin(l1); rlp.createLocalRenderInformation("info1"); l1.addExtension(RenderConstants.namespaceURI, rlp); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-06-15 06:51:50
|
Revision: 1313 http://jsbml.svn.sourceforge.net/jsbml/?rev=1313&view=rev Author: andreas-draeger Date: 2012-06-15 06:51:44 +0000 (Fri, 15 Jun 2012) Log Message: ----------- Added convenient methods in Layout again but this time with respect to interaction with multiple other packages, i.e., convenient methods do not return core elements such as species, but more general NamedSBases. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/SBMLDocument.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/LibSBMLChangeListener.java Modified: trunk/core/src/org/sbml/jsbml/SBMLDocument.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -194,8 +194,8 @@ * @param URI */ public void addNamespace(String namespaceName, String prefix, String URI) { - if (prefix != null && prefix.trim().length() > 0) { - this.SBMLDocumentNamespaces.put(prefix + ":" + namespaceName, URI); + if ((prefix != null) && (prefix.trim().length() > 0)) { + this.SBMLDocumentNamespaces.put(prefix + ':' + namespaceName, URI); } else { this.SBMLDocumentNamespaces.put(namespaceName, URI); @@ -739,7 +739,7 @@ setVersion(StringTools.parseSBMLInt(value)); } if (prefix != null && prefix.trim().length() > 0) { - getSBMLDocumentAttributes().put(prefix + ":" + attributeName, value); + getSBMLDocumentAttributes().put(prefix + ':' + attributeName, value); } else { getSBMLDocumentAttributes().put(attributeName, value); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CompartmentGlyph.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -22,6 +22,7 @@ import java.util.Map; import org.sbml.jsbml.Compartment; +import org.sbml.jsbml.NamedSBase; import org.sbml.jsbml.util.TreeNodeChangeEvent; /** @@ -94,6 +95,16 @@ public String getCompartment() { return getNamedSBase(); } + + /** + * Note that the return type of this method is {@link NamedSBase} because it + * could be possible to link some element from other packages to this glyph. + * + * @return + */ + public NamedSBase getCompartmentInstance() { + return getNamedSBaseInstance(); + } /** * @return Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -25,6 +25,7 @@ import javax.swing.tree.TreeNode; import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.NamedSBase; import org.sbml.jsbml.Reaction; /** @@ -214,8 +215,18 @@ } /** + * Note that the return type of this method is {@link NamedSBase} because it + * could be possible to link some element from other packages to this glyph. + * * @return */ + public NamedSBase getReactionInstance() { + return getNamedSBaseInstance(); + } + + /** + * @return + */ public boolean isSetCurve() { return curve != null; } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesGlyph.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -21,6 +21,7 @@ import java.util.Map; +import org.sbml.jsbml.NamedSBase; import org.sbml.jsbml.Species; import org.sbml.jsbml.util.TreeNodeChangeEvent; @@ -95,6 +96,16 @@ public String getSpecies() { return getNamedSBase(); } + + /** + * Note that the return type of this method is {@link NamedSBase} because it + * could be possible to link some element from other packages to this glyph. + * + * @return + */ + public NamedSBase getSpeciesInstance() { + return getNamedSBaseInstance(); + } /** * @return the {@link #speciesId} Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -23,6 +23,8 @@ import javax.swing.tree.TreeNode; +import org.sbml.jsbml.Model; +import org.sbml.jsbml.NamedSBase; import org.sbml.jsbml.SBMLException; import org.sbml.jsbml.SimpleSpeciesReference; @@ -186,6 +188,18 @@ public String getSpeciesGlyph() { return speciesGlyph; } + + /** + * + * @return + */ + public SpeciesGlyph getSpeciesGlyphInstance() { + if (!isSetSpeciesGlyph()) { + return null; + } + Model model = getModel(); + return (model != null) ? (SpeciesGlyph) model.findNamedSBase(getSpeciesGlyph()) : null; + } /** * @@ -194,6 +208,16 @@ public String getSpeciesReference() { return getNamedSBase(); } + + /** + * Note that the return type of this method is {@link NamedSBase} because it + * could be possible to link some element from other packages to this glyph. + * + * @return + */ + public NamedSBase getSpeciesReferenceInstance() { + return getNamedSBaseInstance(); + } /** * @return Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -153,6 +153,14 @@ * * @return */ + public NamedSBase getOriginOfTextInstance() { + return getNamedSBaseInstance(); + } + + /** + * + * @return + */ public String getText() { return text; } Modified: trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/LibSBMLChangeListener.java =================================================================== --- trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/LibSBMLChangeListener.java 2012-06-14 16:27:15 UTC (rev 1312) +++ trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/LibSBMLChangeListener.java 2012-06-15 06:51:44 UTC (rev 1313) @@ -630,7 +630,7 @@ libDoc.delete(); } else if (node instanceof ListOf<?>) { // make recursion and remove all elements in the list - for(Object o : (ListOf<?>)node ) { + for (Object o : (ListOf<?>) node) { TreeNode newNode = new DefaultMutableTreeNode(o); nodeRemoved(new TreeNodeRemovedEvent(newNode, node)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mh...@us...> - 2012-06-28 21:15:47
|
Revision: 1327 http://jsbml.svn.sourceforge.net/jsbml/?rev=1327&view=rev Author: mhucka Date: 2012-06-28 21:15:39 +0000 (Thu, 28 Jun 2012) Log Message: ----------- Per discussions from April, moved these general information files to the trunk. Added Paths: ----------- trunk/AUTHORS.txt trunk/LICENSE.txt trunk/NEWS.txt Removed Paths: ------------- trunk/core/AUTHORS.txt trunk/core/LICENSE.txt trunk/core/NEWS.txt Copied: trunk/AUTHORS.txt (from rev 1206, trunk/core/AUTHORS.txt) =================================================================== --- trunk/AUTHORS.txt (rev 0) +++ trunk/AUTHORS.txt 2012-06-28 21:15:39 UTC (rev 1327) @@ -0,0 +1,27 @@ + ------------- + JSBML Authors + ------------- + + -- Core developers -- + + Andreas Draeger, University of Tuebingen, Germany + Nicolas Rodriguez, European Bioinformatics Institute, UK + + + -- Contributors -- + + Meike Aichele, University of Tuebingen, Germany + Finja Buechel, University of Tuebingen, Germany + Alexander Doerr, University of Tuebingen, Germany + Sebastian Froehlich, IKP Gatersleben, Germany + Michael Hucka, California Institute of Technology, USA + Florian Mittag, University of Tuebingen, Germany + Alexander Peltzer, University of Tuebingen, Germany + Clemens Wrzodek, University of Tuebingen, Germany + + -- Alumni -- + + Marine Dumousseau, European Bioinformatics Institute, UK + Sarah Rachel Mueller vom Hagen, University of Tuebingen, Germany + Simon Schaefer, University of Tuebingen, Germany + \ No newline at end of file Copied: trunk/LICENSE.txt (from rev 1326, trunk/core/LICENSE.txt) =================================================================== --- trunk/LICENSE.txt (rev 0) +++ trunk/LICENSE.txt 2012-06-28 21:15:39 UTC (rev 1327) @@ -0,0 +1,119 @@ + Licensing and Distribution Terms for JSBML + +Copyright (C) 2009-2012 jointly by the following organizations: + 1. The University of Tuebingen, Germany + 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK + 3. The California Institute of Technology, Pasadena, CA, USA + +JSBML is free software; you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as +published by the Free Software Foundation; either version 2.1 +of the License, or any later version. + +This software is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF +MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software +and documentation provided hereunder is on an "as is" basis, and +the copyright holders have no obligations to provide maintenance, +support, updates, enhancements or modifications. In no event +shall the copyright holders be liable to any party for direct, +indirect, special, incidental or consequential damages, including +lost profits, arising out of the use of this software and its +documentation, even if the copyright holders have been advised of +the possibility of such damage. See the GNU Lesser General Public +License for more details. + +You should have received a copy of the GNU Lesser General +Public License along with this library in the file named +"COPYING.txt" included with the software distribution. A copy +is also available online at the Internet address +http://sbml.org/Software/JSBML/licenses/COPYING.html for your +convenience. You may also write to obtain a copy from the Free +Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, +MA 02111-1307 USA. + + + Third-party software incorporated into + the JSBML distribution + +JSBML uses the following third-party software libraries; these +are distributed along with JSBML and placed in the source code +repository. The license statements for these third-party +software libraries can be found at the web addresses noted +below. For your convenience, copies of the license files are +also included in the JSBML subdirectory licenses/lib-licenses/. + +1. BioJava -- http://biojava.org + [checked 2010-12-16] + Copyright (C) held jointly by the individual BioJava authors. + Distributed under the LGPL version 2.1. + +2. Jigsaw -- http://www.w3.org/Jigsaw/ + [checked 2010-12-16] + Copyright (C) W3C. + Distributed under the W3C license. + +3. StAX -- http://stax.codehaus.org/Home + [checked 2010-12-16] + No clear copyright found. + Distributed under the Apache License 2.0. + +4. StAX2 -- http://docs.codehaus.org/display/WSTX/StAX2 + [checked 2010-12-16] + No clear copyright found. + Distributed under the Apache License 2.0. + +5. StaxMate -- http://staxmate.codehaus.org/ + [checked 2010-12-16] + Copyright (c) 2007, Tatu Saloranta. + Distributed under the BSD License. + +6. Woodstox -- http://woodstox.codehaus.org/ + [checked 2010-12-16] + No clear copyright found. + Distributed under the Apache License 2.0. + +7. XStream -- http://xstream.codehaus.org/ + [checked 2010-12-16] + Copyright (c) 2003-2006, Joe Walnes + Copyright (c) 2006-2007, XStream Committers + Distributed under a custom open-source license. + +8. log4j -- http://logging.apache.org/log4j/1.2/ + [checked 2010-12-16] + Copyright (C) Apache Software Foundation + Distributed under the Apache License 2.0. + + + Additional third-party software incorporated into + JSBML example applications + +The example applications provided with JSBML also include the +following additional third-party software libraries; these are +distributed along with JSBML and placed in the examples/ code +repository. The license statements for these third-party software +libraries can be found at the web addresses noted below. For your +convenience, copies of the license files are also included in the +JSBML subdirectory licenses/lib-licenses/. + +9. JFreeChart 1.0.14 and JCommon 1.0.17 + [checked 2012-03-31] + Copyright (C) 2000-2011, by Object Refinery Limited and Contributors + Distributed under the LGPL version 2.1. + +10. Swing-Layout 1.0.3 + [checked 2012-03-31] + Copyright (C) 2005-2006 Sun Microsystems, Inc. + Distributed under the LGPL 2.1. + +11. GNU getopt Java port + [checked 2012-03-31] + http://www.urbanophile.com/arenn/hacking/download.html + Copyright (C) 1998-2012 Aaron M. Renn. + Distributed under the LGPL 2.1. + +12. Jar-in-Jar Classloader + [checked 2012-04-03] + https://bugs.eclipse.org/bugs/show_bug.cgi?id=219530 + Copyright (C) Ferenc Hechler. + Distributed under the Eclipse Public License v1.0. Copied: trunk/NEWS.txt (from rev 1325, trunk/core/NEWS.txt) =================================================================== --- trunk/NEWS.txt (rev 0) +++ trunk/NEWS.txt 2012-06-28 21:15:39 UTC (rev 1327) @@ -0,0 +1,652 @@ + JSBML NEWS -- History of user-visible changes + +====================================================================== +Version 1.0-rc1 (xx-xx-2012) +====================================================================== + +* New Features: + + - SBasePlugin has now also become a TreeNodeWithChangeSupport and + AbstractSBasePlugin in turn extends AbstractTreeNode. + + - The Unit class has two new methods: removeOffset and + removeMultiplier. The first one computes a new multiplier from + the old offset, the old multiplier, and the scale and then sets + the offset to 0. The second method tries to remove the multiplier + by combining it with the scale. If this is not possible without + loosing accuracy, the method does nothing. + + - The multiplyWith and divideBy methods in UnitDefinition have been + improved to better combine units by using the merge method. + + - Filter method on TreeNodeWithChangeSupport, which allows for + recursive queries in the entire data structure. + + - Validation check for e-mail addresses in Creator. + + - A quick Hash-based search method to access elements in a model + based on their identifier. In the same way, any SBase can be + found in the SBMLDocument based on its metaId. + + - In order to make the API more Java-like, for each getNumXXX method + a corresponding getXXXCount method has been created and the older + method has become deprecated now. + + - The Species class now ensures that its spatial dimensions can only + be set if its surrounding compartment does not have zero dimensions + and if its hasOnlySubstanceUnits attribute is false. This behavior + is specified by the SBML documents for Level 2 Versions 1 and 2, but + was not yet implemented. + + - When trying to derive its UnitDefinition, the Species class now + tries to find an existing unit from the model, rather than returning + some UnitDefinition that has not yet been linked to the model. + + - A new JUnitTestClass helps to check if simplification and merging + of Units and UnitDefinitions works correctly. + + - The userObject in ASTNode has been replaced by a more general map + of userObjects that is located in TreeNodeWithChangeSupport. In this + way, any JSBML object that is part of the SBML tree can now be attached + with user-defined additional objects for in-memory manipulation. These + will not be written to SBML later on. + + - The new class NamedSBaeGlyph in the layout package supports accessing + the referenced element from a glyph. To further improve the access to + referenced objects from the Layout class, several new and improved methods + have been implemented, including a new Filter for NamedSBaseReferences. + Thanks to Matthias König for this suggestion. + + +* Bug Fixes: + + - SBML Layout extension contained bugs that caused endless recursion when + trying to access referenced instances of NamedSBase from a glyph (such + as CompartmentGlyph, SpeciesGlyph etc.). + + - It was sometimes possible to unregister elements from a model that were + the result of cloning, removal of the original entry and linking the clone + to the model. When altering the previous element, pointers were deleted + in SBMLDocument and Model. + + - There is now a rounding correction for multipliers when merging units + that tries to shift multipliers to the scale of a unit. This can only + be done if the logarithm to the base 10 of the multiplier is nearly + an integer number. Nearly means that the distance to the next integer + is not larger than the ensured double precision. + + - In the Layout Extension the id attribute on GraphicalObject has to be + mandatory. Furthermore, SpeciesReferenceGlyph has to be derived from + GraphicalObject as well. Thanks to Matthias König for pointing this + out. + + - Cloning of models did not work correctly in case that of ASTNodes or + Annotation elements that were to be cloned contained references to + TreeNodeChangeListeners. + + - It was forgotten to implement an unsetSubstanceUnits method on the Model + class. Thanks to Robert Byrnes for reporting this problem. + + - The Compartment class did not override the getDerivedUnitDefinition + method from its superclass. Hence, it was not possible to inherit + Level 3 units from the model. + + - Also, the Species class did not take inherited Level 3 units from the + Model into account. The getDerivedUnitDefinition method now has been + corrected. + + - In the Reaction class, the setReversible method only accepted Boolean, + no boolean. + + - Merging of Units was not correct: In cases that scales of two units + could not be evenly merged, just one of both was used, the second scale + was ignored. In these cases, however, the scales must be removed and + the double-valued multiplier must be used for representation. This is + now implemented. + + - If during the simplification of UnitDefinitions a dimensionless unit + was created by canceling terms, scale and multiplier were not merged + correctly with other units because in dimensionless units scale was + always 0 and multiplier was 1. Now, if some unit cancel, but a number + of non-dimensionless units remain, the simplify method checks again + the listOfUnits and tries to merge as many units as possible. + + - Scales of units could not be merged correctly if one of both scales + was different from zero. + + - When unifying units in addition or subtraction within an ASTNode + the scales were sometimes incorrectly merged. + + - Removed old note comment from the SubModel class. + + - JSBML could not write negative infinity into SBML files correctly. + + - Meike Aichele removed in TreeNodeChangeEvent the event spacialDimension, + because there is already a spatialDimension-event, which means + exactly the same + + - The units of formulae containing Advogadro's number could not + be derived because in the UnitsCompiler a UnitDefinition object + was created with undefined level/version configuration. Furhtermore, + there was a bug in the method containsUndeclaredUnits() in ASTNode. + + - Detected and fixed a source of possible NullPointerExceptions within + the hashCode method in ASTNode. + + - Improved the units derivation: There were multiple problems in + re-scaling and merging of units and also when determining the actual + unit of a species. + + - There was a bug in KineticLaw that prevented a correct iteration + through all child elements: Instead of looking at the + listOfLocalParameters it did return the math element twice (if there + was one). + + - When cloning entire models or SBMLDocuments, JSBML also did assign + the identical TreeNodeChangeListeners to the new data structure. This + could lead to unexpected behavior because listeners were receiving + change events from data structures to which these have not been + explicitely added by a user. + + - Cloning also caused problems because in some cases the recursive + method that registers all local parameters and other entities with + an id did in some cases not do a full recursion. Hence, some entities + could not be found in the model later on when searching for a certain + id. + + - QuantityWithUnit did not fire update events when changing its value + because of an incorrect comparison of the previous and the new value. + + - Detected a bug that made it impossible to set a kinetic law with an + exisiting list of local parameters as the new kinetic law in a + different reaction. JSBML always complained that all local parameters + were already registered. This was the case for the previous model to + which the kinetic law belonged. Hence, it was necessary to unregister + all local parameters first. + + - Subsequent registration and unregistration of local parameters did + not work. In case of reactions it was assumed that the kinetic law + that was to be added to some SBML subtree had already a parent SBML + element (this could be null). Furthermore, when trying to unregister + local parameters in a kinetic law, the put method was called on the + map between ids and local parameters, instead of the remove method. + +====================================================================== +Version 0.8.0 (15-05-2012) +====================================================================== + +* New Features: + + - The new specialized EventObject TreeNodeRemovedEvent has been + implemented in order to make sure that deleted nodes do no longer + have a pointer to their previous parent within the tree. At the + same time, it is still possible to identify their previous + location using the field in the new EventObject. + +* Bug Fixes: + + - There is now a rounding correction for multipliers when merging units + that tries to shift multipliers to the scale of a unit. This can only + be done if the logarithm to the base 10 of the multiplier is nearly + an integer number. Nearly means that the distance to the next integer + is not larger than the ensured double precision. + + - [Tracker item #3511439] : The cloning of a Species was not copying the + speciesType attribute. Thanks to Thomas Bernard who noticed and reported + the problem. + + - The units attribute on ASTNode was sometime not written out and the sbml + namespace was sometime missing from the mathML. It should be fine now. + +* Known issues : + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + - The RDF block at the top level of the annotation is considered to be the + official SBML annotation. + - SBML L3 packages are not supported and not kept. + +====================================================================== +Version 0.8-rc2 (12-04-2012) +====================================================================== + +* User visible changes : + + - Major improvements of the reading and writing speed for large models. + +* Bug Fixes: + + - It was forgotten to implement an unsetSubstanceUnits method on the Model + class. Thanks to Robert Byrnes for reporting this problem. + + - In the Reaction class, the setReversible method only accepted Boolean, + no boolean. + + - Several bug fixes and improvements to units derivation, merging and + simplifying. + + - There was a bug in KineticLaw that prevented a correct iteration + through all child elements. + + - When cloning JSBML wrongly assigned the same TreeNodeChangeListeners + to the new data structure. Now, the TreeNodeChangeListeners are not + copied when cloning a JSBML object. + + - The clone methods were corrected to register properly all entities + with an id. + + - QuantityWithUnit did not fire update events when changing its value + because of an incorrect comparison between the previous and the new + value. + + - Corrected a bug that made it impossible to set a kinetic law with an + existing list of local parameters as the new kinetic law in a + different reaction. + + - Meike Aichele detected and fixed the problem that some Listeners were + set too soon in the Model class, so that no Event was detected. + + - One rdf namespace declaration was missing when creating an History + element from scratch. + + - [Tracker item #3511439] : Model.getSpeciesType(String) was + corrected and it's speed improved. Thanks to Thomas Bernard who noticed + and reported the problem. + + - Annotation elements that are missing a proper namespace declaration will + be correctly read and not considered as improper SBML elements. + + - [Tracker item #3487517] : If one empty rdf Bag element was present in an + annotation read by jsbml, an XML element was not closed properly, + resulting in an invalid generated SBML. Thanks to Anna Zhukova to report + this problem. + + - [Tracker item #3434930] : The parsing of a Message as an XML String was + incorrect as the method was expecting only a notes element to enclose + the HTML. + + * Known issues : + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + - The RDF block at the top level of the annotation is considered to be the + official SBML annotation. + - SBML L3 packages are not supported and not kept. + +====================================================================== +Version 0.8-rc1 (xx-xx-2011) +====================================================================== + +* New Features: + + - NamedSBase has now the new method isIdMandatory in order to check + whether the identifier of this element must be defined in the SBML + representation. + + - The SBMLReader can now be used in connection with a + TreeNodeChangeListener. This allows users to keep track about the + parsing process of XML files. + + - The new interface TreeNodeWithChangeSupport separates manipulation + of change listeners from SBase, allowing multiple implementations. + + - The JavaDoc has been extended: It now also includes a statement + when ever a method might throw a PropertyNotAvailableException. + This class was called PropertyNotAvailableError before. In order + to avoid confusion with Java Errors, this class has been renamed. + Also the super type XMLError has been renamed to XMLException in + order to come closer to the default Java naming convention in + JSBML. + + - ASTNode has now a userObject attribute through which any + computation result or other additional information can be stored + in the tree. + + - Restructured the extension package: There is now one extra + directory including a specialized source folder for each extension. + The core does no longer contain the ext package. Besides the source + folder, there is also an extra doc folder that contains the + description of the type hierarchy of the implementation for this + package. + + - Data structures for the spatial extension are implemented. + + - When accessing the i-th child of an AbstractSBase, it is no longer + necessary to sort all extension packages as these are now + maintained in a sorted data structure. + + - The compile method in ASTNode has become more efficient now by + restructuring its case distinctions. + + - Implemented the hashCode method for all elements belonging to the + hierarchical SBML data structure (SBase, Annotation, ASTNode + etc.). + + - In order to get closer to the Java package structure, the change + listener for SBML objects is now located in the package + org.sbml.jsbml.util package. For the sake of more similarity to + standard Java classes and a greater flexibility, the + SBaseChangedListener has been renamed to TreeNodeChangeListener + and now extends the PropertyChangeListener in the package + java.beans. The same holds for the corresponding + SBaseChangedEvent that is now called TreeNodeChangeEvent and also + located in the package org.sbml.jsbml.util. Furthermore, all + elements of the SBML tree, including annotations, ASTNodes etc. + now make use of change events and notify their listeners, which + are now organized in a list instead of a set to make sure that + they are always called in the same order. The management of these + listeners is now performed in AbstractTreeNode, the new super + class for all recursive elements in JSBML. Thanks to Sarah Rachel + Müller vom Hagen to support this effort. + + - Notes, annotations, and extension packages are now part of the tree + representation of the JSBML data structure. + + - The new super class AnnotationElement has been introduced to gather + all those elements that can be used to annotate instances of SBase. + + - The new Type AbstractTreeNode implements basic recursive functions + and is now used as the new super class for ASTNode, AbstractSBase, + the new type AnnotationElement, and XMLToken (as the super class of + XMLNode). In this way, recursion and iteration over child elements + within the SBML data structure now follow a unified structure and + can be accessed uniquely within all such elements, including + annotations and extensions. Furthermore, the new interface + TreeNodeWithChangeSupport that is extended by SBase and + AbstractTreeNode gathers methods to add, remove, and notify listeners + about changes within the data structure (such as adding, removing + or exchanging child nodes, or change of any attributes). + + - A simple implementation of AbstractTreeNode, the class + TreeNodeAdapter has been implemented that contains some methods + also present in the interface MutableTreeNode. However, it does not + fully implement this interface because there are also some methods + that are not suitable for JSBML purposes. The TreeNodeAdapter works + as a wrapper class for elements that are part of the SBML data + hierarchy but that do not implement the TreeNode interface. With this + adapter, it is possible to include the list of Creators within a + history that is not a ListOf object, or the list of CVTerms in an + annotation in the hierarchy. + + - Sebastian Fröhlich provided some contributions to the parser for the + SBML level 3 layout extension package. JSBML now supports experimental + reading for this package. The full stable API for reading/writing of + SBML level 3 packages is planned for the next release of JSBML. + + - The SBMLReader now follows the factory pattern by providing static + methods to directly read SBML content from Files, InputStreams, or + Strings. Thanks to Martin Gräßlin for this idea in tracker issue + #3300433. + + - JSBML now provides a Maven script file. Thanks to Igor Rodchenkov + for contributing this file. + + - Where necessary, initDefaults has been complemented with an + additional method, for which the level/version combination can be + directly specified, i.e., it is now possible for those elements to + set their defaults as these would be for the specified + level/version combination. + + - A basic check to avoid setting the same meta identifier more than + once has been implemented. It maintains a set of metaIds on the + SBMLDocument. Thanks to Stefan Hoops for making clear that such a + check is mandatory. + + - A check for duplicate identifiers has been implemented. JSBML now + registers all elements that might have an identifier in hashes + mapping the id to the object itself. Different rules depending on + the specifications of the levels and versions of SBML ensure that + only allowable identifiers can be accepted. To this end, the new + interface UniqueNamedSBase tags all those elements whose id is + intended to be unique within one model. + + - When adding an element with undefined Level/Version combination + or at least with undefined Version to an element whose L/V + configuration has been defined, JSBML now recursively updates this + configuration for the child element. In case of differing L/V + configurations an exception will be thrown on adding the element. + +* Bug Fixes: + + - Corrected mistakes in the org.sbml.jsbml.util.Maths class, where + some trigonometric functions were incorrectly calculated. + + - When writing SBML Level 1 the name attribute (which has become the + id attribute in later SBML versions) was never written because JSBML + uses the id only as an internal representation. The check for + Level 1 name attributes was not correct. + + - In SBML Level 1 MathML code was written in KineticLaws although + in this SBML version formulas are represented in infix notation only. + + - When creating a Parameter object using the constructor that takes + a LocalParameter as its only argument, a call to setConstant(true) + was always performed, irrespective of the fact that for Level = 1 + models this method throws a PropertyNotAvailableError. Thanks to + Sarah R. Müller vom Hagen for reporting this problem. + + - [Tracker issue #3323886]: The units of Species were not derived + correctly because if the units were not explicitly defined, the method + getDerivedUnitsInstance() always returned the predefined unit + "substance", or null for models in Level 3. Now it considers the + surrounding compartment, the hasOnlySubstanceUnits, and spatialSizeUnits + attributes depending on the Level/Version configuration. + + - Cloning of SBMLDocuments was not done correctly: The set of already + existing metaIds was initialized after adding the model to the document. + In the mean time, there could already be access to this set. + + - When reading SBML content from a file or writing JSBML data structures + as SBML to a file, the SBMLReader/Writer did not close streams after + finishing. This caused that sometimes files could not be opened by other + programs although writing was already done. Unfortunately, by correcting + this bug, an IOException needs to be thrown, but previously, a + FileNotFoundException was already sufficient. Hence, users need to catch + a different exception now when reading/writing SBML. + + - Renamed the getters for Creator and ModifiedDates in History to + getListOfCreators() and getListOfModifiedDates (before it was spelled + without "Of", for the sake of having equal names for all such getters. + + - If the Level/Version combination was not set, the identifier of + NamedSBases was sometimes not written to an SBML file. + + - [Tracker issue #3300430]: In some condition, the JVM was not checking + the type of an Object before adding it to a typed variable which later + lead to some ClassCastException that prevented jsbml to save some + models. Thanks to Martin Graesslin to report the bugs alongside some + unit tests and to help resolved it. + + - [Tracker issue #3300490] : The method SBase.getNotesString() was + returning null instead of the empty string, as stated in the java + documentation. This has been corrected and the empty String is returned + now. Thanks to Martin Graesslin to report the bugs alongside some + unit tests. + + - The SBML level 1 rules were incorrectly read, now when the 'type' + attribute is set to 'rate', a RateRule is properly created. + + - The SubModel utility class was fixed and an example of how to use it + added. + + - Corrected the clone method for listOf objects. The typeOfList was + not set in the clone so it was not possible to save a model that contain + a cloned list. + + - [Tracker item #3306135] : the handling to the number NaN (NotANumber) has + been improved and the correct mathML element is created when saving the + formula to XML. + + - The attribute denominator on level1v2 SpeciesReferences was never read. + Thanks to the numerus models in the SBML Test Suite to help us detecting + this problem. + +* Known issues : + + - ?? The support for the mathML elements notanumber and infinity is not + complete. ?? NaN not read properly from formula ! + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. Planned for the next major release. + +====================================================================== +Version 0.8-b2 (18-04-2011) +====================================================================== + +* New Features: + + - The new interface CallableSBase ensures that only instances of this + type may be referenced in ASTNodes. In this way, it is no longer + possible to refer to Events from ASTNodes. + + - Additional type of error: abstract PropertyError with its two sub- + types PropertyNotAvailableError and PropertyUndefinedError. The + PropertyNotAvailableError one indicates that a certain property + of an SBase is not defined for its current Level/Version + combination, whereas the latter one indicates that the value + belonging to a mandatory property, for which there is no default + value has not been defined. At least in the Trigger class, + PropertyUndefinedErrors are now thrown when attempting to access + the value of the persistent or initialValue attribute for models + with Level >= 3 and an undeclared value. Thanks to Roland Keller + and Lucian Smith for pointing out this necessity. + +* Bug Fixes: + + - The class Maths, a compilation of useful mathematical functions, + provided an implementation of the factorial function that took + a double as its argument. However, for this purpose, the Gamma + function must be implemented. We changed this function to take + integer values only. + + - A NullPointerException could occur when deriving the unit of an + expression containing a call to the factorial function. Thanks + to Roland Keller for reporting this. + + - [Tracker issue #3208887] : When trying to access the previously + set value for UseValuesFromTriggerTime it was possible that a + NullPointerException could occur due to the attempt to clone this + element. This has been fixed. Thanks to Sebastian Fröhlich for + reporting this. + + - [Tracker issue #3208903] : Priority elements were + properly read and written. Thanks to Sebastian Fröhlich for + reporting this. + + - [Tracker issue #3204275] : It was impossible to set the size of a + compartment for models in Level 3 if the spatial dimensions was + undefined, i.e., NaN. Since it is only prohibited to set the size + if the dimensions equal 0, we provided another test in the set + method in Compartment to allow for this. + + - Corrected a typo in the method SBO.getAntisenseRNA(), the method was + always returning -1. It is now returning the correct value (317), thanks + to Anushya Muruganujan for reporting this. + + - [Tracker issue #3175906] : Removed plenty of unused methods in the + Annotation class that were dealing with writing the annotation as XML. + Everything is handle now in the stax SBMLWriter. + The getAnnotationString method was not present in the SBase interface, + it is now added and should be the only method used to get the Annotation + as XML. + + - [Tracker issue #3175911] : compartment.spatialDimensions type changed + to double to be consistent with the SBML level 3 specifications, as a + consequence the return type of the getSpatialDimensions as been changed. + + - [Tracker issue #3176548] : id containing underscores were not parsed + properly by the infix formula parser, this is now fix and any valid SId + should work. Thanks to Goksel Misirli for reporting this. + + - [Tracker issue #3175833] : annotation tags were not properly closed when + a mathML element was present on the same element. + Thanks to Goksel Misirli for reporting this. + + - A new interface, CallableSBase, was introduced to encompass all the + different SBML elements that can be referenced inside a mathML 'ci' + element. As a consequence, some methods signature have changed. + + - [Tracker issue #3175833] : in some cases, an empty annotation was + written if a metaid was defined. Some methods were added to the + Annotation class to test which part of the annotation is defined. + + - [Tracker issue #3196284] : the unit exponent was incorrectly always read + as an integer. This has been corrected and if the level of the model is + 3, the exponent is read as a double. + + - [Tracker issue #3196638] : the message constraint was not properly read, + it was stored in the notes instead of the message ! This is now + corrected, thanks to the person who reported that. + + - Corrected several bugs in the SBMLValidator and implemented properly all + the classes related to SBMLdocument.checkConsistency() so that is works + as expected. + + - [Tracker issue #3199792] : localParameter were not parsed correctly in + SBML level 3. Thanks for the persons who reported it. + + - [Tracker issue #3216183] : all the XML elements that were belonging to + the RDF namespace were sent to a parser that understood only the + specific SBML RDF annotations. This as been fixed and we can now have + some RDF elements anywhere in the annotation. + +* Known issues : + + - SBML level 1 rules when the 'type' attribute is equal to 'rate' are + created as AssignmentRule instead of RateRule. + + - The support for the mathML elements notanumber and infinity is not + complete. + + - Reading of more than one RDF Description elements in the RDF annotation + block (the official SBML annotation scheme) is not supported at the + moment. + +============================================================================ +Version 0.8-b1 (04-02-2011) +============================================================================ + +This the first beta release of JSBML 0.8, JSBML is a community-driven +project to create a free, open-source, pure Java library for reading, +writing, and manipulating SBML files and data streams. It is an +alternative to the mixed Java/native code-based interface provided in +libSBML. + +For more details, please visit http://sbml.org/Software/JSBML + +* Bug Fixes: + - [Tracker issue #3137967] + Namespaces in the sbml element were incorrectly parsed, some known + namespaces like html were not kept for examples. This is fixed, thanks + to Paulo Maia for reporting this. + +* Known issues: + - problem of output indentation for notes, when there is several top level + elements. + + - the method SBMLDocument.checkConsistency() is not working. There is a + problem in the parsing of the XML return by the sbml.org validator. + + - dependency on the sbml.org validator which might not be robust + enough (you cannot submit a file bigger 15MB for example). + It would be better to be able to install your own localy or at + least have several mirrors. We will have to see how it performs. + + - in a mathML block, if one 'ci'element is suppose to represent a + functionDefinition but the id is not a valid id, the type of the ASTNode + is not set properly, so there are some errors when trying to use the + corresponding ASTNode tree. (cf model generated by COBRA) + +----------------------------------------------------------------------------- +$URL$ +Last Modified: $Date$ +Last Modified By: $Author$ + +The following is for [X]Emacs users. Please leave in place. +Local Variables: +fill-column: 77 +End: +----------------------------------------------------------------------------- Deleted: trunk/core/AUTHORS.txt =================================================================== --- trunk/core/AUTHORS.txt 2012-06-28 21:13:15 UTC (rev 1326) +++ trunk/core/AUTHORS.txt 2012-06-28 21:15:39 UTC (rev 1327) @@ -1,27 +0,0 @@ - ------------- - JSBML Authors - ------------- - - -- Core developers -- - - Andreas Draeger, University of Tuebingen, Germany - Nicolas Rodriguez, European Bioinformatics Institute, UK - - - -- Contributors -- - - Meike Aichele, University of Tuebingen, Germany - Finja Buechel, University of Tuebingen, Germany - Alexander Doerr, University of Tuebingen, Germany - Sebastian Froehlich, IKP Gatersleben, Germany - Michael Hucka, California Institute of Technology, USA - Florian Mittag, University of Tuebingen, Germany - Alexander Peltzer, University of Tuebingen, Germany - Clemens Wrzodek, University of Tuebingen, Germany - - -- Alumni -- - - Marine Dumousseau, European Bioinformatics Institute, UK - Sarah Rachel Mueller vom Hagen, University of Tuebingen, Germany - Simon Schaefer, University of Tuebingen, Germany - \ No newline at end of file Deleted: trunk/core/LICENSE.txt =================================================================== --- trunk/core/LICENSE.txt 2012-06-28 21:13:15 UTC (rev 1326) +++ trunk/core/LICENSE.txt 2012-06-28 21:15:39 UTC (rev 1327) @@ -1,119 +0,0 @@ - Licensing and Distribution Terms for JSBML - -Copyright (C) 2009-2012 jointly by the following organizations: - 1. The University of Tuebingen, Germany - 2. EMBL European Bioinformatics Institute (EMBL-EBI), Hinxton, UK - 3. The California Institute of Technology, Pasadena, CA, USA - -JSBML is free software; you can redistribute it and/or modify -it under the terms of the GNU Lesser General Public License as -published by the Free Software Foundation; either version 2.1 -of the License, or any later version. - -This software is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software -and documentation provided hereunder is on an "as is" basis, and -the copyright holders have no obligations to provide maintenance, -support, updates, enhancements or modifications. In no event -shall the copyright holders be liable to any party for direct, -indirect, special, incidental or consequential damages, including -lost profits, arising out of the use of this software and its -documentation, even if the copyright holders have been advised of -the possibility of such damage. See the GNU Lesser General Public -License for more details. - -You should have received a copy of the GNU Lesser General -Public License along with this library in the file named -"COPYING.txt" included with the software distribution. A copy -is also available online at the Internet address -http://sbml.org/Software/JSBML/licenses/COPYING.html for your -convenience. You may also write to obtain a copy from the Free -Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, -MA 02111-1307 USA. - - - Third-party software incorporated into - the JSBML distribution - -JSBML uses the following third-party software libraries; these -are distributed along with JSBML and placed in the source code -repository. The license statements for these third-party -software libraries can be found at the web addresses noted -below. For your convenience, copies of the license files are -also included in the JSBML subdirectory licenses/lib-licenses/. - -1. BioJava -- http://biojava.org - [checked 2010-12-16] - Copyright (C) held jointly by the individual BioJava authors. - Distributed under the LGPL version 2.1. - -2. Jigsaw -- http://www.w3.org/Jigsaw/ - [checked 2010-12-16] - Copyright (C) W3C. - Distributed under the W3C license. - -3. StAX -- http://stax.codehaus.org/Home - [checked 2010-12-16] - No clear copyright found. - Distributed under the Apache License 2.0. - -4. StAX2 -- http://docs.codehaus.org/display/WSTX/StAX2 - [checked 2010-12-16] - No clear copyright found. - Distributed under the Apache License 2.0. - -5. StaxMate -- http://staxmate.codehaus.org/ - [checked 2010-12-16] - Copyright (c) 2007, Tatu Saloranta. - Distributed under the BSD License. - -6. Woodstox -- http://woodstox.codehaus.org/ - [checked 2010-12-16] - No clear copyright found. - Distributed under the Apache License 2.0. - -7. XStream -- http://xstream.codehaus.org/ - [checked 2010-12-16] - Copyright (c) 2003-2006, Joe Walnes - Copyright (c) 2006-2007, XStream Committers - Distributed under a custom open-source license. - -8. log4j -- http://logging.apache.org/log4j/1.2/ - [checked 2010-12-16] - Copyright (C) Apache Software Foundation - Distributed under the Apache License 2.0. - - - Additional third-party software incorporated into - JSBML example applications - -The example applications provided with JSBML also include the -following additional third-party software libraries; these are -distributed along with JSBML and placed in the examples/ code -repository. The license statements for these third-party software -libraries can be found at the web addresses noted below. For your -convenience, copies of the license files are also included in the -JSBML subdirectory licenses/lib-licenses/. - -9. JFreeChart 1.0.14 and JCommon 1.0.17 - [checked 2012-03-31] - Copyright (C) 2000-2011, by Object Refinery Limited and Contributors - Distributed under the LGPL version 2.1. - -10. Swing-Layout 1.0.3 - [checked 2012-03-31] - Copyright (C) 2005-2006 Sun Microsystems, Inc. - Distributed under the LGPL 2.1. - -11. GNU getopt Java port - [checked 2012-03-31] - http://www.urbanophile.com/arenn/hacking/download.html - Copyright (C) 1998-2012 Aaron M. Renn. - Distributed under the LGPL 2.1. - -12. Jar-in-Jar Classloader - [checked 2012-04-03] - https://bugs.eclipse.org/bugs/show_bug.cgi?id=219530 - Copyright (C) Ferenc Hechler. - Distributed under the Eclipse Public License v1.0. Deleted: trunk/core/NEWS.txt =================================================================== --- trunk/core/NEWS.txt 2012-06-28 21:13:15 UTC (rev 1326) +++ trunk/core/NEWS.txt 2012-06-28 21:15:39 UTC (rev 1327) @@ -1,652 +0,0 @@ - JSBML NEWS -- History of user-visible changes - -====================================================================== -Version 1.0-rc1 (xx-xx-2012) -====================================================================== - -* New Features: - - - SBasePlugin has now also become a TreeNodeWithChangeSupport and - AbstractSBasePlugin in turn extends AbstractTreeNode. - - - The Unit class has two new methods: removeOffset and - removeMultiplier. The first one computes a new multiplier from - the old offset, the old multiplier, and the scale and then sets - the offset to 0. The second method tries to remove the multiplier - by combining it with the scale. If this is not possible without - loosing accuracy, the method does nothing. - - - The multiplyWith and divideBy methods in UnitDefinition have been - improved to better combine units by using the merge method. - - - Filter method on TreeNodeWithChangeSupport, which allows for - recursive queries in the entire data structure. - - - Validation check for e-mail addresses in Creator. - - - A quick Hash-based search method to access elements in a model - based on their identifier. In the same way, any SBase can be - found in the SBMLDocument based on its metaId. - - - In order to make the API more Java-like, for each getNumXXX method - a corresponding getXXXCount method has been created and the older - method has become deprecated now. - - - The Species class now ensures that its spatial dimensions can only - be set if its surrounding compartment does not have zero dimensions - and if its hasOnlySubstanceUnits attribute is false. This behavior - is specified by the SBML documents for Level 2 Versions 1 and 2, but - was not yet implemented. - - - When trying to derive its UnitDefinition, the Species class now - tries to find an existing unit from the model, rather than returning - some UnitDefinition that has not yet been linked to the model. - - - A new JUnitTestClass helps to check if simplification and merging - of Units and UnitDefinitions works correctly. - - - The userObject in ASTNode has been replaced by a more general map - of userObjects that is located in TreeNodeWithChangeSupport. In this - way, any JSBML object that is part of the SBML tree can now be attached - with user-defined additional objects for in-memory manipulation. These - will not be written to SBML later on. - - - The new class NamedSBaeGlyph in the layout package supports accessing - the referenced element from a glyph. To further improve the access to - referenced objects from the Layout class, several new and improved methods - have been implemented, including a new Filter for NamedSBaseReferences. - Thanks to Matthias König for this suggestion. - - -* Bug Fixes: - - - SBML Layout extension contained bugs that caused endless recursion when - trying to access referenced instances of NamedSBase from a glyph (such - as CompartmentGlyph, SpeciesGlyph etc.). - - - It was sometimes possible to unregister elements from a model that were - the result of cloning, removal of the original entry and linking the clone - to the model. When altering the previous element, pointers were deleted - in SBMLDocument and Model. - - - There is now a rounding correction for multipliers when merging units - that tries to shift multipliers to the scale of a unit. This can only - be done if the logarithm to the base 10 of the multiplier is nearly - an integer number. Nearly means that the distance to the next integer - is not larger than the ensured double precision. - - - In the Layout Extension the id attribute on GraphicalObject has to be - mandatory. Furthermore, SpeciesReferenceGlyph has to be derived from - GraphicalObject as well. Thanks to Matthias König for pointing this - out. - - - Cloning of models did not work correctly in case that of ASTNodes or - Annotation elements that were to be cloned contained references to - TreeNodeChangeListeners. - - - It was forgotten to implement an unsetSubstanceUnits method on the Model - class. Thanks to Robert Byrnes for reporting this problem. - - - The Compartment class did not override the getDerivedUnitDefinition - method from its superclass. Hence, it was not possible to inherit - Level 3 units from the model. - - - Also, the Species class did not take inherited Level 3 units from the - Model into account. The getDerivedUnitDefinition method now has been - corrected. - - - In the Reaction class, the setReversible method only accepted Boolean, - no boolean. - - - Merging of Units was not correct: In cases that scales of two units - could not be evenly merged, just one of both was used, the second scale - was ignored. In these cases, however, the scales must be removed and - the double-valued multiplier must be used for representation. This is - now implemented. - - - If during the simplification of UnitDefinitions a dimensionless unit - was created by canceling terms, scale and multiplier were not merged - correctly with other units because in dimensionless units scale was - always 0 and multiplier was 1. Now, if some unit cancel, but a number - of non-dimensionless units remain, the simplify method checks again - the listOfUnits and tries to merge as many units as possible. - - - Scales of units could not be merged correctly if one of both scales - was different from zero. - - - When unifying units in addition or subtraction within an ASTNode - the scales were sometimes incorrectly merged. - - - Removed old note comment from the SubModel class. - - - JSBML could not write negative infinity into SBML files correctly. - - - Meike Aichele removed in TreeNodeChangeEvent the event spacialDimension, - because there is already a spatialDimension-event, which means - exactly the same - - - The units of formulae containing Advogadro's number could not - be derived because in the UnitsCompiler a UnitDefinition object - was created with undefined level/version configuration. Furhtermore, - there was a bug in the method containsUndeclaredUnits() in ASTNode. - - - Detected and fixed a source of possible NullPointerExceptions within - the hashCode method in ASTNode. - - - Improved the units derivation: There were multiple problems in - re-scaling and merging of units and also when determining the actual - unit of a species. - - - There was a bug in KineticLaw that prevented a correct iteration - through all child elements: Instead of looking at the - listOfLocalParameters it did return the math element twice (if there - was one). - - - When cloning entire models or SBMLDocuments, JSBML also did assign - the identical TreeNodeChangeListeners to the new data structure. This - could lead to unexpected behavior because listeners were receiving - change events from data structures to which these have not been - explicitely added by a user. - - - Cloning also caused problems because in some cases the recursive - method that registers all local parameters and other entities with - an id did in some cases not do a full recursion. Hence, some entities - could not be found in the model later on when searching for a certain - id. - - - QuantityWithUnit did not fire update events when changing its value - because of an incorrect comparison of the previous and the new value. - - - Detected a bug that made it impossible to set a kinetic law with an - exisiting list of local parameters as the new kinetic law in a - different reaction. JSBML always complained that all local parameters - were already registered. This was the case for the previous model to - which the kinetic law belonged. Hence, it was necessary to unregister - all local parameters first. - - - Subsequent registration and unregistration of local parameters did - not work. In case of reactions it was assumed that the kinetic law - that was to be added to some SBML subtree had already a parent SBML - element (this could be null). Furthermore, when trying to unregister - local parameters in a kinetic law, the put method was called on the - map between ids and local parameters, instead of the remove method. - -====================================================================== -Version 0.8.0 (15-05-2012) -====================================================================== - -* New Features: - - - The new specialized EventObject TreeNodeRemovedEvent has been - implemented in order to make sure that deleted nodes do no longer - have a pointer to their previous parent within the tree. At the - same time, it is still possible to identify their previous - location using the field in the new EventObject. - -* Bug Fixes: - - - There is now a rounding correction for multipliers when merging units - that tries to shift multipliers to the scale of a unit. This can only - be done if the logarithm to the base 10 of the multiplier is nearly - an integer number. Nearly means that the distance to the next integer - is not larger than the ensured double precision. - - - [Tracker item #3511439] : The cloning of a Species was not copying the - speciesType attribute. Thanks to Thomas Bernard who noticed and reported - the problem. - - - The units attribute on ASTNode was sometime not written out and the sbml - namespace was sometime missing from the mathML. It should be fine now. - -* Known issues : - - - Reading of more than one RDF Description elements in the RDF annotation - block (the official SBML annotation scheme) is not supported at the - moment. Planned for the next major release. - - The RDF block at the top level of the annotation is considered to be the - official SBML annotation. - - SBML L3 packages are not supported and not kept. - -====================================================================== -Version 0.8-rc2 (12-04-2012) -====================================================================== - -* User visible changes : - - - Major improvements of the reading and writing speed for large models. - -* Bug Fixes: - - - It was forgotten to implement an unsetSubstanceUnits method on the Model - class. Thanks to Robert Byrnes for reporting this problem. - - - In the Reaction class, the setReversible method only accepted Boolean, - no boolean. - - - Several bug fixes and improvements to units derivation, merging and - simplifying. - - - There was a bug in KineticLaw that prevented a correct iteration - through all child elements. - - - When cloning JSBML wrongly assigned the same TreeNodeChangeListeners - to the new data structure. Now, the TreeNodeChangeListeners are not - copied when cloning a JSBML object. - - - The clone methods were corrected to register properly all entities - with an id. - - - QuantityWithUnit did not fire update events when changing its value - because of an incorrect comparison between the previous and the new - value. - - - Corrected a bug that made it impossible to set a kinetic law with an - existing list of local parameters as the new kinetic law in a - different reaction. - - - Meike Aichele detected and fixed the problem that some Listeners were - set too soon in the Model class, so that no Event was detected. - - - One rdf namespace declaration was missing when creating an History - element from scratch. - - - [Tracker item #3511439] : Model.getSpeciesType(String) was - corrected and it's speed improved. Thanks to Thomas Bernard who noticed - and reported the problem. - - - Annotation elements that are missing a proper namespace declaration will - be correctly read and not considered as improper SBML elements. - - - [Tracker item #3487517] : If one empty rdf Bag element was present in an - annotation read by jsbml, an XML element was not closed properly, - resulting in an invalid generated SBML. Thanks to Anna Zhukova to report - this problem. - - - [Tracker item #3434930] : The parsing of a Message as an XML String was - incorrect as the method was expecting only a notes element to enclose - the HTML. - - * Known issues : - - - Reading of more than one RDF Description elements in the RDF annotation - block (the official SBML annotation scheme) is not supported at the - moment. Planned for the next major release. - - The RDF block at the top level of the annotation is considered to be the - official SBML annotation. - - SBML L3 packages are not supported and not kept. - -====================================================================== -Version 0.8-rc1 (xx-xx-2011) -====================================================================== - -* New Features: - - - NamedSBase has now the new method isIdMandatory in order to check - whether the identifier of this element must be defined in the SBML - representation. - - - The SBMLReader can now be used in connection with a - TreeNodeChangeListener. This allows users to keep track about the - parsing process of XML files. - - - The new interface TreeNodeWithChangeSupport separates manipulation - of change listeners from SBase, allowing multiple implementations. - - - The JavaDoc has been extended: It now also includes a statement - when ever a method might throw a PropertyNotAvailableException. - This class was called PropertyNotAvailableError before. In order - to avoid confusion with Java Errors, this class has been renamed. - Also the super type XMLError has been renamed to XMLException in - order to come closer to the default Java naming convention in - JSBML. - - - ASTNode has now a userObject attribute through which any - computation result or other additional information can be stored - in the tree. - - - Restructured the extension package: There is now one extra - directory including a specialized source folder for each extension. - The core does no longer contain the ext package. Besides the source - folder, there is also an extra doc folder that contains the - description of the type hierarchy of the implementation for this - package. - - - Data structures for the spatial extension are implemented. - - - When accessing the i-th child of an AbstractSBase, it is no longer - necessary to sort all extension packages as these are now - maintained in a sorted data structure. - - - The compile method in ASTNode has become more efficient now by - restructuring its case distinctions. - - - Implemented the hashCode method for all elements belonging to the - hierarchical SBML data structure (SBase, Annotation, ASTNode - etc.). - - - In order to get closer to the Java package structure, the change - listener for SBML objects is now located in the package - org.sbml.jsbml.util package. For the sake of more similarity to - standard Java classes and a greater flexibility, the - SBaseChangedListener has been renamed to TreeNodeChangeListener - and now extends the PropertyChangeListener in the package - java.beans. The same holds for the corresponding - SBaseChangedEvent that is now called TreeNodeChangeEvent and also - located in the package org.sbml.jsbml.util. Furthermore,... [truncated message content] |
From: <nik...@us...> - 2012-07-02 12:29:00
|
Revision: 1342 http://jsbml.svn.sourceforge.net/jsbml/?rev=1342&view=rev Author: niko-rodrigue Date: 2012-07-02 12:28:49 +0000 (Mon, 02 Jul 2012) Log Message: ----------- Removed from the interface SBase the method setParentSBML and changed the visibility of the AbstractSBase.setParentSBML to protected as discussed on the list. Removed as well the fact that the SBMLDocument was setting itself as his parent which would create an infinite loop Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/SBMLDocument.java trunk/core/src/org/sbml/jsbml/SBase.java trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLLevel1Version1Parser.java trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/GroupModel.java Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-07-02 10:45:37 UTC (rev 1341) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-07-02 12:28:49 UTC (rev 1342) @@ -1258,16 +1258,16 @@ * before (recursively) registering all ids: */ TreeNode oldParent = sbase.getParent(); // Memorize the old parent (may be null). - sbase.setParentSBML(this); + ((AbstractSBase) sbase).setParentSBML(this); // If possible, recursively register all ids of the SBase in our model: if ((model != null) && !model.registerIds(this, sbase, recursively, false)) { // Something went wrong: We have to restore the previous state: if (oldParent == null) { - sbase.setParentSBML(null); + ((AbstractSBase) sbase).setParentSBML(null); } else if (oldParent instanceof SBase) { - sbase.setParentSBML((SBase) oldParent); + ((AbstractSBase) sbase).setParentSBML((SBase) oldParent); } sbase.addAllChangeListeners(listeners); @@ -1317,7 +1317,6 @@ KineticLaw kineticLaw = (KineticLaw) klTreeNode; kineticLaw.registerLocalParameter((LocalParameter) sbase, true); - sbase.setParentSBML(this); } } @@ -1456,7 +1455,7 @@ /* (non-Javadoc) * @see org.sbml.jsbml.SBase#setParentSBML(org.sbml.jsbml.SBase) */ - public void setParentSBML(SBase parent) { + protected void setParentSBML(SBase parent) { SBase oldParent = getParent(); this.parent = parent; firePropertyChange(TreeNodeChangeEvent.parentSBMLObject, oldParent, parent); @@ -1479,7 +1478,7 @@ * differs from the one of this {@link SBase}. * @see {@link #setParentSBML(SBase)} */ - public void setParentSBMLObject(SBase sbase) throws LevelVersionError { + protected void setParentSBMLObject(SBase sbase) throws LevelVersionError { if (sbase instanceof AbstractSBase) { ((AbstractSBase) sbase).checkLevelAndVersionCompatibility(this); } Modified: trunk/core/src/org/sbml/jsbml/SBMLDocument.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-07-02 10:45:37 UTC (rev 1341) +++ trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-07-02 12:28:49 UTC (rev 1342) @@ -133,7 +133,7 @@ this.model = null; SBMLDocumentAttributes = new HashMap<String, String>(); SBMLDocumentNamespaces = new HashMap<String, String>(); - setParentSBML(this); + // setParentSBML(this); checkConsistencyParameters.put(CHECK_CATEGORY.UNITS_CONSISTENCY.name(), false); } @@ -182,7 +182,7 @@ entry = entryIterator.next(); this.SBMLDocumentNamespaces.put(entry.getKey(), entry.getValue()); } - setParentSBML(this); + // setParentSBML(this); checkConsistencyParameters.put(CHECK_CATEGORY.UNITS_CONSISTENCY.name(), Boolean.valueOf(false)); } Modified: trunk/core/src/org/sbml/jsbml/SBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBase.java 2012-07-02 10:45:37 UTC (rev 1341) +++ trunk/core/src/org/sbml/jsbml/SBase.java 2012-07-02 12:28:49 UTC (rev 1342) @@ -529,11 +529,9 @@ */ public void setNotes(XMLNode notesXMLNode); - /** - * - * @param parent - */ - public void setParentSBML(SBase parent); + + // This method is protected now + // public void setParentSBML(SBase parent); /** * Sets the value of the 'sboTerm' attribute. Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java 2012-07-02 10:45:37 UTC (rev 1341) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java 2012-07-02 12:28:49 UTC (rev 1342) @@ -724,7 +724,6 @@ model.setLevel(sbmlDocument.getLevel()); model.setVersion(sbmlDocument.getVersion()); model.initDefaults(); - model.setParentSBML(sbmlDocument); sbmlDocument.setModel(model); return model; Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLLevel1Version1Parser.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLLevel1Version1Parser.java 2012-07-02 10:45:37 UTC (rev 1341) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLLevel1Version1Parser.java 2012-07-02 12:28:49 UTC (rev 1342) @@ -427,7 +427,6 @@ SBMLDocument sbmlDocument = (SBMLDocument) contextObject; if (elementName.equals("model")) { Model model = (Model) newContextObject; - model.setParentSBML(sbmlDocument); sbmlDocument.setModel(model); return model; Modified: trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/GroupModel.java =================================================================== --- trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/GroupModel.java 2012-07-02 10:45:37 UTC (rev 1341) +++ trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/GroupModel.java 2012-07-02 12:28:49 UTC (rev 1342) @@ -130,7 +130,7 @@ if ((this.listOfGroups != null) && (this.listOfGroups.getSBaseListType() != ListOf.Type.other)) { this.listOfGroups.setSBaseListType(ListOf.Type.other); } - listOfGroups.setParentSBMLObject(model); + model.registerChild(listOfGroups); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-07-23 15:55:22
|
Revision: 1351 http://jsbml.svn.sourceforge.net/jsbml/?rev=1351&view=rev Author: andreas-draeger Date: 2012-07-23 15:55:09 +0000 (Mon, 23 Jul 2012) Log Message: ----------- * Updated all acknowledgments for contributors and authors of this library. * Changed all package.html files to package-info.java. * An overview.html file should now also be created. * Corrected minor bugs in the Layout and the Render extension. Modified Paths: -------------- trunk/AUTHORS.txt trunk/core/doc/user_guide/JSBML_Acknowledgments.tex trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/xml/parsers/RDFAnnotationParser.java trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/PluginSBMLReader.java Added Paths: ----------- trunk/core/src/org/sbml/jsbml/ext/package-info.java trunk/core/src/org/sbml/jsbml/package-info.java trunk/core/src/org/sbml/jsbml/resources/package-info.java trunk/core/src/org/sbml/jsbml/text/parser/package-info.java trunk/core/src/org/sbml/jsbml/util/compilers/package-info.java trunk/core/src/org/sbml/jsbml/util/filters/package-info.java trunk/core/src/org/sbml/jsbml/util/package-info.java trunk/core/src/org/sbml/jsbml/validator/package-info.java trunk/core/src/org/sbml/jsbml/xml/package-info.java trunk/core/src/org/sbml/jsbml/xml/parsers/package-info.java trunk/core/src/org/sbml/jsbml/xml/stax/package-info.java trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package-info.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package-info.java trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package-info.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package-info.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package-info.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/package-info.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package-info.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/package-info.java trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/test/package-info.java trunk/modules/libSBMLcompat/src/org/sbml/libsbml/package-info.java trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/package-info.java trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/package-info.java trunk/modules/libSBMLio/test/org/sbml/jsbml/test/package-info.java Removed Paths: ------------- trunk/core/src/org/sbml/jsbml/ext/package.html trunk/core/src/org/sbml/jsbml/package.html trunk/core/src/org/sbml/jsbml/resources/package.html trunk/core/src/org/sbml/jsbml/text/parser/package.html trunk/core/src/org/sbml/jsbml/util/compilers/package.html trunk/core/src/org/sbml/jsbml/util/filters/package.html trunk/core/src/org/sbml/jsbml/util/package.html trunk/core/src/org/sbml/jsbml/validator/package.html trunk/core/src/org/sbml/jsbml/xml/package.html trunk/core/src/org/sbml/jsbml/xml/parsers/package.html trunk/core/src/org/sbml/jsbml/xml/stax/package.html trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package.html trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package.html trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package.html trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package.html trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package.html trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package.html trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package.html trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/package.html trunk/modules/celldesigner/src/org/sbml/jsbml/cdplugin/test/package.html trunk/modules/libSBMLcompat/src/org/sbml/libsbml/package.html trunk/modules/libSBMLio/src/org/sbml/jsbml/xml/libsbml/package.html trunk/modules/libSBMLio/test/org/sbml/jsbml/libsbmlio/package.html trunk/modules/libSBMLio/test/org/sbml/jsbml/test/package.html Modified: trunk/AUTHORS.txt =================================================================== --- trunk/AUTHORS.txt 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/AUTHORS.txt 2012-07-23 15:55:09 UTC (rev 1351) @@ -10,18 +10,23 @@ -- Contributors -- - Meike Aichele, University of Tuebingen, Germany Finja Buechel, University of Tuebingen, Germany + Alexander Diamantikos, University of Tuebingen, Germany Alexander Doerr, University of Tuebingen, Germany - Sebastian Froehlich, IKP Gatersleben, Germany + Johannes Eichner, University of Tuebingen, Germany Michael Hucka, California Institute of Technology, USA + Jakob Matthes, University of Tuebingen, Germany Florian Mittag, University of Tuebingen, Germany + Eugen Netz, University of Tuebingen, Germany Alexander Peltzer, University of Tuebingen, Germany + Jan Rudolph, University of Tuebingen, Germany Clemens Wrzodek, University of Tuebingen, Germany -- Alumni -- + Meike Aichele, University of Tuebingen, Germany Marine Dumousseau, European Bioinformatics Institute, UK + Sebastian Froehlich, IKP Gatersleben, Germany Sarah Rachel Mueller vom Hagen, University of Tuebingen, Germany Simon Schaefer, University of Tuebingen, Germany \ No newline at end of file Modified: trunk/core/doc/user_guide/JSBML_Acknowledgments.tex =================================================================== --- trunk/core/doc/user_guide/JSBML_Acknowledgments.tex 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/doc/user_guide/JSBML_Acknowledgments.tex 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,10 +1,18 @@ % -*- TeX-master: "User_guide"; fill-column: 75 -*- The development and support of JSBML is a substantial undertaking and many -people have put in time and effort on this project. The authors especially -thank the following individuals for their many contributions to JSBML: -Meike Aichele, Sebastian Fr\"ohlich, Roland Keller, Sarah Rachel M\"uller -vom Hagen, Alexander Peltzer, and Simon Sch\"afer (in alphabetical order). +people have put in time and effort on this project. The authors especially +thank the following individuals for their many contributions to JSBML (in +alphabetical order): +\begin{itemize} + \item Students from the University of Tuebingen: Meike Aichele, Alexander + Diamantikos, Jakob Matthes, Sarah Rachel M\"uller vom Hagen, Eugen Netz, Jan + Rudolph, Alexander Peltzer, and Simon Sch\"afer + \item PhD students at the University of Tuebingen: Roland Keller and Johannes + Eichner. + \item Students from the Leibnitz Institute for Plant Culture (IKP): Sebastian + Fr\"ohlich. +\end{itemize} The development of JSBML is currently funded by the following organizations: @@ -16,7 +24,9 @@ \item The EMBL European Bioinformatics Institute (Germany and UK), and -\item The Federal Ministry of Education and Research (BMBF, Germany) via grant numbers 0315756 and 0315384C for the \emph{Virtual Liver Network} and the MedSys (Medical Systems Biology) project \emph{Spher4Sys}. +\item The Federal Ministry of Education and Research (BMBF, Germany) via +grant numbers 0315756 and 0315384C for the \emph{Virtual Liver Network} +and the MedSys (Medical Systems Biology) project \emph{Spher4Sys}. \end{itemize} Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -1216,9 +1216,8 @@ */ public void registerChild(SBase sbase) throws LevelVersionError { - if (sbase != null && sbase.getParent() != null) - { - logger.warn(MessageFormat.format("Trying to register an SBase, {0}, that is already associated with a Model !!", sbase)); + if ((sbase != null) && (sbase.getParent() != null)) { + logger.warn(MessageFormat.format("Trying to register an SBase, {0}, that is already associated with a Model!", sbase)); return; } @@ -1271,10 +1270,12 @@ if ((model != null) && !model.registerIds(this, sbase, recursively, false)) { // Something went wrong: We have to restore the previous state: - if (oldParent == null) { - ((AbstractSBase) sbase).setParentSBML(null); - } else if (oldParent instanceof SBase) { - ((AbstractSBase) sbase).setParentSBML((SBase) oldParent); + if (sbase instanceof AbstractSBase) { + if (oldParent == null) { + ((AbstractSBase) sbase).setParentSBML(null); + } else if (oldParent instanceof SBase) { + ((AbstractSBase) sbase).setParentSBML((SBase) oldParent); + } } sbase.addAllChangeListeners(listeners); Copied: trunk/core/src/org/sbml/jsbml/ext/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/ext/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/ext/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/ext/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,24 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * The base package for all SBML extensions. + */ +package org.sbml.jsbml.ext; Deleted: trunk/core/src/org/sbml/jsbml/ext/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/ext/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/ext/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1 +0,0 @@ -<body>The base package for all SBML extensions.</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,27 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Pure Java implementation of the data structures to represent all SBML + * constructs. + * </p> + */ +package org.sbml.jsbml; Deleted: trunk/core/src/org/sbml/jsbml/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,3 +0,0 @@ -<body> -<p>Pure Java implementation of the data structures to represent all SBML constructs.</p> -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/resources/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/resources/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/resources/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/resources/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,25 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * Contains classes to deal with and to manage non-Java resources, such as + * configuration files. + */ +package org.sbml.jsbml.resources; Deleted: trunk/core/src/org/sbml/jsbml/resources/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/resources/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/resources/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,4 +0,0 @@ -<body> - Contains classes to deal with and to manage non-Java resources, such as configuration - files. -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/text/parser/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/text/parser/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/text/parser/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/text/parser/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,28 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * Provides classes to parse formula + * Strings and to convert these into abstract syntax tree data structures. + * All these classes are generated automatically using JavaCC. The JSBML + * source code distribution contains the grammar specification necessary + * for this in the files folder (FormulaParser.jj). + */ +package org.sbml.jsbml.text.parser; Deleted: trunk/core/src/org/sbml/jsbml/text/parser/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/text/parser/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/text/parser/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,7 +0,0 @@ -<body> - Provides classes to parse formula - Strings and to convert these into abstract syntax tree data structures. - All these classes are generated automatically using JavaCC. The JSBML - source code distribution contains the grammar specification necessary - for this in the files folder (FormulaParser.jj). -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/util/compilers/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/util/compilers/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/util/compilers/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/util/compilers/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,25 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * The classes in this package can be used to evaluate the information + * represented by abstract syntax trees (ASTNode objects). + */ +package org.sbml.jsbml.util.compilers; Deleted: trunk/core/src/org/sbml/jsbml/util/compilers/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/util/compilers/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/util/compilers/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,4 +0,0 @@ -<body> - The classes in this package can be used to evaluate the information - represented by abstract syntax trees (ASTNode objects). -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/util/filters/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/util/filters/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/util/filters/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/util/filters/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,26 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * Filter are useful to decide whether or not to accept a certain item. + * All classes in this package implement the interface Filter that can + * be used to, e.g., select entries from a {@link ListOf} object. + */ +package org.sbml.jsbml.util.filters; Deleted: trunk/core/src/org/sbml/jsbml/util/filters/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/util/filters/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/util/filters/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,5 +0,0 @@ -<body> - Filter are useful to decide whether or not to accept a certain item. - All classes in this package implement the interface Filter that can - be used to, e.g., select entries from a ListOf object. -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/util/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/util/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/util/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/util/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,25 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * A collection of handy utilities when working with JSBML classes, + * such as classes for String manipulation or mathematical operations. + */ +package org.sbml.jsbml.util; Deleted: trunk/core/src/org/sbml/jsbml/util/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/util/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/util/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,4 +0,0 @@ -<body> - A collection of handy utilities when working with JSBML classes, - such as classes for String manipulation or mathematical operations. -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/validator/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/validator/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/validator/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/validator/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,27 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * This package provides methods to validate the content of SBML models, whether + * given in a file or as a data structure. + * </p> + */ +package org.sbml.jsbml.validator; Deleted: trunk/core/src/org/sbml/jsbml/validator/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/validator/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/validator/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,6 +0,0 @@ -<body> - <p> - This package provides methods to validate the content of SBML models, whether - given in a file or as a data structure. - </p> -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/xml/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/xml/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/xml/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,28 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * This package provides classes and methods to deal with SBML in form of XML + * elements, i.e., here you can find parsers and writers for SBML and also + * elements to define XML nodes to be used for notes or annotations. + * </p> + */ +package org.sbml.jsbml.xml; Deleted: trunk/core/src/org/sbml/jsbml/xml/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,7 +0,0 @@ -<body> - <p> - This package provides classes and methods to deal with SBML in form of XML elements, - i.e., here you can find parsers and writers for SBML and also elements to define - XML nodes to be used for notes or annotations. - </p> -</body> \ No newline at end of file Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/RDFAnnotationParser.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/RDFAnnotationParser.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/RDFAnnotationParser.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -20,6 +20,7 @@ package org.sbml.jsbml.xml.parsers; +import java.text.MessageFormat; import java.util.HashMap; import org.apache.log4j.Logger; @@ -187,7 +188,7 @@ Model model = sbmlDocument.getModel(); if (!model.hasValidAnnotation()){ - logger.warn(String.format("The model element with metaid = '%s' has an invalid rdf:about = '%s' inside his annotation.", model.getMetaId(), model.getAnnotation().getAbout())); + logger.warn(MessageFormat.format("The model element with metaid = \"{0}\" has an invalid rdf:about = \"{1}\" inside his annotation.", model.getMetaId(), model.getAnnotation().getAbout())); setRDFAbout(model); } Modified: trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/SBMLCoreParser.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -20,6 +20,7 @@ package org.sbml.jsbml.xml.parsers; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -109,11 +110,8 @@ sbmlCoreElements); } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.xml.WritingParser#getListOfSBMLElementsToWrite(Object - * sbase) + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.WritingParser#getListOfSBMLElementsToWrite(Object sbase) */ @SuppressWarnings("unchecked") public List<Object> getListOfSBMLElementsToWrite(Object sbase) { @@ -354,8 +352,9 @@ } if (!isAttributeRead) { - log4jLogger.warn(String.format( - "Could not recognize the attribute '%s' on the element %s. Please check the SBML specifications.", + // TODO: Here we should add a hint which SBML Level/Version combination is used. + log4jLogger.warn(MessageFormat.format( + "Could not recognize the attribute \"{0}\" on the element {1}. Please check the specification for SBML.", // Level {2,number,integer} Version {3,number,integer} attributeName, elementName)); // Log the error to the ErrorLog object ?? } @@ -374,23 +373,20 @@ // TODO : we have to check if we are in the context of a Notes or an Annotation - if (elementName != null && elementName.equals("notes")) { + if ((elementName != null) && elementName.equals("notes")) { - } else if (characters != null && characters.trim().length() != 0) { + } else if ((characters != null) && (characters.trim().length() != 0)) { // log4jLogger.warn("The SBML core XML element should not have any content, everything should be stored as attribute."); // log4jLogger.warn("The Characters are : @" + characters.trim() + "@"); } } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.xml.ReadingParser#processEndDocument(SBMLDocument - * sbmlDocument) + /* (non-Javadoc) + * @see org.sbml.jsbml.xml.ReadingParser#processEndDocument(SBMLDocument sbmlDocument) */ public void processEndDocument(SBMLDocument sbmlDocument) { - log4jLogger.debug("SBMLCoreParser : processEndDocument"); + log4jLogger.debug("SBMLCoreParser: processEndDocument"); if (sbmlDocument.isSetModel()) { Model model = sbmlDocument.getModel(); Copied: trunk/core/src/org/sbml/jsbml/xml/parsers/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/xml/parsers/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,28 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Contains classes that implement {@link org.sbml.jsbml.xml.parsers.ReadingParser} + * and/or {@link org.sbml.jsbml.xml.parsers.WritingParser} to read or write some + * specific parts of an SBML file. + * </p> + */ +package org.sbml.jsbml.xml.parsers; Deleted: trunk/core/src/org/sbml/jsbml/xml/parsers/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/parsers/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/parsers/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,5 +0,0 @@ -<body> - -<p>Contains classes that implement <a href="ReadingParser.html">ReaderParser</a> and/or <a href="WritingParser.html">WritingParser</a> to read or write some specific parts of an SBML file.</p> - -</body> \ No newline at end of file Modified: trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Stack; @@ -943,14 +944,14 @@ { parser = initializedParsers.get("anyAnnotation"); } - else if (annotationDeepness > 0 && elementNamespace.startsWith("http://www.sbml.org/sbml/level")) + else if ((annotationDeepness > 0) && elementNamespace.startsWith("http://www.sbml.org/sbml/level")) { // This is probably a mistake in the annotation // Sending it to the any parser parser = initializedParsers.get("anyAnnotation"); } - if (annotationDeepness > 0 && elementNamespace.equals(JSBML.URI_XHTML_DEFINITION)) { + if ((annotationDeepness > 0) && elementNamespace.equals(JSBML.URI_XHTML_DEFINITION)) { parser = initializedParsers.get("anyAnnotation"); } @@ -1078,11 +1079,11 @@ { attributeParser = initializedParsers.get("anyAnnotation"); } - else if (annotationDeepness > 0 && attributeNamespaceURI.equals(JSBML.URI_XHTML_DEFINITION)) + else if ((annotationDeepness > 0) && attributeNamespaceURI.equals(JSBML.URI_XHTML_DEFINITION)) { attributeParser = initializedParsers.get("anyAnnotation"); } - else if (annotationDeepness > 0 && attributeNamespaceURI.startsWith("http://www.sbml.org/sbml/level")) + else if ((annotationDeepness > 0) && attributeNamespaceURI.startsWith("http://www.sbml.org/sbml/level")) { // This is probably a mistake in the annotation // Sending it to the any parser @@ -1217,7 +1218,7 @@ SBMLDocument sbmlDocument = (SBMLDocument) sbmlElements.peek(); Iterator<Entry<String, ReadingParser>> iterator = initializedParsers.entrySet().iterator(); - ArrayList<String> readingParserClasses = new ArrayList<String>(); + List<String> readingParserClasses = new ArrayList<String>(); // Calling endDocument for all parsers while (iterator.hasNext()) { @@ -1247,9 +1248,9 @@ // SBMLDocument instance. // Otherwise, there is a syntax error in the // SBML document - logger.warn("!!! event.isEndElement : there is a problem in your SBML file !!!!"); + logger.warn("!!! event.isEndElement: there is a problem in your SBML file !!!!"); logger.warn("Found an element '" + sbmlElements.peek().getClass().getCanonicalName() + - "', expected org.sbml.jsbml.SBMLDocument"); + "', expected " + SBMLDocument.class.getCanonicalName()); } } } else { Copied: trunk/core/src/org/sbml/jsbml/xml/stax/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/xml/stax/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/xml/stax/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,28 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Contains classes that use the <a + * href="http://jcp.org/en/jsr/detail%3Fid=173">Streaming API for XML (StAX)</a> + * to read or write an SBML file. + * </p> + */ +package org.sbml.jsbml.xml.stax; Deleted: trunk/core/src/org/sbml/jsbml/xml/stax/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/stax/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/stax/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,5 +0,0 @@ -<body> - -<p>Contains classes that use the <a href="http://jcp.org/en/jsr/detail%3Fid=173">Streaming API for XML (StAX)</a> to read or write an SBML file.</p> - -</body> \ No newline at end of file Copied: trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package-info.java (from rev 1350, trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package.html) =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package-info.java (rev 0) +++ trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,31 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Contains classes that uses the <a + * href="http://xstream.codehaus.org/">XStream</a> to read or write XML. + * </p> + * <p> + * It is currently use only to parse the result of the libSBML validation + * process but might be use in future release to parse SBML + * </p> + */ +package org.sbml.jsbml.xml.xstream.converter; Deleted: trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package.html =================================================================== --- trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/core/src/org/sbml/jsbml/xml/xstream/converter/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,5 +0,0 @@ -<body> - <p>Contains classes that uses the <a href="http://xstream.codehaus.org/">XStream</a> to read or write XML.</p> - - <p>It is currently use only to parse the result of the libsbml validation process but might be use in future release to parse SBML</p> -</body> \ No newline at end of file Copied: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package-info.java (from rev 1350, trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package.html) =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package-info.java (rev 0) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,24 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * + */ +package org.sbml.jsbml.ext.fba; Deleted: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package.html =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,2 +0,0 @@ -<body> -</body> \ No newline at end of file Copied: trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package-info.java (from rev 1350, trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package.html) =================================================================== --- trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package-info.java (rev 0) +++ trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,32 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Provides classes for the <a + * href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Groups">Groups + * package</a>. + * </p> + * <p> + * The current version of the package follow the <a href= + * "http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Groups_Proposal_(2009-10)" + * >proposal by M. Hucka</a> + */ +package org.sbml.jsbml.ext.groups; Deleted: trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package.html =================================================================== --- trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,6 +0,0 @@ -<body> -<p>Provides classes for the <a href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Groups">Groups package</a>.</p> - -<p>The current version of the package follow the <a href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Groups_Proposal_(2009-10)">proposal by M. Hucka</a> - -</body> \ No newline at end of file Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Dimensions.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -303,4 +303,13 @@ return attributes; } + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + return super.toString() + " [depth=" + depth + ", height=" + height + ", width=" + + width + ']'; + } + } Copied: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java (from rev 1350, trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package.html) =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java (rev 0) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,34 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Provides classes for the <a + * href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Layout">Layout + * package</a>. + * </p> + * <p> + * There is no formal SBML level 3 proposal but the classes implemented are + * derived from the <a + * href="http://otto.bioquant.uni-heidelberg.de/sbml/">Layout proposal by Gauges + * et al.</a> as an annotation in SBMl level 2 + * </p> + */ +package org.sbml.jsbml.ext.layout; Deleted: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package.html =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,6 +0,0 @@ -<body> -<p>Provides classes for the - <a href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Layout">Layout package</a>.</p> - - <p>There is no formal SBML level 3 proposal but the classes implemented are derived from the <a href="http://otto.bioquant.uni-heidelberg.de/sbml/">Layout proposal by Gauges et al.</a> as an annotation in SBMl level 2</p> -</body> \ No newline at end of file Modified: trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/layout/src/org/sbml/jsbml/xml/parsers/L3LayoutParser.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -308,7 +308,6 @@ } if (newElement != null) { - listOf.registerChild(newElement); listOf.add(newElement); } Copied: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package-info.java (from rev 1350, trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package.html) =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package-info.java (rev 0) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,33 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Provides classes for the <a href= + * "http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Multistate_and_Multicomponent_Species" + * >Multi package</a>. + * </p> + * <p> + * The current version implemented follow the <a href= + * "http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Multistate_and_Multicomponent_Species_Proposal" + * > proposal by Nicolas Le Novère and Anika Oellrich</a>. There is only few + * classes from the proposal and it need to be completed. + */ +package org.sbml.jsbml.ext.multi; Deleted: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package.html =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,7 +0,0 @@ -<body> -<p>Provides classes for the <a href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Multistate_and_Multicomponent_Species">Multi package</a>.</p> - -<p>The current version implemented follow the <a href="http://sbml.org/Community/Wiki/SBML_Level_3_Proposals/Multistate_and_Multicomponent_Species_Proposal"> -proposal by Nicolas Le Novère and Anika Oellrich</a>. There is only few classes from the proposal and it need to be completed. - -</body> \ No newline at end of file Copied: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package-info.java (from rev 1350, trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package.html) =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package-info.java (rev 0) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,24 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * This package supports qualitative models for SBML Level 3. + */ +package org.sbml.jsbml.ext.qual; Deleted: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package.html =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,3 +0,0 @@ -<body> - This package supports qualitative models for SBML Level 3. -</body> \ No newline at end of file Copied: trunk/extensions/render/src/org/sbml/jsbml/ext/render/package-info.java (from rev 1350, trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html) =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/package-info.java (rev 0) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,38 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * <p> + * Provides classes for the render package. + * </p> + * <p> + * The first version of this package was implemented as part of the software + * engineering class at the University of Tuebingen, Germany, in the summer + * semester 2012, supervised by Johannes Eichner and Andreas Dräger. + * </p> + * + * @author Alexander Diamantikos + * @author Jakob Matthes + * @author Eugen Netz + * @author Jan Rudolph + * @author Johannes Eichner + * @author Andreas Dräger + */ +package org.sbml.jsbml.ext.render; Deleted: trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/render/src/org/sbml/jsbml/ext/render/package.html 2012-07-23 15:55:09 UTC (rev 1351) @@ -1,6 +0,0 @@ -<body> -<p> -Provides classes for the render package - -</p> -</body> \ No newline at end of file Modified: trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java =================================================================== --- trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-07-06 03:38:59 UTC (rev 1350) +++ trunk/extensions/render/src/org/sbml/jsbml/xml/parsers/RenderParser.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -20,6 +20,7 @@ */ package org.sbml.jsbml.xml.parsers; +import org.apache.log4j.Logger; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.layout.BoundingBox; @@ -52,11 +53,11 @@ * @date 04.06.2012 */ public class RenderParser extends AbstractReaderWriter { - + /** * The logger for this RenderParser */ - //private Logger logger = Logger.getLogger(RenderParser.class); + private static final Logger logger = Logger.getLogger(RenderParser.class); /* (non-Javadoc) * @see org.sbml.jsbml.xml.parsers.AbstractReaderWriter#getShortLabel() @@ -81,7 +82,7 @@ @Override public Object processStartElement(String elementName, String prefix, boolean hasAttributes, boolean hasNamespaces, Object contextObject) { - System.out.println("logger called, " + prefix + " : " + elementName + " in context of: " + contextObject.toString()); + logger.debug("logger called, " + prefix + " : " + elementName + " in context of: " + contextObject.toString()); if (contextObject instanceof ExtendedLayoutModel) { ExtendedLayoutModel layoutModel = (ExtendedLayoutModel) contextObject; // TODO not sure if necessary to check if listOfLayouts != null Copied: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package-info.java (from rev 1350, trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package.html) =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package-info.java (rev 0) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package-info.java 2012-07-23 15:55:09 UTC (rev 1351) @@ -0,0 +1,24 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ + +/** + * All classes required to reflect the spatial extension of SBML. + */ +package org.sbml.jsbml.ext.spatial; Deleted: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package.html =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/package.html 2012-07-06 03:38:5... [truncated message content] |
From: <and...@us...> - 2012-07-28 07:12:14
|
Revision: 1355 http://jsbml.svn.sourceforge.net/jsbml/?rev=1355&view=rev Author: andreas-draeger Date: 2012-07-28 07:12:07 +0000 (Sat, 28 Jul 2012) Log Message: ----------- Implemented convenience methods for the creation of curves etc., implemented missing constructors and equals/hashCode methods. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint1.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint2.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseReferenceFilter.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Start.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java Modified: trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -211,7 +211,7 @@ if (equals) { NamedSBase nsb = (NamedSBase) object; equals &= nsb.isSetId() == isSetId(); - if (nsb.isSetId() && isSetId()) { + if (equals && isSetId()) { equals &= nsb.getId().equals(getId()); } equals &= nsb.isSetName() == isSetName(); Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint1.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint1.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint1.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -34,16 +34,26 @@ */ private static final long serialVersionUID = -7544027003069685943L; + /** + * + */ public BasePoint1() { - super(); + super(); } + /** + * + * @param point + */ public BasePoint1(Point point) { super(point); clonePointAttributes(point, this); } -@Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.layout.Point#clone() + */ + @Override public BasePoint1 clone() { return new BasePoint1(this); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint2.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint2.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BasePoint2.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -34,18 +34,28 @@ */ private static final long serialVersionUID = -7781069728939292255L; + /** + * + */ public BasePoint2() { - super(); + super(); } + /** + * + * @param point + */ public BasePoint2(Point point) { super(point); clonePointAttributes(point, this); } -@Override + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.layout.Point#clone() + */ + @Override public BasePoint2 clone() { - return new BasePoint2(this); + return new BasePoint2(this); } } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -73,9 +73,7 @@ } } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#clone() */ @Override @@ -83,8 +81,7 @@ return new BoundingBox(this); } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) */ @Override @@ -111,8 +108,7 @@ return equals; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) */ @Override @@ -142,8 +138,7 @@ index, +((int) Math.min(pos, 0)))); } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @Override @@ -175,8 +170,7 @@ return position; } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#hashCode() */ @Override @@ -241,7 +235,9 @@ } } - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() + */ @Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -48,7 +48,7 @@ * */ public CubicBezier() { - + super(); } /** @@ -57,10 +57,10 @@ public CubicBezier(CubicBezier cubicBezier) { super(cubicBezier); if (cubicBezier.isSetBasePoint1()) { - basePoint1 = cubicBezier.getBasePoint1(); + this.basePoint1 = cubicBezier.getBasePoint1(); } if (cubicBezier.isSetBasePoint2()) { - basePoint2 = cubicBezier.getBasePoint2(); + this.basePoint2 = cubicBezier.getBasePoint2(); } } @@ -73,8 +73,7 @@ super(level, version); } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.LineSegment#clone() */ @Override @@ -83,13 +82,89 @@ } /** + * Creates, sets and returns a {@link Point} + * + * @return new {@link Point} object. + */ + public Point createBasePoint1() { + Point p = new BasePoint1(); + setBasePoint1(p); + return p; + } + + /** + * Creates, sets and returns a {@link Point} based on the + * given values. + * @param x + * @param y + * @param z + * @return new {@link Point} object. + */ + public Point createBasePoint1(double x, double y, double z) { + Point p = new BasePoint1(); + p.setX(x); + p.setY(y); + p.setZ(z); + setBasePoint1(p); + return p; + } + + /** + * Creates, sets and returns a {@link Point} + * + * @return new {@link Point} object. + */ + public Point createBasePoint2() { + Point p = new BasePoint2(); + setBasePoint2(p); + return p; + } + + /** + * Creates, sets and returns a {@link Point} based on the + * given values. + * @param x + * @param y + * @param z + * @return new {@link Point} object. + */ + public Point createBasePoint2(double x, double y, double z) { + Point p = new BasePoint2(); + p.setX(x); + p.setY(y); + p.setZ(z); + setBasePoint2(p); + return p; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + CubicBezier cb = (CubicBezier) object; + equals &= cb.isSetBasePoint1() == isSetBasePoint1(); + if (equals && isSetBasePoint1()) { + equals &= cb.getBasePoint1().equals(getBasePoint1()); + } + equals &= cb.isSetBasePoint2() == isSetBasePoint2(); + if (equals && cb.isSetBasePoint2()) { + equals &= cb.getBasePoint2().equals(getBasePoint2()); + } + } + return equals; + } + + /** * * @return */ public Point getBasePoint1() { return basePoint1; } - + /** * * @return @@ -97,9 +172,8 @@ public Point getBasePoint2() { return basePoint2; } - - /* - * (non-Javadoc) + + /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.LineSegment#getChildAt(int) */ @Override @@ -129,8 +203,7 @@ index, +((int) Math.min(pos, 0)))); } - /* - * (non-Javadoc) + /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.LineSegment#getChildCount() */ @Override @@ -144,6 +217,22 @@ } return count; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 919; + int hashCode = super.hashCode(); + if (isSetBasePoint1()) { + hashCode += prime * getBasePoint1().hashCode(); + } + if (isSetBasePoint2()) { + hashCode += prime * getBasePoint2().hashCode(); + } + return hashCode; + } /** * @return @@ -151,14 +240,14 @@ public boolean isSetBasePoint1() { return basePoint1 != null; } - + /** * @return */ public boolean isSetBasePoint2() { return basePoint2 != null; } - + /** * * @param basePoint1 @@ -192,62 +281,5 @@ this.basePoint2 = basePoint2; registerChild(this.basePoint2); } - - /** - * Creates, sets and returns a {@link Point} - * - * @return new {@link Point} object. - */ - public Point createBasePoint1() { - Point p = new BasePoint1(); - setBasePoint1(p); - return p; - } - /** - * Creates, sets and returns a {@link Point} based on the - * given values. - * @param x - * @param y - * @param z - * @return new {@link Point} object. - */ - public Point createBasePoint1(double x, double y, double z) { - Point p = new BasePoint1(); - p.setX(x); - p.setY(y); - p.setZ(z); - setBasePoint1(p); - return p; - } - - /** - * Creates, sets and returns a {@link Point} - * - * @return new {@link Point} object. - */ - public Point createBasePoint2() { - Point p = new BasePoint2(); - setBasePoint2(p); - return p; - } - - /** - * Creates, sets and returns a {@link Point} based on the - * given values. - * @param x - * @param y - * @param z - * @return new {@link Point} object. - */ - public Point createBasePoint2(double x, double y, double z) { - Point p = new BasePoint2(); - p.setX(x); - p.setY(y); - p.setZ(z); - setBasePoint2(p); - return p; - } - - } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -40,12 +40,21 @@ * Generated serial version identifier. */ private static final long serialVersionUID = -5435135643993920570L; + /** * */ ListOf<CurveSegment> listOfCurveSegments = new ListOf<CurveSegment>(); /** + * + */ + public Curve() { + super(); + initDefaults(); + } + + /** * @param curve * */ @@ -58,19 +67,23 @@ /** * + * @param level + * @param version */ - public Curve() { - super(); - addNamespace(LayoutConstants.namespaceURI); - - listOfCurveSegments.addNamespace(LayoutConstants.namespaceURI); - listOfCurveSegments.setSBaseListType(ListOf.Type.other); - registerChild(listOfCurveSegments); + public Curve(int level, int version) { + super(level, version); + initDefaults(); } + + /** + * + * @param curveSegment + */ + public boolean addCurveSegment(CurveSegment curveSegment) { + return getListOfCurveSegments().add(curveSegment); + } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#clone() */ @Override @@ -78,8 +91,33 @@ return new Curve(this); } - /* - * (non-Javadoc) + /** + * + * @return + */ + public CurveSegment createCurveSegment() { + CurveSegment cs = new CurveSegment(getLevel(), getVersion()); + addCurveSegment(cs); + return cs; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + Curve curve = (Curve) object; + equals &= curve.isSetListOfCurveSegments() == isSetListOfCurveSegments(); + if (equals && isSetListOfCurveSegments()) { + equals &= curve.getListOfCurveSegments().equals(getListOfCurveSegments()); + } + } + return equals; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) */ @Override @@ -102,9 +140,8 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - - /* - * (non-Javadoc) + + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @Override @@ -115,7 +152,7 @@ } return count; } - + /** * * @return @@ -125,12 +162,35 @@ } /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 929; + int hashCode = super.hashCode(); + if (isSetListOfCurveSegments()) { + hashCode += prime * getListOfCurveSegments().hashCode(); + } + return hashCode; + } + + /** + * + */ + private void initDefaults() { + addNamespace(LayoutConstants.namespaceURI); + listOfCurveSegments.addNamespace(LayoutConstants.namespaceURI); + listOfCurveSegments.setSBaseListType(ListOf.Type.other); + registerChild(listOfCurveSegments); + } + + /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ public boolean isIdMandatory() { return false; } - + /** * * @return @@ -138,8 +198,8 @@ public boolean isSetListOfCurveSegments() { return (listOfCurveSegments != null) && (listOfCurveSegments.size() > 0); } - - /** + + /** * * @param listOfCurveSegments */ @@ -169,4 +229,5 @@ } return false; } + } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CurveSegment.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -39,42 +39,50 @@ /** * */ - private String type; + private Logger logger = Logger.getLogger(CurveSegment.class); /** * */ - private Logger logger = Logger.getLogger(CurveSegment.class); + private String type; /** * */ public CurveSegment() { super(); - addNamespace(LayoutConstants.namespaceURI); + initDefaults(); } - /** + /** * - * @param lineSegment + * @param curveSegment */ - public CurveSegment(CurveSegment lineSegment) { - super(lineSegment); - if (lineSegment.isSetStart()) { - this.start = lineSegment.getStart().clone(); + public CurveSegment(CurveSegment curveSegment) { + super(curveSegment); + if (curveSegment.isSetStart()) { + this.start = curveSegment.getStart().clone(); } - if (lineSegment.isSetEnd()) { - this.end = lineSegment.getEnd().clone(); + if (curveSegment.isSetEnd()) { + this.end = curveSegment.getEnd().clone(); } - if (lineSegment.isSetType()) { - this.type = lineSegment.getType(); + if (curveSegment.isSetType()) { + this.type = curveSegment.getType(); } - // TODO : basePoint1 and basePoint2 + // Note: basePoints 1 & 2 are already copied in super. } - /* - * (non-Javadoc) + /** * + * @param level + * @param version + */ + public CurveSegment(int level, int version) { + super(level, version); + initDefaults(); + } + + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#clone() */ @Override @@ -82,6 +90,21 @@ return new CurveSegment(this); } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + CurveSegment curveSegment = (CurveSegment) object; + equals &= curveSegment.isSetType() == isSetType(); + if (equals && isSetType()) { + equals &= curveSegment.getType().equals(getType()); + } + } + return equals; + } /** * @@ -91,21 +114,31 @@ return type; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 937; + int hashCode = super.hashCode(); + if (isSetType()) { + hashCode += prime * getType().hashCode(); + } + return hashCode; + } + + /** * - * @param type */ - public void setType(String type) { - String oldType = this.type; - this.type = type; - firePropertyChange(TreeNodeChangeEvent.type, oldType, this.type); - } + private void initDefaults() { + addNamespace(LayoutConstants.namespaceURI); + } - /* - * (non-Javadoc) - * + /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ + @Override public boolean isIdMandatory() { return false; } @@ -118,11 +151,8 @@ return type != null; } - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.AbstractMathContainer#readAttribute(java.lang.String, - * java.lang.String, java.lang.String) + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractMathContainer#readAttribute(java.lang.String, java.lang.String, java.lang.String) */ @Override public boolean readAttribute(String attributeName, String prefix, @@ -142,8 +172,17 @@ return isAttributeRead; } - /* - * (non-Javadoc) + /** + * + * @param type + */ + public void setType(String type) { + String oldType = this.type; + this.type = type; + firePropertyChange(TreeNodeChangeEvent.type, oldType, this.type); + } + + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#writeXMLAttributes() */ @Override Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -62,7 +62,7 @@ super(graphicalObject); setBoundingBox(graphicalObject.getBoundingBox()); } - + /** * * @param level @@ -72,15 +72,16 @@ super(level, version); addNamespace(LayoutConstants.namespaceURI); } - - /** + + /** * @param id */ public GraphicalObject(String id) { super(id); addNamespace(LayoutConstants.namespaceURI); } - + + /** * * @param id @@ -91,7 +92,7 @@ super(id, level, version); addNamespace(LayoutConstants.namespaceURI); } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#clone() */ @@ -99,7 +100,7 @@ public GraphicalObject clone() { return new GraphicalObject(this); } - + /** * Creates and sets a {@link BoundingBox} for this object. * @return {@link BoundingBox}. @@ -109,7 +110,7 @@ setBoundingBox(bb); return bb; } - + /** * * @param dimensions @@ -134,7 +135,7 @@ bb.createDimensions(width, height, depth); return bb; } - + /** * Creates and sets a {@link BoundingBox} for this object, with the * given parameters for {@link Dimensions} and {@link Point}. @@ -152,8 +153,24 @@ bb.createPosition(x, y, z); return bb; } - + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + GraphicalObject graphicalObject = (GraphicalObject) object; + equals &= graphicalObject.isSetBoundingBox() == isSetBoundingBox(); + if (equals && isSetBoundingBox()) { + equals &= graphicalObject.getBoundingBox().equals(getBoundingBox()); + } + } + return equals; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getAllowsChildren() */ @Override @@ -192,7 +209,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @@ -206,6 +223,19 @@ } /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 941; + int hashCode = super.hashCode(); + if (isSetBoundingBox()) { + hashCode += prime * getBoundingBox().hashCode(); + } + return hashCode; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ public boolean isIdMandatory() { Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -401,6 +401,38 @@ return glyph; } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + Layout layout = (Layout) object; + equals &= layout.isSetDimensions() == isSetDimensions(); + if (equals && isSetDimensions()) { + equals &= layout.getDimensions().equals(getDimensions()); + } + equals &= layout.isSetListOfAdditionalGraphicalObjects() == isSetListOfAdditionalGraphicalObjects(); + if (equals && isSetListOfAdditionalGraphicalObjects()) { + equals &= layout.getListOfAdditionalGraphicalObjects().equals(getListOfAdditionalGraphicalObjects()); + } + if (equals && isSetListOfCompartmentGlyphs()) { + equals &= layout.getListOfCompartmentGlyphs().equals(getListOfCompartmentGlyphs()); + } + if (equals && isSetListOfReactionGlyphs()) { + equals &= layout.getListOfReactionGlyphs().equals(getListOfReactionGlyphs()); + } + if (equals && isSetListOfSpeciesGlyphs()) { + equals &= layout.getListOfSpeciesGlyphs().equals(getListOfSpeciesGlyphs()); + } + if (equals && isSetListOfTextGlyphs()) { + equals &= layout.getListOfTextGlyphs().equals(getListOfTextGlyphs()); + } + } + return equals; + } + /** * Searches all instances of {@link CompartmentGlyph} within this {@link Layout} that * refer to the {@link Compartment} with the given id. @@ -428,7 +460,7 @@ } return new ArrayList<T>(0); } - + /** * Searches all instances of {@link ReactionGlyph} within this {@link Layout} that * refer to the {@link Reaction} with the given id. @@ -440,7 +472,7 @@ public List<ReactionGlyph> findReactionGlyphs(String reactionID) { return findGlyphs(listOfReactionGlyphs, reactionID); } - + /** * Searches all instances of {@link SpeciesGlyph} within this {@link Layout} that * refer to the {@link Species} with the given id. @@ -452,7 +484,7 @@ public List<SpeciesGlyph> findSpeciesGlyphs(String speciesID) { return findGlyphs(listOfSpeciesGlyphs, speciesID); } - + /** * Searches within the {@link #listOfTextGlyphs} for {@link TextGlyph}s whose * {@link TextGlyph#getOriginOfText()} points to the given id. @@ -465,7 +497,7 @@ public List<TextGlyph> findTextGlyphs(String id) { return findGlyphs(listOfTextGlyphs, id); } - + /** * * @param i @@ -478,7 +510,7 @@ } return null; } - + /** * * @return @@ -486,7 +518,7 @@ public int getAdditionalGraphicalObjectCount() { return isSetListOfAdditionalGraphicalObjects() ? listOfAdditionalGraphicalObjects.size() : 0; } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) */ @@ -539,7 +571,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @@ -566,7 +598,7 @@ } return count; } - + /** * * @param i @@ -575,7 +607,7 @@ public CompartmentGlyph getCompartmentGlyph(int i) { return getListOfCompartmentGlyphs().get(i); } - + /** * * @param id @@ -603,8 +635,7 @@ public Dimensions getDimensions() { return dimensions; } - - + /** * * @return @@ -616,7 +647,8 @@ } return listOfAdditionalGraphicalObjects; } - + + /** * * @return @@ -628,7 +660,7 @@ } return listOfCompartmentGlyphs; } - + /** * * @return @@ -685,7 +717,7 @@ } return null; } - + /** * * @return @@ -714,7 +746,7 @@ } return null; } - + /** * * @return @@ -722,7 +754,7 @@ public int getSpeciesGlyphCount() { return isSetListOfSpeciesGlyphs() ? listOfSpeciesGlyphs.size() : 0; } - + /** * * @param i @@ -731,7 +763,7 @@ public TextGlyph getTextGlyph(int i) { return getListOfTextGlyphs().get(i); } - + /** * * @param id @@ -743,7 +775,7 @@ } return null; } - + /** * * @return @@ -751,6 +783,34 @@ public int getTextGlyphCount() { return isSetListOfTextGlyphs() ? listOfTextGlyphs.size() : 0; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 947; + int hashCode = super.hashCode(); + if (isSetDimensions()) { + hashCode += prime * getDimensions().hashCode(); + } + if (isSetListOfAdditionalGraphicalObjects()) { + hashCode += prime * getListOfAdditionalGraphicalObjects().hashCode(); + } + if (isSetListOfCompartmentGlyphs()) { + hashCode += prime * getListOfCompartmentGlyphs().hashCode(); + } + if (isSetListOfReactionGlyphs()) { + hashCode += prime * getListOfReactionGlyphs().hashCode(); + } + if (isSetListOfSpeciesGlyphs()) { + hashCode += prime * getListOfSpeciesGlyphs().hashCode(); + } + if (isSetListOfTextGlyphs()) { + hashCode += prime * getListOfTextGlyphs().hashCode(); + } + return hashCode; + } /** * Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -50,7 +50,7 @@ * */ public LineSegment() { - + super(); } /** @@ -83,7 +83,83 @@ return new LineSegment(this); } + /** + * Creates, sets and returns a {@link Point} + * + * @return new {@link Point} object. + */ + public Point createEnd() { + Point p = new End(); + setStart(p); + return p; + } + + /** + * Creates, sets and returns a {@link Point} based on the + * given values. + * @param x + * @param y + * @param z + * @return new {@link Point} object. + */ + public Point createEnd(double x, double y, double z) { + Point p = new End(); + p.setX(x); + p.setY(y); + p.setZ(z); + setEnd(p); + return p; + } + + /** + * Creates, sets and returns a {@link Point} + * + * @return new {@link Point} object. + */ + public Point createStart() { + Point p = new Start(); + setStart(p); + return p; + } + + /** + * Creates, sets and returns a {@link Point} based on the + * given values. + * @param x + * @param y + * @param z + * @return new {@link Point} object. + */ + public Point createStart(double x, double y, double z) { + Point p = new Start(); + p.setX(x); + p.setY(y); + p.setZ(z); + setStart(p); + return p; + } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + LineSegment lineSegment = (LineSegment) object; + equals &= lineSegment.isSetStart() == isSetStart(); + if (equals && isSetStart()) { + equals &= lineSegment.getStart().equals(getStart()); + } + equals &= lineSegment.isSetEnd() == isSetEnd(); + if (equals && lineSegment.isSetEnd()) { + equals &= lineSegment.getEnd().equals(getEnd()); + } + } + return equals; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildAt(int) */ @Override @@ -112,7 +188,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractSBase#getChildCount() */ @@ -127,7 +203,7 @@ } return count; } - + /** * * @return @@ -136,7 +212,7 @@ return end; } - /** + /** * * @return */ @@ -145,12 +221,29 @@ } /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 911; + int hashCode = super.hashCode(); + if (isSetStart()) { + hashCode += prime * getStart().hashCode(); + } + if (isSetEnd()) { + hashCode += prime * getEnd().hashCode(); + } + return hashCode; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.NamedSBase#isIdMandatory() */ public boolean isIdMandatory() { return false; } + /** * @return */ @@ -180,7 +273,7 @@ registerChild(this.end); } - /** + /** * * @param start */ @@ -195,62 +288,4 @@ registerChild(this.start); } - /** - * Creates, sets and returns a {@link Point} - * - * @return new {@link Point} object. - */ - public Point createStart() { - Point p = new Start(); - setStart(p); - return p; - } - - /** - * Creates, sets and returns a {@link Point} based on the - * given values. - * @param x - * @param y - * @param z - * @return new {@link Point} object. - */ - public Point createStart(double x, double y, double z) { - Point p = new Start(); - p.setX(x); - p.setY(y); - p.setZ(z); - setStart(p); - return p; - } - - - /** - * Creates, sets and returns a {@link Point} - * - * @return new {@link Point} object. - */ - public Point createEnd() { - Point p = new End(); - setStart(p); - return p; - - } - - /** - * Creates, sets and returns a {@link Point} based on the - * given values. - * @param x - * @param y - * @param z - * @return new {@link Point} object. - */ - public Point createEnd(double x, double y, double z) { - Point p = new End(); - p.setX(x); - p.setY(y); - p.setZ(z); - setEnd(p); - return p; - } - } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseReferenceFilter.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseReferenceFilter.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseReferenceFilter.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -21,7 +21,6 @@ package org.sbml.jsbml.ext.layout; import org.sbml.jsbml.NamedSBase; -import org.sbml.jsbml.SimpleSpeciesReference; import org.sbml.jsbml.util.filters.NameFilter; import org.sbml.jsbml.util.filters.SpeciesReferenceFilter; Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Position.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -33,15 +33,25 @@ */ private static final long serialVersionUID = 2969810879942863084L; + /** + * + */ public Position() { - super(); + super(); } + /** + * + * @param point + */ public Position(Point point) { super(point); clonePointAttributes(point, this); } + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.layout.Point#clone() + */ @Override public Position clone() { return new Position(this); Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -150,7 +150,27 @@ return glyph; } - /* (non-Javadoc) + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) + */ + @Override + public boolean equals(Object object) { + boolean equals = super.equals(object); + if (equals) { + ReactionGlyph reactionGlyph = (ReactionGlyph) object; + equals &= reactionGlyph.isSetCurve() == isSetCurve(); + if (equals && isSetCurve()) { + equals &= reactionGlyph.getCurve().equals(getCurve()); + } + equals &= reactionGlyph.isSetListOfSpeciesReferencesGlyph() == isSetListOfSpeciesReferencesGlyph(); + if (equals && isSetListOfSpeciesReferencesGlyph()) { + equals &= reactionGlyph.getListOfSpeciesReferenceGlyphs().equals(getListOfSpeciesReferenceGlyphs()); + } + } + return equals; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.GraphicalObject#getChildAt(int) */ @Override @@ -179,7 +199,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.GraphicalObject#getChildCount() */ @@ -194,7 +214,7 @@ } return count; } - + /** * * @return @@ -226,7 +246,7 @@ public String getReaction() { return getNamedSBase(); } - + /** * Note that the return type of this method is {@link NamedSBase} because it * could be possible to link some element from other packages to this glyph. @@ -237,6 +257,22 @@ return getNamedSBaseInstance(); } + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractSBase#hashCode() + */ + @Override + public int hashCode() { + final int prime = 953; + int hashCode = super.hashCode(); + if (isSetCurve()) { + hashCode += prime * getCurve().hashCode(); + } + if (isSetListOfSpeciesReferencesGlyph()) { + hashCode += prime * getListOfSpeciesReferenceGlyphs().hashCode(); + } + return hashCode; + } + /** * @return */ Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -115,6 +115,18 @@ return new SpeciesReferenceGlyph(this); } + /** + * + * @return + */ + public Curve createCurve() { + if (isSetCurve()) { + unsetCurve(); + } + setCurve(new Curve(getLevel(), getVersion())); + return getCurve(); + } + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#equals(java.lang.Object) */ @@ -159,7 +171,7 @@ throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, +((int) Math.min(pos, 0)))); } - + /* (non-Javadoc) * @see org.sbml.jsbml.ext.layout.GraphicalObject#getChildCount() */ @@ -172,7 +184,7 @@ return count; } - + /** * * @return @@ -188,8 +200,8 @@ public String getSpeciesGlyph() { return speciesGlyph; } - - /** + + /** * * @return */ @@ -200,7 +212,7 @@ Model model = getModel(); return (model != null) ? (SpeciesGlyph) model.findNamedSBase(getSpeciesGlyph()) : null; } - + /** * * @return @@ -209,7 +221,7 @@ return getNamedSBase(); } - /** + /** * Note that the return type of this method is {@link NamedSBase} because it * could be possible to link some element from other packages to this glyph. * @@ -218,14 +230,14 @@ public NamedSBase getSpeciesReferenceInstance() { return getNamedSBaseInstance(); } - - /** + + /** * @return */ public SpeciesReferenceRole getSpeciesReferenceRole() { return role; } - + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBase#hashCode() */ @@ -255,14 +267,14 @@ public boolean isSetSpeciesGlyph() { return speciesGlyph != null; } - + /** * @return */ public boolean isSetSpeciesReference() { return isSetNamedSBase(); } - + /** * @return */ @@ -320,7 +332,7 @@ firePropertyChange(LayoutConstants.curve, oldCurve, this.role); registerChild(this.curve); } - + /** * * @param valueOf @@ -348,7 +360,7 @@ public void setSpeciesReference(SimpleSpeciesReference speciesReference) { setSpeciesReference(speciesReference.getId()); } - + /** * * @param speciesReference @@ -356,6 +368,20 @@ public void setSpeciesReference(String speciesReference) { setNamedSBase(speciesReference, LayoutConstants.speciesReference); } + + /** + * + * @return + */ + public boolean unsetCurve() { + if (isSetCurve()) { + Curve oldCurve = getCurve(); + this.curve = null; + oldCurve.fireNodeRemovedEvent(); + return true; + } + return false; + } /** * Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Start.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Start.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Start.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -56,6 +56,4 @@ return new Start(this); } - - } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/TextGlyph.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -117,10 +117,6 @@ boolean equals = super.equals(object); if (equals) { TextGlyph t = (TextGlyph) object; - equals &= t.isSetOriginOfText() == isSetOriginOfText(); - if (equals && isSetOriginOfText()) { - equals &= t.getOriginOfText().equals(getOriginOfText()); - } equals &= t.isSetText() == isSetText(); if (equals && isSetText()) { equals &= t.getText().equals(getText()); @@ -172,9 +168,6 @@ public int hashCode() { final int prime = 967; int hashCode = super.hashCode(); - if (isSetOriginOfText()) { - hashCode += prime * getOriginOfText().hashCode(); - } if (isSetText()) { hashCode += prime * getText().hashCode(); } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java 2012-07-26 15:35:39 UTC (rev 1354) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/package-info.java 2012-07-28 07:12:07 UTC (rev 1355) @@ -30,5 +30,10 @@ * href="http://otto.bioquant.uni-heidelberg.de/sbml/">Layout proposal by Gauges * et al.</a> as an annotation in SBMl level 2 * </p> + * + * @author Nicolas Rodriguez + * @author Sebastian Fröhlich + * @author Andreas Dräger + * @author Clemens Wrzodek */ package org.sbml.jsbml.ext.layout; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-08-21 13:14:05
|
Revision: 1391 http://jsbml.svn.sourceforge.net/jsbml/?rev=1391&view=rev Author: andreas-draeger Date: 2012-08-21 13:13:51 +0000 (Tue, 21 Aug 2012) Log Message: ----------- Corrected a bug that has been introduced in the clone constructor of ASTNode and did some minor changes. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/ASTNode.java trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/Annotation.java trunk/core/src/org/sbml/jsbml/Constraint.java trunk/core/src/org/sbml/jsbml/Event.java trunk/core/src/org/sbml/jsbml/History.java trunk/core/src/org/sbml/jsbml/KineticLaw.java trunk/core/src/org/sbml/jsbml/Model.java trunk/core/src/org/sbml/jsbml/Reaction.java trunk/core/src/org/sbml/jsbml/SBMLDocument.java trunk/core/src/org/sbml/jsbml/SpeciesReference.java trunk/core/src/org/sbml/jsbml/Unit.java trunk/core/src/org/sbml/jsbml/UnitDefinition.java trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Bond.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/MultiModel.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Selector.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesType.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/Transition.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartment.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialParameter.java Modified: trunk/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1270,7 +1270,7 @@ this.numerator = astNode.numerator; this.unitId = astNode.unitId == null ? null : new String(astNode.unitId); - if (getChildCount() > 0) { + if (astNode.getChildCount() > 0) { for (ASTNode child : astNode.listOfNodes) { ASTNode c = child.clone(); c.parent = this; @@ -1617,8 +1617,8 @@ case DIVIDE: int childCount = getChildCount(); if (childCount != 2) { - throw new SBMLException(String.format( - "Fractions must have one numerator and one denominator, here %s elements are given.", + throw new SBMLException(MessageFormat.format( + "Fractions must have one numerator and one denominator, here {0,number,integer} elements are given.", childCount)); } value = compiler.frac(getLeftChild(), getRightChild()); @@ -1824,8 +1824,8 @@ // value = compiler.compile(variable); } } else { - logger.warn(String.format( - "ASTNode of type FUNCTION but the variable is null: (%s, %s)! Check that your object is linked to a Model.", + logger.warn(MessageFormat.format( + "ASTNode of type FUNCTION but the variable is null: ({0}, {1})! Check that your object is linked to a Model.", getName(), (getParentSBMLObject() != null ? getParentSBMLObject().getElementName() : null))); value = compiler.function(getName(), getChildren()); } Modified: trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/AbstractMathContainer.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -146,8 +146,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1214,10 +1214,10 @@ /* (non-Javadoc) * @see org.sbml.jsbml.SBase#registerChild(org.sbml.jsbml.SBase) */ - public void registerChild(SBase sbase) throws LevelVersionError - { - if ((sbase != null) && (sbase.getParent() != null)) { - logger.warn(MessageFormat.format("Trying to register an SBase, {0}, that is already associated with a Model!", sbase)); + public void registerChild(SBase sbase) throws LevelVersionError { + if ((sbase != null) && (sbase.getParent() != null) && (sbase.getParent() == this)) { + // The last check is required because the given SBase could originate from a different model or parent. + logger.warn(MessageFormat.format("Trying to register SBase {0}, that is already associated with this model!", sbase)); return; } Modified: trunk/core/src/org/sbml/jsbml/Annotation.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Annotation.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/Annotation.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.HashMap; import java.util.LinkedList; import java.util.List; @@ -459,8 +460,9 @@ // } // pos++; // } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - childIndex, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + childIndex, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/Constraint.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Constraint.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/Constraint.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,8 @@ package org.sbml.jsbml; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; import org.sbml.jsbml.util.StringTools; @@ -120,8 +122,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/Event.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Event.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/Event.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -374,8 +375,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/History.java =================================================================== --- trunk/core/src/org/sbml/jsbml/History.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/History.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.Calendar; import java.util.Date; import java.util.LinkedList; @@ -180,8 +181,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - childIndex, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + childIndex, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/KineticLaw.java =================================================================== --- trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -259,8 +259,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/Model.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Model.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/Model.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -555,7 +555,7 @@ } /** - * Adds an UnitDefinition instance to the listOfUnitDefinitions of this Model. + * Adds an {@link UnitDefinition} instance to the {@link #listOfUnitDefinitions} of this {@link Model}. * * @param unitDefinition * @return {@code true} if the {@link #listOfUnitDefinitions} was changed @@ -1845,8 +1845,8 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", index, - +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format("Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/Reaction.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Reaction.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/Reaction.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -503,8 +504,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/core/src/org/sbml/jsbml/SBMLDocument.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.io.PrintStream; +import java.text.MessageFormat; import java.util.Enumeration; import java.util.HashMap; import java.util.Iterator; @@ -44,7 +45,7 @@ * Represents the 'sbml' root node of a SBML file. * * @author Andreas Dräger - * @author marine + * @author Marine Dumousseau * @since 0.8 * @version $Rev$ */ @@ -380,11 +381,11 @@ */ private void checkMetaId(String metaId) { if (containsMetaId(metaId)) { - logger.error(String.format( - "An element with the metaid '%s' is already present in the SBML document. The new element will not get added to it.", + logger.error(MessageFormat.format( + "An element with the metaid \"{0}\" is already present in the SBML document. The new element will not get added to it.", metaId)); - throw new IllegalArgumentException(String.format( - "Cannot set duplicate meta identifier '%s'.", metaId)); + throw new IllegalArgumentException(MessageFormat.format( + "Cannot set duplicate meta identifier \"{0}\".", metaId)); } } @@ -397,7 +398,7 @@ /** * Collects all meta identifiers of this {@link AbstractSBase} and all of - * its sub-elements if recursively is <code>true</code>. + * its sub-elements if recursively is {@code true}. * * @param metaIds * the {@link Map} that gathers the result. @@ -406,10 +407,10 @@ * and from which we maybe have to recursively go through all * of its children. * @param recursively - * if <code>true</code>, this method will also consider all + * if {@code true}, this method will also consider all * sub-elements of this {@link AbstractSBase}. * @param delete - * if <code>true</code> this method will not check if + * if {@code true} this method will not check if * the meta identifier can be added to the {@link SBMLDocument}. * @throws IllegalArgumentException * However, duplications are not legal and an @@ -539,7 +540,7 @@ return getModel(); } } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", + throw new IndexOutOfBoundsException(MessageFormat.format("Index {0,number,integer} >= {1,number,integer}", index, +((int) Math.min(pos, 0)))); } @@ -754,17 +755,17 @@ * @param sbase * the element whose meta identifier is to be registered (if it is set). * @param add - * if <code>true</code> this will add the given meta identifier + * if {@code true} this will add the given meta identifier * to this {@link SBMLDocument}'s {@link #mappingFromMetaId2SBase}. * Otherwise, the given identifier will be removed from this set. * @return <ul> - * <li>if add is <code>true</code>, then this method returns - * <code>true</code> if this set did not already contain the specified - * element, <code>false</code> otherwise.</li> - * <li>if add is not <code>true</code>, this method returns - * <code>true</code> if this set contained the specified element, - * <code>false</code> otherwise.</li> - * <li>This method also returns <code>false</code> if the given + * <li>if add is {@code true}, then this method returns + * {@code true} if this set did not already contain the specified + * element, {@code false} otherwise.</li> + * <li>if add is not {@code true}, this method returns + * {@code true} if this set contained the specified element, + * {@code false} otherwise.</li> + * <li>This method also returns {@code false} if the given * {@link SBase} does not have a defined metaId</li> * </ul> * @throws IllegalArgumentException @@ -792,7 +793,7 @@ /** * Collects all meta identifiers of this {@link AbstractSBase} and all of - * its sub-elements if recursively is <code>true</code>. It can also be used + * its sub-elements if recursively is {@code true}. It can also be used * to delete meta identifiers from the given {@link Set}. * * @param sbase @@ -800,10 +801,10 @@ * and from which we maybe have to recursively go through all * of its children. * @param recursively - * if <code>true</code>, this method will also consider all + * if {@code true}, this method will also consider all * sub-elements of this {@link AbstractSBase}. * @param delete - * if <code>true</code> the purpose of this method will be to + * if {@code true} the purpose of this method will be to * delete the meta identifier from the given {@link Set}. * Otherwise, it will try to add it to the set. * @throws IllegalArgumentException @@ -834,12 +835,12 @@ * set of all possible checks that {@link SBMLDocument#checkConsistency()} knows * how to perform. This method may need to be called multiple times in * order to achieve the desired combination of checks. The first - * argument (<code>category</code>) in a call to this method indicates the category + * argument ({@code category}) in a call to this method indicates the category * of consistency/error checks that are to be turned on or off, and the - * second argument (<code>apply</code>, a boolean) indicates whether to turn it on - * (value of <code>true</code>) or off (value of <code>false</code>). + * second argument ({@code apply}, a boolean) indicates whether to turn it on + * (value of {@code true}) or off (value of {@code false}). * <p> - * * The possible categories (values to the argument <code>category</code>) are the + * * The possible categories (values to the argument {@code category}) are the * set of values from the {@link CHECK_CATEGORYH} enumeration. * The following are the possible choices: * <p> @@ -902,7 +903,7 @@ * consistency checking/validation to be turned on or off * <p> * @param apply a boolean indicating whether the checks indicated by - * <code>category</code> should be applied or not. + * {@code category} should be applied or not. * <p> * @see SBMLDocument#checkConsistency() */ @@ -1009,7 +1010,7 @@ * Sets the {@link Model} of this {@link SBMLDocument} to null and notifies * all {@link TreeNodeChangeListener} about changes. * - * @return <code>true</code> if calling this method changed the properties + * @return {@code true} if calling this method changed the properties * of this element. */ public boolean unsetModel() { Modified: trunk/core/src/org/sbml/jsbml/SpeciesReference.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SpeciesReference.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/SpeciesReference.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,7 @@ package org.sbml.jsbml; +import java.text.MessageFormat; import java.util.Locale; import java.util.Map; @@ -258,8 +259,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) @@ -416,17 +418,19 @@ return denominator != null; } - /** - * - * @return true if the stoichiometry of this SpeciesReference is not null. - */ + /** + * @return {@code true} if the stoichiometry of this {@link SpeciesReference} + * has been + * explicitly set, {@code false} if it is not set at all or only a + * default value is available. + */ public boolean isSetStoichiometry() { return isSetStoichiometry; } /** * - * @return true if the stoichiometryMath of this SpeciesReference is not + * @return true if the {@link StoichiometryMath} of this {@link SpeciesReference} is not * null. */ public boolean isSetStoichiometryMath() { Modified: trunk/core/src/org/sbml/jsbml/Unit.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Unit.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/Unit.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -561,7 +561,7 @@ * Creates a MIRIAM resource pointing to the entry in the unit ontology * corresponding to this {@link Kind}. If such an entry exists, this * method will return the {@link String} - * <code>urn:miriam:obo.unit:UO%3A</code> plus the number of the + * {@code urn:miriam:obo.unit:UO%3A} plus the number of the * resource filled to a seven-digit number by inserting leading zeros. * * @return null if no corresponding entry exists in the unit ontology, @@ -918,8 +918,8 @@ public static boolean isPredefined(String name, int level) { if (level < 3) { if ((level == 2) - && (name.equals(UnitDefinition.AREA) || name - .equals(UnitDefinition.LENGTH))) { + && (name.equals(UnitDefinition.AREA) || + name.equals(UnitDefinition.LENGTH))) { return true; } if (name.equals(UnitDefinition.SUBSTANCE) Modified: trunk/core/src/org/sbml/jsbml/UnitDefinition.java =================================================================== --- trunk/core/src/org/sbml/jsbml/UnitDefinition.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/UnitDefinition.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -266,8 +266,8 @@ kind = Kind.valueOf(id.toUpperCase()); } catch (IllegalArgumentException exc) { logger.warn(MessageFormat.format( - "No such unit kind {0} in SBML Level {1,number,integer} Version {1,number,integer}", id, - level, version)); + "No such unit kind {0} in SBML Level {1,number,integer} Version {2,number,integer}", + id, level, version)); return null; } u.setKind(kind); @@ -275,7 +275,7 @@ if ((level > 1) && (version > 1)) { String resource = u.getKind().getUnitOntologyResource(); if (resource != null) { - // metaid will be created upon nessesity. + // metaid will be created upon necessity. u.addCVTerm(new CVTerm(Qualifier.BQB_IS, resource)); } } Modified: trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -20,6 +20,7 @@ */ package org.sbml.jsbml.util; +import java.text.MessageFormat; import java.util.Arrays; import java.util.Collection; import java.util.Iterator; @@ -175,8 +176,9 @@ } } } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - childIndex, getChildCount())); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + childIndex, getChildCount())); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/BoundingBox.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -134,8 +135,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/CubicBezier.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,8 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; /** @@ -200,8 +202,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,8 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; import org.sbml.jsbml.AbstractNamedSBase; @@ -137,8 +139,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/GraphicalObject.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -206,8 +207,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; @@ -568,8 +569,9 @@ return getListOfAdditionalGraphicalObjects(); } } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/LineSegment.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,8 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; import org.sbml.jsbml.AbstractNamedSBase; @@ -185,8 +187,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; import java.util.Collection; import java.util.Map; @@ -196,8 +197,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/SpeciesReferenceGlyph.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.layout; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -168,8 +169,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Bond.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Bond.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Bond.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1,5 +1,6 @@ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -182,8 +183,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/MultiModel.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/MultiModel.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/MultiModel.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1,12 +1,12 @@ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.Model; import org.sbml.jsbml.SBase; import org.sbml.jsbml.ext.AbstractSBasePlugin; -import org.sbml.jsbml.ext.SBasePlugin; import org.sbml.jsbml.util.filters.NameFilter; /** @@ -20,6 +20,10 @@ public class MultiModel extends AbstractSBasePlugin { /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -2875299722787282885L; + /** * */ ListOf<SpeciesType> listOfSpeciesTypes; @@ -320,8 +324,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - childIndex, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + childIndex, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Selector.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Selector.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/Selector.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -449,8 +450,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesType.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesType.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesType.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1,5 +1,6 @@ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -44,6 +45,11 @@ public class SpeciesType extends org.sbml.jsbml.SpeciesType implements UniqueNamedSBase { /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -6077584873497214754L; + + /** * */ ListOf<StateFeature> listOfStateFeatures; @@ -224,8 +230,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/SpeciesTypeState.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1,5 +1,6 @@ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -466,8 +467,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeature.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1,5 +1,6 @@ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -182,8 +183,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java =================================================================== --- trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/StateFeatureInstance.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -1,5 +1,6 @@ package org.sbml.jsbml.ext.multi; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -191,8 +192,9 @@ pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.qual; +import java.text.MessageFormat; import java.util.Map; import org.sbml.jsbml.Compartment; @@ -120,8 +121,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - childIndex, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + childIndex, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/Transition.java =================================================================== --- trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/Transition.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/Transition.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,7 @@ */ package org.sbml.jsbml.ext.qual; +import java.text.MessageFormat; import java.util.Map; import javax.swing.tree.TreeNode; @@ -173,8 +174,9 @@ } pos++; } - throw new IndexOutOfBoundsException(String.format("Index %d >= %d", - index, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", + index, +((int) Math.min(pos, 0)))); } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,13 +19,15 @@ */ package org.sbml.jsbml.ext.spatial; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; import org.sbml.jsbml.Model; import org.sbml.jsbml.SBaseWithUnit; import org.sbml.jsbml.Unit; +import org.sbml.jsbml.Unit.Kind; import org.sbml.jsbml.UnitDefinition; -import org.sbml.jsbml.Unit.Kind; /** * @author Andreas Dräger @@ -169,9 +171,9 @@ } pos++; } - throw new IndexOutOfBoundsException(isLeaf() ? String.format( - "Node %s has no children.", getElementName()) : String.format( - "Index %d >= %d", childIndex, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(isLeaf() ? MessageFormat.format( + "Node {0} has no children.", getElementName()) : MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartment.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartment.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartment.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,8 @@ */ package org.sbml.jsbml.ext.spatial; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; import org.sbml.jsbml.ListOf; @@ -107,9 +109,9 @@ } pos++; } - throw new IndexOutOfBoundsException(isLeaf() ? String - .format("Node %s has no children.", getElementName()) - : String.format("Index %d >= %d", childIndex, +((int) Math.min( + throw new IndexOutOfBoundsException(isLeaf() ? MessageFormat + .format("Node {0} has no children.", getElementName()) + : MessageFormat.format("Index {0,number,integer} >= {1,number,integer}", childIndex, +((int) Math.min( pos, 0)))); } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialParameter.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialParameter.java 2012-08-21 08:40:05 UTC (rev 1390) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialParameter.java 2012-08-21 13:13:51 UTC (rev 1391) @@ -19,6 +19,8 @@ */ package org.sbml.jsbml.ext.spatial; +import java.text.MessageFormat; + import javax.swing.tree.TreeNode; /** @@ -102,9 +104,9 @@ } pos++; } - throw new IndexOutOfBoundsException(isLeaf() ? String.format( - "Node %s has no children.", getElementName()) : String.format( - "Index %d >= %d", childIndex, +((int) Math.min(pos, 0)))); + throw new IndexOutOfBoundsException(isLeaf() ? MessageFormat.format( + "Node {0} has no children.", getElementName()) : MessageFormat.format( + "Index {0,number,integer} >= {1,number,integer}", childIndex, +((int) Math.min(pos, 0)))); } /* (non-Javadoc) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-08-23 19:37:06
|
Revision: 1406 http://jsbml.svn.sourceforge.net/jsbml/?rev=1406&view=rev Author: andreas-draeger Date: 2012-08-23 19:37:00 +0000 (Thu, 23 Aug 2012) Log Message: ----------- When cloning ASTNodes the direct pointer to referenced variables (instances of CallableSBase) are set to null in the cloned object. However, we have to keep the identifier of the variable. Otherwise it might happen that the cloned Tree completely looses its meaningfulness. So far, when calling setVariable with an instance of CallableSBase only the pointer to the object was stored, but not the id. This has been corrected now. Modified Paths: -------------- trunk/NEWS.txt trunk/core/src/org/sbml/jsbml/ASTNode.java Modified: trunk/NEWS.txt =================================================================== --- trunk/NEWS.txt 2012-08-23 16:36:07 UTC (rev 1405) +++ trunk/NEWS.txt 2012-08-23 19:37:00 UTC (rev 1406) @@ -172,7 +172,7 @@ map between ids and local parameters, instead of the remove method. ====================================================================== -Version 0.8.0 (15-05-2012) +Version 0.8.0 (24-08-2012) ====================================================================== * New Features: @@ -184,7 +184,15 @@ location using the field in the new EventObject. * Bug Fixes: - + + - When cloning ASTNodes the direct pointer to referenced variables + (instances of CallableSBase) are set to null in the cloned object. + However, we have to keep the identifier of the variable. Otherwise + it might happen that the cloned Tree completely looses its + meaningfulness. So far, when calling setVariable with an instance of + CallableSBase only the pointer to the object was stored, but not the + id. This has been corrected now. + - There is now a rounding correction for multipliers when merging units that tries to shift multipliers to the scale of a unit. This can only be done if the logarithm to the base 10 of the multiplier is nearly Modified: trunk/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-08-23 16:36:07 UTC (rev 1405) +++ trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-08-23 19:37:00 UTC (rev 1406) @@ -3747,7 +3747,10 @@ } else { type = Type.NAME; } - + if (variable.isSetId()) { + // Although we memorize a direct pointer to the variable, we also have to store its id. Otherwise, this knowledge will got lost when cloning this node. + this.name = variable.getId(); + } this.variable = variable; this.firePropertyChange(TreeNodeChangeEvent.variable, oldValue, variable); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-08-24 13:39:22
|
Revision: 1410 http://jsbml.svn.sourceforge.net/jsbml/?rev=1410&view=rev Author: andreas-draeger Date: 2012-08-24 13:39:16 +0000 (Fri, 24 Aug 2012) Log Message: ----------- * Now it should fire events correctly when adding/swapping nodes. * Updated list of authors and news. * Minor improvements in the User's guide: Usage of PDF logo file and updated Acknowledgments. Modified Paths: -------------- trunk/AUTHORS.txt trunk/NEWS.txt trunk/core/doc/user_guide/JSBML_Acknowledgments.tex trunk/core/doc/user_guide/JSBMLdoc.cls trunk/core/src/org/sbml/jsbml/ASTNode.java Modified: trunk/AUTHORS.txt =================================================================== --- trunk/AUTHORS.txt 2012-08-24 13:37:30 UTC (rev 1409) +++ trunk/AUTHORS.txt 2012-08-24 13:39:16 UTC (rev 1410) @@ -11,22 +11,23 @@ -- Contributors -- Finja Buechel, University of Tuebingen, Germany - Alexander Diamantikos, University of Tuebingen, Germany Alexander Doerr, University of Tuebingen, Germany Johannes Eichner, University of Tuebingen, Germany Michael Hucka, California Institute of Technology, USA - Jakob Matthes, University of Tuebingen, Germany Florian Mittag, University of Tuebingen, Germany - Eugen Netz, University of Tuebingen, Germany - Alexander Peltzer, University of Tuebingen, Germany - Jan Rudolph, University of Tuebingen, Germany Clemens Wrzodek, University of Tuebingen, Germany -- Alumni -- Meike Aichele, University of Tuebingen, Germany + Alexander Diamantikos, University of Tuebingen, Germany Marine Dumousseau, European Bioinformatics Institute, UK - Sebastian Froehlich, IKP Gatersleben, Germany + Sebastian Froehlich, Leibniz Institute of Plant Genetics + and Crop Plant Research (IPK), Gatersleben, Germany + Jakob Matthes, University of Tuebingen, Germany Sarah Rachel Mueller vom Hagen, University of Tuebingen, Germany + Eugen Netz, University of Tuebingen, Germany + Alexander Peltzer, University of Tuebingen, Germany + Jan Rudolph, University of Tuebingen, Germany Simon Schaefer, University of Tuebingen, Germany \ No newline at end of file Modified: trunk/NEWS.txt =================================================================== --- trunk/NEWS.txt 2012-08-24 13:37:30 UTC (rev 1409) +++ trunk/NEWS.txt 2012-08-24 13:39:16 UTC (rev 1410) @@ -191,7 +191,10 @@ it might happen that the cloned Tree completely looses its meaningfulness. So far, when calling setVariable with an instance of CallableSBase only the pointer to the object was stored, but not the - id. This has been corrected now. + id. This has been corrected now. + + - When creating an ASTNode with a direct pointer to a CallableSBase, + no reference to the id of the SBase has been stored. - There is now a rounding correction for multipliers when merging units that tries to shift multipliers to the scale of a unit. This can only Modified: trunk/core/doc/user_guide/JSBML_Acknowledgments.tex =================================================================== --- trunk/core/doc/user_guide/JSBML_Acknowledgments.tex 2012-08-24 13:37:30 UTC (rev 1409) +++ trunk/core/doc/user_guide/JSBML_Acknowledgments.tex 2012-08-24 13:39:16 UTC (rev 1410) @@ -6,12 +6,15 @@ alphabetical order): \begin{itemize} - \item Students from the Leibnitz Institute for Plant Culture (IKP): Sebastian - Fr\"ohlich. - \item Students from the University of Tuebingen: Meike Aichele, Alexander - Diamantikos, Jakob Matthes, Sarah Rachel M\"uller vom Hagen, Eugen Netz, Jan - Rudolph, Alexander Peltzer, and Simon Sch\"afer - \item PhD students at the University of Tuebingen: Roland Keller and Johannes + \item Students from the Leibniz Institute of Plant Genetics and Crop Plant + Research (IKP), Gatersleben, Germany: Sebastian Fr\"ohlich. + \item Students from the Center for Bioinformatics Tuebingen (ZBIT), University + of Tuebingen, T\"ubingen, Germany: + Meike Aichele, Alexander Diamantikos, Jakob Matthes, Sarah Rachel M\"uller + vom Hagen, Sebastian Nagel, Eugen Netz, Jan Rudolph, Alexander Peltzer, and + Simon Sch\"afer + \item PhD students at the Center for Bioinformatics Tuebingen (ZBIT), University + of Tuebingen, T\"ubingen, Germany: Roland Keller and Johannes Eichner. \end{itemize} Modified: trunk/core/doc/user_guide/JSBMLdoc.cls =================================================================== --- trunk/core/doc/user_guide/JSBMLdoc.cls 2012-08-24 13:37:30 UTC (rev 1409) +++ trunk/core/doc/user_guide/JSBMLdoc.cls 2012-08-24 13:39:16 UTC (rev 1410) @@ -576,8 +576,8 @@ \fi \ifpdf - \newcommand{\JSBMLlogo}{\logoBaseFile.png}% - \newcommand{\JSBMLlogoSmall}{\logoBaseFileSmall.png}% + \newcommand{\JSBMLlogo}{\logoBaseFile.pdf}% + \newcommand{\JSBMLlogoSmall}{JSBML_shaddow.pdf}%{\logoBaseFileSmall.png}% \else% \newcommand{\JSBMLlogo}{\logoBaseFile.eps}% \newcommand{\JSBMLlogoSmall}{\logoBaseFileSmall.eps}% Modified: trunk/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-08-24 13:37:30 UTC (rev 1409) +++ trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-08-24 13:39:16 UTC (rev 1410) @@ -1478,6 +1478,7 @@ listOfNodes.add(child); setParentSBMLObject(child, parentSBMLObject, 0); child.setParent(this); + child.fireNodeAddedEvent(); } @@ -3735,11 +3736,17 @@ this.denominator = denominator; this.firePropertyChange(TreeNodeChangeEvent.denominator, oldDenominator, denominator); } - - /** - * - * @param variable - */ + + /** + * Allows you to directly set an instance of {@link CallableSBase} as the + * variable of this {@link ASTNode}. Note that if the given variable + * does not have a declared {@code id} field, the pointer to this variable + * will get lost when cloning this node. Only references to identifiers are + * permanently stored. The pointer can also not be written to an SBML file + * without a valid identifier. + * + * @param variable a pointer to a {@link CallableSBase}. + */ public void setVariable(CallableSBase variable) { CallableSBase oldValue = this.variable; if (variable instanceof FunctionDefinition) { @@ -3748,7 +3755,11 @@ type = Type.NAME; } if (variable.isSetId()) { - // Although we memorize a direct pointer to the variable, we also have to store its id. Otherwise, this knowledge will got lost when cloning this node. + /* + * Although we memorize a direct pointer to the variable, we also have to + * store its id. Otherwise, this knowledge will got lost when cloning this + * node. + */ this.name = variable.getId(); } this.variable = variable; @@ -3800,14 +3811,18 @@ setParentSBMLObject(child, that.getParentSBMLObject(), 0); } child.fireNodeRemovedEvent(); + child.getListOfTreeNodeChangeListeners().removeAll(that.getListOfTreeNodeChangeListeners()); child.setParent(that); + child.fireNodeAddedEvent(); } for (ASTNode child : listOfNodes) { if (that.getParentSBMLObject() != getParentSBMLObject()) { setParentSBMLObject(child, getParentSBMLObject(), 0); } child.fireNodeRemovedEvent(); + child.getListOfTreeNodeChangeListeners().removeAll(getListOfTreeNodeChangeListeners()); child.setParent(this); + child.fireNodeAddedEvent(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-09-10 13:18:07
|
Revision: 1416 http://jsbml.svn.sourceforge.net/jsbml/?rev=1416&view=rev Author: andreas-draeger Date: 2012-09-10 13:17:54 +0000 (Mon, 10 Sep 2012) Log Message: ----------- Minor improvements in log messages and JavaDoc comments. * New Features: - Some additional methods for more convenient working with tree data structures in TreeNodeWithChangeSupport. * Bug Fixes: - Several improvements and corrections in the work with TreeNodeChangeListeners. In many cases listeners were notified too early or sometimes even not at all because of inconsistent notification mechanisms. Modified Paths: -------------- trunk/NEWS.txt trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java trunk/core/src/org/sbml/jsbml/Event.java trunk/core/src/org/sbml/jsbml/KineticLaw.java trunk/core/src/org/sbml/jsbml/ListOf.java trunk/core/src/org/sbml/jsbml/Model.java trunk/core/src/org/sbml/jsbml/Reaction.java trunk/core/src/org/sbml/jsbml/UnitDefinition.java trunk/core/src/org/sbml/jsbml/util/TreeNodeWithChangeSupport.java trunk/core/src/org/sbml/jsbml/util/compilers/ASTNodeValue.java trunk/core/src/org/sbml/jsbml/util/compilers/UnitsCompiler.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartment.java Modified: trunk/NEWS.txt =================================================================== --- trunk/NEWS.txt 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/NEWS.txt 2012-09-10 13:17:54 UTC (rev 1416) @@ -6,6 +6,9 @@ * New Features: + - Some additional methods for more convenient working with tree data + structures in TreeNodeWithChangeSupport. + - SBasePlugin has now also become a TreeNodeWithChangeSupport and AbstractSBasePlugin in turn extends AbstractTreeNode. @@ -60,6 +63,11 @@ * Bug Fixes: + - Several improvements and corrections in the work with + TreeNodeChangeListeners. In many cases listeners were notified too + early or sometimes even not at all because of inconsistent + notification mechanisms. + - SBML Layout extension contained bugs that caused endless recursion when trying to access referenced instances of NamedSBase from a glyph (such as CompartmentGlyph, SpeciesGlyph etc.). Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-09-10 13:17:54 UTC (rev 1416) @@ -754,7 +754,7 @@ TreeNode parent = getParent(); - if (parent != null && parent instanceof SBase) { + if ((parent != null) && (parent instanceof SBase)) { ((SBase) parent).unregister(this); } @@ -1342,13 +1342,13 @@ throw new IllegalArgumentException(MessageFormat.format("Cannot unregister {0}.", sbase.getElementName())); } - - // fireNodeRemovedEvent is calling this method - sbase.fireNodeRemovedEvent(); - - // TODO : do we need to remove the link to the parent here ??? - // remove all changeListeners - sbase.removeAllTreeNodeChangeListeners(); + /* + * Do not remove ChangeListeners from the sbase here, this will be done + * in the super class. It is important to keep the change listeners for now, + * because otherwise the listeners won't be informed that we are going to + * delete something from the model. + */ } } Modified: trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/core/src/org/sbml/jsbml/AbstractTreeNode.java 2012-09-10 13:17:54 UTC (rev 1416) @@ -100,7 +100,7 @@ /** * Creates an empty {@link AbstractTreeNode} without child nodes and an * empty list of {@link TreeNodeChangeListener}s. The pointer to the parent - * of this node is set to <code>null</code>. + * of this node is set to {@code null}. */ public AbstractTreeNode() { super(); @@ -113,10 +113,10 @@ * {@link #parent} and {@link #listOfListeners}. Both of them are not cloned * by this method, for two reasons: * <ul> - * <li>The {@link #parent} is not cloned and is left as <code>null</code> + * <li>The {@link #parent} is not cloned and is left as {@code null} * because the new {@link AbstractTreeNode} will get a parent set as soon as * it is added/linked again to a {@link Model}. Note that only the top-level - * element of the cloned sub-tree will have a <code>null</code> value as its + * element of the cloned sub-tree will have a {@code null} value as its * parent. All sub-element will point to their correct parent element.</li> * <li>{@link #listOfListeners} is needed in all other setXX() methods. * Cloning these might lead to strange and unexpected behavior, because when @@ -179,14 +179,24 @@ */ //@Override public void addTreeNodeChangeListener(TreeNodeChangeListener listener) { + addTreeNodeChangeListener(listener, true); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#addTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener, boolean) + */ + //@Override + public void addTreeNodeChangeListener(TreeNodeChangeListener listener, boolean recursive) { if (!listOfListeners.contains(listener)) { listOfListeners.add(listener); } - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); + if (recursive) { + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).addTreeNodeChangeListener(listener); + } } } } @@ -330,8 +340,8 @@ */ //@Override public void fireNodeAddedEvent() { - for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeAdded(this); + for (int i = listOfListeners.size() - 1; i >= 0; i--) { + listOfListeners.get(i).nodeAdded(this); } } @@ -342,8 +352,16 @@ public void fireNodeRemovedEvent() { TreeNode previousParent = getParent(); parent = null; - for (TreeNodeChangeListener listener : listOfListeners) { - listener.nodeRemoved(new TreeNodeRemovedEvent(this, previousParent)); + + if (getTreeNodeChangeListenerCount() > 0) { + // memorize all listeners before deleting them from this object. + List<TreeNodeChangeListener> listOfTreeNodeChangeListeners = new LinkedList<TreeNodeChangeListener>(listOfListeners); + // remove all changeListeners + removeAllTreeNodeChangeListeners(); + + for (TreeNodeChangeListener listener : listOfTreeNodeChangeListeners) { + listener.nodeRemoved(new TreeNodeRemovedEvent(this, previousParent)); + } } } @@ -407,7 +425,7 @@ public List<TreeNodeChangeListener> getListOfTreeNodeChangeListeners() { return listOfListeners; } - + /** * Returns the number of child elements of this {@link TreeNode}. * @@ -426,8 +444,34 @@ public TreeNode getParent() { return parent; } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getRoot() + */ + //@Override + public TreeNode getRoot() { + if (isRoot()) { + return this; + } + TreeNode parent = getParent(); + if (parent instanceof TreeNodeWithChangeSupport) { + return ((TreeNodeWithChangeSupport) parent).getRoot(); + } + while (parent.getParent() != null) { + parent = parent.getParent(); + } + return parent; + } /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getTreeNodeChangeListenerCount() + */ + //@Override + public int getTreeNodeChangeListenerCount() { + return listOfListeners != null ? listOfListeners.size() : 0; + } + + /* (non-Javadoc) * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#getUserObject(java.lang.Object) */ //@Override @@ -476,25 +520,18 @@ return getChildCount() == 0; } - /** - * Opposite of {@link #isSetParent()}. - * - * Returns <code>true</code> if this {@link AbstractTreeNode} is the root - * node of a tree, <code>false</code> otherwise. - * - * @return <code>True</code> if this {@link AbstractTreeNode} is the root - * node of a tree, <code>false</code> otherwise. - * - * @see #isSetParent() + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isRoot() */ + //@Override public boolean isRoot() { return !isSetParent(); } - /** - * - * @return + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#isSetParent() */ + //@Override public boolean isSetParent() { return parent != null; } @@ -545,13 +582,23 @@ * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener) */ //@Override - public void removeTreeNodeChangeListener(TreeNodeChangeListener l) { - listOfListeners.remove(l); - Enumeration<TreeNode> children = children(); - while (children.hasMoreElements()) { - TreeNode node = children.nextElement(); - if (node instanceof TreeNodeWithChangeSupport) { - ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(l); + public void removeTreeNodeChangeListener(TreeNodeChangeListener listener) { + removeTreeNodeChangeListener(listener, true); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.util.TreeNodeWithChangeSupport#removeTreeNodeChangeListener(org.sbml.jsbml.util.TreeNodeChangeListener, boolean) + */ + //@Override + public void removeTreeNodeChangeListener(TreeNodeChangeListener listener, boolean recursive) { + listOfListeners.remove(listener); + if (recursive) { + Enumeration<TreeNode> children = children(); + while (children.hasMoreElements()) { + TreeNode node = children.nextElement(); + if (node instanceof TreeNodeWithChangeSupport) { + ((TreeNodeWithChangeSupport) node).removeTreeNodeChangeListener(listener); + } } } } Modified: trunk/core/src/org/sbml/jsbml/Event.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Event.java 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/core/src/org/sbml/jsbml/Event.java 2012-09-10 13:17:54 UTC (rev 1416) @@ -447,6 +447,7 @@ public ListOf<EventAssignment> getListOfEventAssignments() { if (listOfEventAssignments == null) { listOfEventAssignments = ListOf.newInstance(this, EventAssignment.class); + registerChild(listOfEventAssignments); } return listOfEventAssignments; } Modified: trunk/core/src/org/sbml/jsbml/KineticLaw.java =================================================================== --- trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/core/src/org/sbml/jsbml/KineticLaw.java 2012-09-10 13:17:54 UTC (rev 1416) @@ -147,7 +147,7 @@ * in this KineticLaw. * * @param parameter - * @return <code>true</code> if the {@link #listOfLocalParameters} was + * @return {@code true} if the {@link #listOfLocalParameters} was * changed as a result of this call. */ public boolean addLocalParameter(LocalParameter parameter) { @@ -165,7 +165,7 @@ * in this KineticLaw. * * @param p - * @return <code>true</code> if the {@link #listOfLocalParameters} was + * @return {@code true} if the {@link #listOfLocalParameters} was * changed as a result of this call. * @deprecated use {@link #addLocalParameter(LocalParameter)}. */ @@ -284,6 +284,7 @@ public ListOf<LocalParameter> getListOfLocalParameters() { if (listOfLocalParameters == null) { listOfLocalParameters = ListOf.newInstance(this, LocalParameter.class); + registerChild(listOfLocalParameters); } return listOfLocalParameters; } @@ -1008,7 +1009,7 @@ * Removes the {@link #listOfLocalParameters} from this {@link KineticLaw} and notifies * all registered instances of {@link TreeNodeChangeListener}. * - * @return <code>true</code> if calling this method lead to a change in this + * @return {@code true} if calling this method lead to a change in this * data structure. */ public boolean unsetListOfLocalParameters() { Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-09-10 13:17:54 UTC (rev 1416) @@ -28,6 +28,7 @@ import javax.swing.tree.TreeNode; +import org.apache.log4j.Logger; import org.sbml.jsbml.util.TreeNodeChangeEvent; import org.sbml.jsbml.util.TreeNodeWithChangeSupport; import org.sbml.jsbml.util.filters.Filter; @@ -252,6 +253,11 @@ * Generated serial version identifier. */ private static final long serialVersionUID = 5757549697766609627L; + + /** + * A {@link Logger} for this class. + */ + private static final Logger logger = Logger.getLogger(ListOf.class); /** * Helper method to initialize newly created lists. @@ -268,7 +274,12 @@ list.setVersion(parent.getVersion()); } list.setSBaseListType(type); - parent.registerChild(list); + /* Note: + * It is not possible to register the list as a child of the given parent at this position. + * If we would do this here, a nodeAdded-Event would be triggered before there is a pointer + * from the parent to the new child. Hence, callers must make sure that the created ListOf + * object will be registered as a child of the parent. + */ return list; } @@ -295,7 +306,11 @@ */ public static <T extends SBase> ListOf<T> newInstance(SBase parent, Class<T> clazz) { - return initListOf(parent, new ListOf<T>(), ListOf.Type.valueOf(clazz)); + /* + * Again, note that the created element cannot be registered as a child in + * this position. See the comment in the called method for details. + */ + return initListOf(parent, new ListOf<T>(), ListOf.Type.valueOf(clazz)); } /** @@ -366,16 +381,24 @@ /* (non-Javadoc) @see java.util.List#add(java.lang.Object) */ - public boolean add(T e) { + public boolean add(T e) throws LevelVersionError { /* - * Calling the method registerChild before adding the object to the list - * as it can throw an Exception if the metaid or id is not unique in the - * model; it also checks if the given element has the same Level/Version - * configuration as this listOf* element and will throw an exception if - * this is not the case. + * In order to ensure that listeners are notified correctly, the element + * must be added to the list before registering it as a child. However, if + * something goes wrong, we have to revert this action. */ - registerChild(e); - return listOf.add(e); + try { + boolean success = listOf.add(e); + registerChild(e); + return success; + } catch (Throwable exc) { + listOf.remove(e); + if (exc instanceof LevelVersionError) { + throw (LevelVersionError) exc; + } + logger.debug(exc); + } + return false; } /* (non-Javadoc) @@ -504,12 +527,12 @@ * null if no such element exists in this list. */ public T firstHit(Filter f) { - for (T sbase : this) { - if (f.accepts(sbase)) { - return sbase; - } - } - return null; + for (T sbase : this) { + if (f.accepts(sbase)) { + return sbase; + } + } + return null; } /** Modified: trunk/core/src/org/sbml/jsbml/Model.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Model.java 2012-09-10 13:16:27 UTC (rev 1415) +++ trunk/core/src/org/sbml/jsbml/Model.java 2012-09-10 13:17:54 UTC (rev 1416) @@ -192,7 +192,7 @@ /** * Creates a Model instance. By default, all the listOfxxx and xxxUnitsID are - * <code>null</code>. + * {@code null}. */ public Model() { super(); @@ -300,7 +300,7 @@ /** * Creates a Model instance from an id, level and version. By default, all the - * listOfxxx and xxxUnitsID are <code>null</code>. + * listOfxxx and xxxUnitsID are {@code null}. * * @param id * @param level @@ -817,7 +817,7 @@ * created is not significant. It could have been created in a variety of * ways, for example by using createEvent(). If no {@link Event} object exists * in this {@link Model} object, a new {@link Delay} is <em>not</em> created - * and <code>null</code> is returned instead. + * and {@code null} is returned instead. * <p> * * @return the {@link Delay} object created @@ -857,7 +857,7 @@ * created is not significant. It could have been created in a variety of * ways, for example by using createEvent(). If no {@link Event} object exists * in this {@link Model} object, a new {@link EventAssignment} is <em>not</em> - * created and <code>null</code> is returned instead. + * created and {@code null} is returned instead. * <p> * * @return the {@link EventAssignment} object created @@ -934,7 +934,7 @@ * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, or a {@link Reaction} * exists but already has a {@link KineticLaw}, a new {@link KineticLaw} is - * <em>not</em> created and <code>null</code> is returned instead. + * <em>not</em> created and {@code null} is returned instead. * <p> * * @return the {@link KineticLaw} object created @@ -965,7 +965,7 @@ * Reaction.createKineticLaw() on the {@link Reaction} object created by a * createReaction(). If a {@link Reaction} does not exist for this model, or * the last {@link Reaction} does not contain a {@link KineticLaw} object, a - * new {@link LocalParameter} is <em>not</em> created and <code>null</code> is returned + * new {@link LocalParameter} is <em>not</em> created and {@code null} is returned * instead. * <p> * @@ -1014,7 +1014,7 @@ * added to this {@link Model} is not significant. It could have been created * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, a new - * {@link ModifierSpeciesReference} is <em>not</em> created and <code>null</code> is + * {@link ModifierSpeciesReference} is <em>not</em> created and {@code null} is * returned instead. * <p> * @@ -1076,7 +1076,7 @@ * added to this {@link Model} is not significant. It could have been created * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, a new - * {@link SpeciesReference} is <em>not</em> created and <code>null</code> is returned + * {@link SpeciesReference} is <em>not</em> created and {@code null} is returned * instead. * <p> * @@ -1131,7 +1131,7 @@ * added to this {@link Model} is not significant. It could have been created * in a variety of ways, for example using createReaction(). If a * {@link Reaction} does not exist for this model, a new - * {@link SpeciesReference} is <em>not</em> created and <code>null</code> is returned + * {@link SpeciesReference} is <em>not</em> created and {@code null} is returned * instead. * <p> * @@ -1283,7 +1283,7 @@ * created is not significant. It could have been created in a variety of * ways, for example by using createEvent(). If no {@link Event} object exists * in this {@link Model} object, a new {@link Trigger} is <em>not</em> created - * and <code>null</code> is returned instead. + * and {@code null} is returned instead. * <p> * * @return the {@link Trigger} object created @@ -1298,7 +1298,7 @@ * <p> * The mechanism by which the {@link UnitDefinition} was created is not * significant. If a {@link UnitDefinition} object does not exist in this - * model, a new {@link Unit} is <em>not</em> created and <code>null</code> is returned + * model, a new {@link Unit} is <em>not</em> created and {@code null} is returned * instead. * <p> * @@ -1404,12 +1404,12 @@ /** * Returns a {@link CallableSBase} element of the {@link Model} that has the - * given 'id' as identifier or <code>null</code> if no element is found. + * given 'id' as identifier or {@code null} if no element is found. * * @param id * an identifier indicating an element of the {@link Model}. * @return a {@link CallableSBase} element of the {@link Model} that has the - * given 'id' as id or <code>null</code> if no element is found. + * given 'id' as id or {@code null} if no element is found. */ public CallableSBase findCallableSBase(String id) { UniqueNamedSBase found = findUniqueNamedSBase(id); @@ -1425,7 +1425,7 @@ * is identical to the given {@link UnitDefinition}. If no element can be * found that satisfies the method * {@link UnitDefinition#areIdentical(UnitDefinition, UnitDefinition)}, - * <code>null</code> will be returned. + * {@code null} will be returned. * * @param unitDefinition * @return A {@link UnitDefinition} object that is already part of this @@ -1433,7 +1433,7 @@ * condition of * {@link UnitDefinition#areIdentical(UnitDefinition, UnitDefinition)} * in comparison to the given {@link UnitDefinition}, or - * <code>null</code> if no such element can be found. + * {@code null} if no such element can be found. */ public UnitDefinition findIdentical(UnitDefinition unitDefinition) { return getListOfUnitDefinitions().firstHit(new IdenticalUnitDefinitionFilter(unitDefinition)); @@ -1446,7 +1446,7 @@ * @param id * @return A {@link List} of all {@link LocalParameter} instances with the * given name or identifier. This {@link List} can be empty, but never - * <code>null</code>. + * {@code null}. */ public List<LocalParameter> findLocalParameters(String id) { @@ -1482,7 +1482,7 @@ * referred to by the {@link ModifierSpeciesReference}. * @return the {@link ModifierSpeciesReference} out of all {@link Reaction}s * which has 'id' as id (or name depending on level and version). - * <code>null</code> if it doesn't exist. + * {@code null} if it doesn't exist. */ public ModifierSpeciesReference findModifierSpeciesReference(String id) { SimpleSpeciesReference ssr = findSimpleSpeciesReference(id); @@ -1494,12 +1494,12 @@ /** * Returns a {@link NamedSBase} element of the model that has the given 'id' - * as id or <code>null</code> if no element is found. + * as id or {@code null} if no element is found. * * @param id * an id indicating an element of the model. * @return a {@link NamedSBase} element of the model that has the given 'id' - * as id or <code>null</code> if no element is found. + * as id or {@code null} if no element is found. */ public NamedSBase findNamedSBase(String id) { UniqueNamedSBase found = findUniqueNamedSBase(id); @@ -1511,7 +1511,7 @@ /** * Returns a {@link NamedSBaseWithDerivedUnit} element of the {@link Model} - * that has the given 'id' as id or <code>null</code> if no element is found. It first + * that has the given 'id' as id or {@code null} if no element is found. It first * tries to find a {@link CallableSBase} with the given identifier and, if * this is not successful, it searches for an instance of {@link Event} with * the given id. @@ -1519,7 +1519,7 @@ * @param id * an id indicating an element of the {@link Model}. * @return a {@link NamedSBaseWithDerivedUnit} element of the {@link Model} - * that has the given 'id' as id or <code>null</code> if no element is found. + * that has the given 'id' as id or {@code null} if no element is found. * @see #findCallableSBase(String) */ public NamedSBaseWithDerivedUnit findNamedSBaseWithDerivedUnit(String id) { @@ -1584,7 +1584,7 @@ * Returns a {@link SortedSet} of identifiers of all {@link Reaction} elements * within * this {@link Model} whose {@link KineticLaw}s contain a - * {@link LocalParameter} that has the given 'id' or <code>null</code> if no + * {@link LocalParameter} that has the given 'id' or {@code null} if no * element cannot be found. * * @param id @@ -1593,7 +1593,7 @@ * @return a {@link SortedSet} of the identifiers of all {@link Reaction} * elements within this {@link Model} whose {@link KineticLaw} * contains a {@link LocalParameter} that has the given 'id' as id - * or <code>null</code> if no such element with this 'id' can be + * or {@code null} if no such element with this 'id' can be * found. */ public SortedSet<String> findReactionsForLocalParameter(String id) @@ -1633,7 +1633,7 @@ * referred to by the {@link SimpleSpeciesReference}. * @return the {@link SimpleSpeciesReference} out of all {@link Reaction}s * which has 'id' as id (or name depending on level and version). - * <code>null</code> if it doesn't exist. + * {@code null} if it doesn't exist. */ public SimpleSpeciesReference findSimpleSpeciesReference(String id) { UniqueNamedSBase found = findUniqueNamedSBase(id); @@ -1653,7 +1653,7 @@ * referred to by the {@link SpeciesReference}. * @return the {@link SpeciesReference} out of all {@link Reaction}s * which has 'id' as id (or name depending on level and version). - * <code>null</code> if it doesn't exist. + * {@code null} if it doesn't exist. */ public SpeciesReference findSpeciesReference(String id) { SimpleSpeciesReference ssr = findSimpleSpeciesReference(id); @@ -1668,7 +1668,7 @@ * {@link Parameter}s for the element with the given identifier. * * @param id - * @return a {@link Symbol} element with the given identifier or <code>null</code> if there + * @return a {@link Symbol} element with the given identifier or {@code null} if there * is no such element. */ public Symbol findSymbol(String id) { @@ -1681,13 +1681,13 @@ /** * Returns a {@link UniqueNamedSBase} element that has the given 'id' within - * this {@link Model} or <code>null</code> if no such element can be found. + * this {@link Model} or {@code null} if no such element can be found. * * @param id * an id indicating an {@link UniqueNamedSBase} element of the * {@link Model}. * @return a {@link UniqueNamedSBase} element of the {@link Model} that has - * the given 'id' as id or <code>null</code> if no element with this + * the given 'id' as id or {@code null} if no element with this * 'id' can be found. */ public UniqueNamedSBase findUniqueNamedSBase(String id) { @@ -1696,13 +1696,13 @@ /** * Returns a {@link UnitDefinition} element that has the given 'id' within - * this {@link Model} or <code>null</code> if no such element can be found. + * this {@link Model} or {@code null} if no such element can be found. * * @param id * an id indicating an {@link UnitDefinition} element of the * {@link Model}. * @return a {@link UniqueNamedSBase} element of the {@link Model} that has - * the given 'id' as id or <code>null</code> if no such element with + * the given 'id' as id or {@code null} if no such element with * this 'id' can be found. */ public UnitDefinition findUnitDefinition(String id) { @@ -1753,7 +1753,7 @@ * this {@link Model} as id. * * @return the {@link UnitDefinition} instance which has the {@link #areaUnitsID} of - * this {@link Model} as id. <code>null</code> if it doesn't exist. + * this {@link Model} as id. {@code null} if it doesn't exist. */ public UnitDefinition getAreaUnitsInstance() { return getUnitDefinition(getAreaUnits()); @@ -1895,11 +1895,11 @@ } /** - * Gets the nth {@link Compartment} instance of the listOfCompartments. + * Gets the n<sup>th</sup> {@link Compartment} instance of the listOfCompartments. * * @param n - * @return the nth {@link Compartment} instance of the listOfCompartments. - * <code>null</code> if if the listOfCompartments is not set. + * @return the n<sup>th</sup> {@link Compartment} instance of the listOfCompartments. + * {@code null} if the listOfCompartments is not set. */ public Compartment getCompartment(int n) { return getListOfCompartments().get(n); @@ -1911,7 +1911,7 @@ * * @param id * @return the {@link Compartment} of the listOfCompartments which has 'id' as - * id (or name depending on the version and level). <code>null</code> if if the + * id (or name depending on the version and level). {@code null} if the * listOfCompartments is not set. */ public Compartment getCompartment(String id) { @@ -1932,11 +1932,11 @@ } /** - * Gets the nth CompartmentType object in this Model. + * Gets the n<sup>th</sup> CompartmentType object in this Model. * * @param n * index - * @return the nth CompartmentType of this Model. Returns <code>null</code> if there are no + * @return the n<sup>th</sup> CompartmentType of this Model. Returns {@code null} if there are no * compartmentType defined or if the index n is too big or lower than * zero. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. @@ -1947,11 +1947,11 @@ } /** - * Gets the {@link CompartmentType} with the given <code>id</code>. + * Gets the {@link CompartmentType} with the given {@code id}. * * @param id * @return the CompartmentType of the {@link #listOfCompartmentTypes} which has 'id' as - * id (or name depending on the level and version). <code>null</code> if the + * id (or name depending on the level and version). {@code null} if the * {@link #listOfCompartmentTypes} is not set or the id is not found. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -1978,10 +1978,10 @@ } /** - * Gets the nth Constraint object in this Model. + * Gets the n<sup>th</sup> Constraint object in this Model. * * @param n - * @return the nth Constraint of this Model. Returns <code>null</code> if there are no + * @return the n<sup>th</sup> Constraint of this Model. Returns {@code null} if there are no * constraint defined or if the index n is too big or lower than zero. */ public Constraint getConstraint(int n) { @@ -2012,7 +2012,7 @@ * Model as id. * * @return the Parameter instance which has the conversionFactorID of this - * Model as id. <code>null</code> if it doesn't exist + * Model as id. {@code null} if it doesn't exist */ public Parameter getConversionFactorInstance() { return getParameter(this.conversionFactorID); @@ -2034,10 +2034,10 @@ } /** - * Gets the nth Event object in this Model. + * Gets the n<sup>th</sup> Event object in this Model. * * @param n - * @return the nth Event of this Model. Returns <code>null</code> if there are no event + * @return the n<sup>th</sup> Event of this Model. Returns {@code null} if there are no event * defined or if the index n is too big or lower than zero. */ public Event getEvent(int n) { @@ -2045,11 +2045,11 @@ } /** - * Gets the {@link Event} which as the given <code>id</code> as id. + * Gets the {@link Event} which as the given {@code id} as id. * * @param id * @return the {@link Event} of the {@link #listOfEvents} which has 'id' as id - * (or name depending on the level and version). <code>null</code> if if the + * (or name depending on the level and version). {@code null} if the * {@link #listOfEvents} is not set. */ public Event getEvent(String id) { @@ -2097,19 +2097,19 @@ * of this Model as id. * * @return the {@link UnitDefinition} instance which has the extent units ID - * of this Model as id. <code>null</code> if it doesn't exist + * of this Model as id. {@code null} if it doesn't exist */ public UnitDefinition getExtentUnitsInstance() { return getUnitDefinition(getExtentUnits()); } /** - * Gets the nth {@link FunctionDefinition} instance of the + * Gets the n<sup>th</sup> {@link FunctionDefinition} instance of the * listOfFunstionDefinitions. * * @param n - * @return the nth {@link FunctionDefinition} instance of the - * listOfFunstionDefinitions. <code>null</code> if if the listOfFunctionDefinitions + * @return the n<sup>th</sup> {@link FunctionDefinition} instance of the + * listOfFunstionDefinitions. {@code null} if the listOfFunctionDefinitions * is not set. */ public FunctionDefinition getFunctionDefinition(int n) { @@ -2123,7 +2123,7 @@ * @param id * @return the {@link FunctionDefinition} of the {@link #listOfFunctionDefinitions} * which has 'id' as id (or name depending on the level and version). - * <code>null</code> if if the {@link #listOfFunctionDefinitions} is not set. + * {@code null} if the {@link #listOfFunctionDefinitions} is not set. */ public FunctionDefinition getFunctionDefinition(String id) { UniqueNamedSBase found = findUniqueNamedSBase(id); @@ -2144,10 +2144,10 @@ } /** - * Gets the nth {@link InitialAssignment} object in this {@link Model}. + * Gets the n<sup>th</sup> {@link InitialAssignment} object in this {@link Model}. * * @param n - * @return the nth {@link InitialAssignment} of this {@link Model}. <code>null</code> if + * @return the n<sup>th</sup> {@link InitialAssignment} of this {@link Model}. {@code null} if * the listOfInitialAssignments is not set. */ public InitialAssignment getInitialAssignment(int n) { @@ -2156,8 +2156,8 @@ /** * Returns the {@link InitialAssignment} of the - * {@link #listOfInitialAssignments} whose <code>symbol</code> attribute, - * i.e., whose {@link Variable} has the given <code>variable</code> as + * {@link #listOfInitialAssignments} whose {@code symbol} attribute, + * i.e., whose {@link Variable} has the given {@code variable} as * identifier. * * @param variable @@ -2165,8 +2165,8 @@ * {@link InitialAssignment} is requested. * @return the first {@link InitialAssignment} of the * {@link #listOfInitialAssignments}, whose {@link Variable} has the - * <code>variable</code> as identifier (or name depending on the level - * and version). <code>null</code> if it doesn't exist. + * {@code variable} as identifier (or name depending on the level + * and version). {@code null} if it doesn't exist. */ public InitialAssignment getInitialAssignment(String variable) { return getListOfInitialAssignments().firstHit( @@ -2202,7 +2202,7 @@ * Returns the last element added in the given list. * * @return the last element added in the model, corresponding to the last - * element of the list of these elements, or <code>null</code> is no element exist + * element of the list of these elements, or {@code null} is no element exist * for this type. */ private <T> T getLastElementOf(ListOf<? extends T> listOf) { @@ -2229,7 +2229,7 @@ * Returns the length units of this {@link Model} as a {@link UnitDefinition}. * * @return the {@link UnitDefinition} instance which has the {@link #lengthUnitsID} of this - * {@link Model} as id. <code>null</code> if it doesn't exist. + * {@link Model} as id. {@code null} if it doesn't exist. */ public UnitDefinition getLengthUnitsInstance() { return getUnitDefinition(getLengthUnits()); @@ -2243,6 +2243,7 @@ public ListOf<Compartment> getListOfCompartments() { if (listOfCompartments == null) { listOfCompartments = ListOf.newInstance(this, Compartment.class); + registerChild(listOfCompartments); } return listOfCompartments; } @@ -2257,6 +2258,7 @@ public ListOf<CompartmentType> getListOfCompartmentTypes() { if (listOfCompartmentTypes == null) { listOfCompartmentTypes = ListOf.newInstance(this, CompartmentType.class); + registerChild(listOfCompartmentTypes); } return listOfCompartmentTypes; } @@ -2269,6 +2271,7 @@ public ListOf<Constraint> getListOfConstraints() { if (listOfConstraints == null) { listOfConstraints = ListOf.newInstance(this, Constraint.class); + registerChild(listOfConstraints); } return listOfConstraints; } @@ -2290,6 +2293,7 @@ public ListOf<Event> getListOfEvents() { if (listOfEvents == null) { listOfEvents = ListOf.newInstance(this, Event.class); + registerChild(listOfEvents); } return listOfEvents; } @@ -2301,8 +2305,8 @@ */ public ListOf<FunctionDefinition> getListOfFunctionDefinitions() { if (listOfFunctionDefinitions == null) { - listOfFunctionDefinitions = ListOf.newInstance(this, - FunctionDefinition.class); + listOfFunctionDefinitions = ListOf.newInstance(this, FunctionDefinition.class); + registerChild(listOfFunctionDefinitions); } return listOfFunctionDefinitions; } @@ -2314,8 +2318,8 @@ */ public ListOf<InitialAssignment> getListOfInitialAssignments() { if (listOfInitialAssignments == null) { - listOfInitialAssignments = ListOf.newInstance(this, - InitialAssignment.class); + listOfInitialAssignments = ListOf.newInstance(this, InitialAssignment.class); + registerChild(listOfInitialAssignments); } return listOfInitialAssignments; } @@ -2328,6 +2332,7 @@ public ListOf<Parameter> getListOfParameters() { if (listOfParameters == null) { listOfParameters = ListOf.newInstance(this, Parameter.class); + registerChild(listOfParameters); } return listOfParameters; } @@ -2337,8 +2342,7 @@ * @return */ public List<UnitDefinition> getListOfPredefinedUnitDefinitions() { - return (listOfPredefinedUnitDefinitions != null) ? listOfPredefinedUnitDefinitions - : new ArrayList<UnitDefinition>(0); + return (listOfPredefinedUnitDefinitions != null) ? listOfPredefinedUnitDefinitions : new ArrayList<UnitDefinition>(0); } /** @@ -2349,6 +2353,7 @@ public ListOf<Reaction> getListOfReactions() { if (listOfReactions == null) { listOfReactions = ListOf.newInstance(this, Reaction.class); + registerChild(listOfReactions); } return listOfReactions; } @@ -2361,18 +2366,20 @@ public ListOf<Rule> getListOfRules() { if (listOfRules == null) { listOfRules = ListOf.newInstance(this, Rule.class); + registerChild(listOfRules); } return listOfRules; } /** - * Returns the listOfSpecies of this {@link Model}. + * Returns the {@link #listOfSpecies} of this {@link Model}. * - * @return the listOfSpecies of this {@link Model}. + * @return the {@link #listOfSpecies} of this {@link Model}. */ public ListOf<Species> getListOfSpecies() { if (listOfSpecies == null) { listOfSpecies = ListOf.newInstance(this, Species.class); + registerChild(listOfSpecies); } return listOfSpecies; } @@ -2387,6 +2394,7 @@ public ListOf<SpeciesType> getListOfSpeciesTypes() { if (listOfSpeciesTypes == null) { listOfSpeciesTypes = ListOf.newInstance(this, SpeciesType.class); + registerChild(listOfSpeciesTypes); } return listOfSpeciesTypes; } @@ -2399,6 +2407,7 @@ public ListOf<UnitDefinition> getListOfUnitDefinitions() { if (listOfUnitDefinitions == null) { listOfUnitDefinitions = ListOf.newInstance(this, UnitDefinition.class); + registerChild(listOfUnitDefinitions); } return listOfUnitDefinitions; } @@ -2866,11 +2875,11 @@ } /** - * Gets the nth {@link Parameter} object in this {@link Model}. + * Gets the n<sup>th</sup> {@link Parameter} object in this {@link Model}. * * @param n * index - * @return the nth {@link Parameter} of this {@link Model}. + * @return the n<sup>th</sup> {@link Parameter} of this {@link Model}. */ public Parameter getParameter(int n) { return getListOfParameters().get(n); @@ -2881,7 +2890,7 @@ * * @param id * @return the {@link Parameter} of the listOfParameters which has 'id' as id - * (or name depending on the level and version). <code>null</code> if it doesn't + * (or name depending on the level and version). {@code null} if it doesn't * exist. */ public Parameter getParameter(String id) { @@ -2907,14 +2916,14 @@ /** * Returns a UnitDefinition representing one of the predefined units of SBML, - * returns <code>null</code> if the given unit kind is not a valid one for the SBML level + * returns {@code null} if the given unit kind is not a valid one for the SBML level * and version of this {@link Model}. * * @param unitKind * a unit kind for one of the predefined units from the SBML * Specifications * @return a UnitDefinition representing one of the predefined units of SBML, - * <code>null</code> if the unitKind is invalid. + * {@code null} if the unitKind is invalid. */ public UnitDefinition getPredefinedUnitDefinition(String unitKind) { // TODO: This might be more efficient than ALWAYS storing ALL base units in the listOfPredefinedUnits: @@ -2972,7 +2981,7 @@ * * @param id * @return the {@link Reaction} of the {@link #listOfReactions} which has 'id' as id - * (or name depending on the level and version). <code>null</code> if it doesn't + * (or name depending on the level and version). {@code null} if it doesn't * exist. */ public Reaction getReaction(String id) { @@ -2993,11 +3002,11 @@ } /** - * Gets the nth {@link Rule} of the listOfRules. + * Gets the n<sup>th</sup> {@link Rule} of the listOfRules. * * @param n * an index - * @return the nth {@link Rule} of the listOfRules. <code>null</code> if it doesn't exist. + * @return the n<sup>th</sup> {@link Rule} of the listOfRules. {@code null} if it doesn't exist. */ public Rule getRule(int n) { return getListOfRules().get(n); @@ -3009,7 +3018,7 @@ * the value passed to this method. * * @param variable - * @return <code>null</code> if no element with the required property exists. + * @return {@code null} if no element with the required property exists. */ public ExplicitRule getRule(String variable) { Rule rule = listOfRules.firstHit(new AssignmentVariableFilter(variable)); @@ -3057,7 +3066,7 @@ * @param n * an index * @return the {@link Species} with the given index if it exists, - * <code>null</code> otherwise. + * {@code null} otherwise. */ public Species getSpecies(int n) { return getListOfSpecies().get(n); @@ -3069,7 +3078,7 @@ * * @param id * @return the {@link Species} of the listOfSpecies which has 'id' as id (or - * name depending on the level and version). <code>null</code> if + * name depending on the level and version). {@code null} if * it doesn't exist. */ public Species getSpecies(String id) { @@ -3103,11 +3112,11 @@ } /** - * Gets the nth {@link SpeciesType} object in this Model. + * Gets the n<sup>th</sup> {@link SpeciesType} object in this Model. * * @param n * index - * @return the nth {@link SpeciesType} of this Model. Returns <code>null</code> if there + * @return the n<sup>th</sup> {@link SpeciesType} of this Model. Returns {@code null} if there * are no speciesType defined or if the index n is too big or lower * than zero. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. @@ -3123,7 +3132,7 @@ * * @param id * @return the {@link SpeciesType} of the {@link #listOfSpeciesTypes} which has 'id' as - * id (or name depending on the level and version). <code>null</code> if it doesn't + * id (or name depending on the level and version). {@code null} if it doesn't * exist. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -3202,7 +3211,7 @@ * {@link Model} as id. * * @return the {@link UnitDefinition} which has the {@link #substanceUnitsID} of this - * {@link Model} as id. <code>null</code> if it doesn't exist. + * {@link Model} as id. {@code null} if it doesn't exist. */ public UnitDefinition getSubstanceUnitsInstance() { return getUnitDefinition(getSubstanceUnits()); @@ -3240,7 +3249,7 @@ * {@link Model}. * * @return the {@link UnitDefinition} representing the time units of this - * {@link Model}, <code>null</code> if it is not defined in this {@link Model} + * {@link Model}, {@code null} if it is not defined in this {@link Model} */ public UnitDefinition getTimeUnitsInstance() { return getUnitDefinition(getTimeUnits()); @@ -3275,11 +3284,11 @@ } /** - * Gets the nth {@link UnitDefinition} object in this {@link Model}. + * Gets the n<sup>th</sup> {@link UnitDefinition} object in this {@link Model}. * * @param n - * @return the nth {@link UnitDefinition} of this {@link Model}. Returns - * <code>null</code> if there are no {@link UnitDefinition}s defined + * @return the n<sup>th</sup> {@link UnitDefinition} of this {@link Model}. Returns + * {@code null} if there are no {@link UnitDefinition}s defined * or if the index n is too big or lower than zero. */ public UnitDefinition getUnitDefinition(int n) { @@ -3290,12 +3299,12 @@ * Returns the {@link UnitDefinition} of the {@link #listOfUnitDefinitions} * which has 'id' as id. If no {@link UnitDefinition} are found, we check in the * {@link #listOfPredefinedUnitDefinitions}. If we still did not find a - * {@link UnitDefinition}, <code>null</code> is returned. + * {@link UnitDefinition}, {@code null} is returned. * * @param id * @return the {@link UnitDefinition} of the {@link #listOfUnitDefinitions}s * which has 'id' as id (or name depending on the level and version). - * <code>null</code> if it doesn't exist. + * {@code null} if it doesn't exist. */ public UnitDefinition getUnitDefinition(String id) { UnitDefinition unitDefinition = mapOfUnitDefinitions != null ? mapOfUnitDefinitions.get(id) : null; @@ -3327,7 +3336,7 @@ /** * Returns the volume units ID of this {@link Model}. * - * @return the volume nits ID of this {@link Model}. Returns an empty String + * @return the volume units ID of this {@link Model}. Returns an empty {@link String} * if it is not set. */ public String getVolumeUnits() { @@ -3344,7 +3353,7 @@ * of this {@link Model} as id. * * @return the {@link UnitDefinition} instance which has the {@link #volumeUnitsID} - * of this {@link Model} as id. <code>null</code> if it doesn't exist. + * of this {@link Model} as id. {@code null} if it doesn't exist. */ public UnitDefinition getVolumeUnitsInstance() { return getUnitDefinition(getVolumeUnits()); @@ -3481,31 +3490,35 @@ public boolean isIdMandatory() { return false; } - + /** - * Returns {@code true} if the area units ID of this Model is not <code>null</code>. + * Returns {@code true} if the area units ID of this {@link Model} is not + * {@code null}. * - * @return {@code true} if the area units ID of this Model is not <code>null</code>. + * @return {@code true} if the area units ID of this {@link Model} is not + * {@code null}. */ public boolean isSetAreaUnits() { return this.areaUnitsID != null; } - + /** - * Returns {@code true} if the UnitDefinition which has the area units ID of this - * Model as id is not <code>null</code>. + * Returns {@code true} if the {@link UnitDefinition} which has the area units + * ID of this {@link Model} as id is not {@code null}. * - * @return {@code true} if the UnitDefinition which has the area units ID of this - * Model as id is not <code>null</code>. + * @return {@code true} if the {@link UnitDefinition} which has the area units + * ID of this {@link Model} as id is not {@code null}. */ public boolean isSetAreaUnitsInstance() { return getAreaUnitsInstance() != null; } - + /** - * Returns {@code true} if the conversionFactorID of this Model is not <code>null</code>. + * Returns {@code true} if the {@link #conversionFactorID} of this + * {@link Model} is not {@code null}. * - * @return {@code true} if the conversionFactorID of this Model is not <code>null</code>. + * @return {@code true} if the {@link #conversionFactorID} of this + * {@link Model} is not {@code null}. */ public boolean isSetConversionFactor() { return this.conversionFactorID != null; @@ -3513,19 +3526,19 @@ /** * Returns {@code true} if the Parameter which has the conversionFactorID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. * * @return {@code true} if the Parameter which has the conversionFactorID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. */ public boolean isSetConversionFactorInstance() { return getParameter(this.conversionFactorID) != null; } /** - * Returns {@code true} if the extentUnitsID of this Model is not <code>null</code>. + * Returns {@code true} if the extentUnitsID of this Model is not {@code null}. * - * @return {@code true} if the extentUnitsID of this Model is not <code>null</code>. + * @return {@code true} if the extentUnitsID of this Model is not {@code null}. */ public boolean isSetExtentUnits() { return this.extentUnitsID != null; @@ -3533,19 +3546,19 @@ /** * Returns {@code true} if the UnitDefinition which has the extentUnitsID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. * * @return {@code true} if the UnitDefinition which has the extentUnitsID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. */ public boolean isSetExtentUnitsInstance() { return getExtentUnitsInstance() != null; } /** - * Returns {@code true} if the lengthUnitsID of this Model is not <code>null</code>. + * Returns {@code true} if the lengthUnitsID of this Model is not {@code null}. * - * @return {@code true} if the lengthUnitsID of this Model is not <code>null</code>. + * @return {@code true} if the lengthUnitsID of this Model is not {@code null}. */ public boolean isSetLengthUnits() { return this.lengthUnitsID != null; @@ -3553,20 +3566,20 @@ /** * Returns {@code true} if the UnitDefinition which has the lengthUnitsID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. * * @return {@code true} if the UnitDefinition which has the lengthUnitsID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. */ public boolean isSetLengthUnitsInstance() { return getLengthUnitsInstance() != null; } /** - * Returns {@code true} if the listOfCompartments of this Model is not <code>null</code> and not + * Returns {@code true} if the listOfCompartments of this Model is not {@code null} and not * empty. * - * @return {@code true} if the listOfCompartments of this Model is not <code>null</code> and not + * @return {@code true} if the listOfCompartments of this Model is not {@code null} and not * empty. */ public boolean isSetListOfCompartments() { @@ -3574,10 +3587,10 @@ } /** - * Returns {@code true} if the listOfCompartmentTypes of this Model is not <code>null</code> and + * Returns {@code true} if the listOfCompartmentTypes of this Model is not {@code null} and * not empty. * - * @return {@code true} if the listOfCompartmentTypes of this Model is not <code>null</code> and + * @return {@code true} if the listOfCompartmentTypes of this Model is not {@code null} and * not empty. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -3588,10 +3601,10 @@ } /** - * Returns {@code true} if the listOfConstraints of this Model is not <code>null</code> and not + * Returns {@code true} if the listOfConstraints of this Model is not {@code null} and not * empty. * - * @return {@code true} if the listOfConstraints of this Model is not <code>null</code> and not + * @return {@code true} if the listOfConstraints of this Model is not {@code null} and not * empty. */ public boolean isSetListOfConstraints() { @@ -3599,19 +3612,19 @@ } /** - * Returns {@code true} if the listOfEvents of this Model is not <code>null</code> and not empty. + * Returns {@code true} if the listOfEvents of this Model is not {@code null} and not empty. * - * @return {@code true} if the listOfEvents of this Model is not <code>null</code> and not empty. + * @return {@code true} if the listOfEvents of this Model is not {@code null} and not empty. */ public boolean isSetListOfEvents() { return (listOfEvents != null) && (listOfEvents.size() > 0); } /** - * Returns {@code true} if the listOfFunctionDefinitions of this Model is not <code>null</code> and + * Returns {@code true} if the listOfFunctionDefinitions of this Model is not {@code null} and * not empty. * - * @return {@code true} if the listOfFunctionDefinitions of this Model is not <code>null</code> and + * @return {@code true} if the listOfFunctionDefinitions of this Model is not {@code null} and * not empty. */ public boolean isSetListOfFunctionDefinitions() { @@ -3620,10 +3633,10 @@ } /** - * Returns {@code true} if the listOfInitialAssignments of this Model is not <code>null</code> and + * Returns {@code true} if the listOfInitialAssignments of this Model is not {@code null} and * not empty. * - * @return {@code true} if the listOfInitialAssignments of this Model is not <code>null</code> and + * @return {@code true} if the listOfInitialAssignments of this Model is not {@code null} and * not empty. */ public boolean isSetListOfInitialAssignments() { @@ -3632,10 +3645,10 @@ } /** - * Returns {@code true} if the listOfParameters of this Model is not <code>null</code> and not + * Returns {@code true} if the listOfParameters of this Model is not {@code null} and not * empty. * - * @return {@code true} if the listOfParameters of this Model is not <code>null</code> and not + * @return {@code true} if the listOfParameters of this Model is not {@code null} and not * empty. */ public boolean isSetListOfParameters() { @@ -3643,10 +3656,10 @@ } /** - * Returns {@code true} if the listOfReactions of this Model is not <code>null</code> and not + * Returns {@code true} if the listOfReactions of this Model is not {@code null} and not * empty. * - * @return {@code true} if the listOfReactions of this Model is not <code>null</code> and not + * @return {@code true} if the listOfReactions of this Model is not {@code null} and not * empty. */ public boolean isSetListOfReactions() { @@ -3654,28 +3667,28 @@ } /** - * Returns {@code true} if the listOfRules of this Model is not <code>null</code> and not empty. + * Returns {@code true} if the listOfRules of this Model is not {@code null} and not empty. * - * @return {@code true} if the listOfRules of this Model is not <code>null</code> and not empty. + * @return {@code true} if the listOfRules of this Model is not {@code null} and not empty. */ public boolean isSetListOfRules() { return (listOfRules != null) && (listOfRules.size() > 0); } /** - * Returns {@code true} if the listOfSpecies of this Model is not <code>null</code> and not empty. + * Returns {@code true} if the listOfSpecies of this Model is not {@code null} and not empty. * - * @return {@code true} if the listOfSpecies of this Model is not <code>null</code> and not empty. + * @return {@code true} if the listOfSpecies of this Model is not {@code null} and not empty. */ public boolean isSetListOfSpecies() { return (listOfSpecies != null) && (listOfSpecies.size() > 0); } /** - * Returns {@code true} if the listOfSpeciesTypes of this Model is not <code>null</code> and not + * Returns {@code true} if the listOfSpeciesTypes of this Model is not {@code null} and not * empty. * - * @return {@code true} if the listOfSpeciesTypes of this Model is not <code>null</code> and not + * @return {@code true} if the listOfSpeciesTypes of this Model is not {@code null} and not * empty. * @deprecated Only valid in SBML Level 2 for Versions 2 through 4. */ @@ -3685,10 +3698,10 @@ } /** - * Returns {@code true} if the listOfUnitDefinitions of this Model is not <code>null</code> and not + * Returns {@code true} if the listOfUnitDefinitions of this Model is not {@code null} and not * empty. * - * @return {@code true} if the listOfUnitDefinitions of this Model is not <code>null</code> and not + * @return {@code true} if the listOfUnitDefinitions of this Model is not {@code null} and not * empty. */ public boolean isSetListOfUnitDefinitions() { @@ -3709,9 +3722,9 @@ } /** - * Returns {@code true} if the substanceUnitsID of this Model is not <code>null</code>. + * Returns {@code true} if the substanceUnitsID of this Model is not {@code null}. * - * @return {@code true} if the substanceUnitsID of this Model is not <code>null</code>. + * @return {@code true} if the substanceUnitsID of this Model is not {@code null}. */ public boolean isSetSubstanceUnits() { return this.substanceUnitsID != null; @@ -3719,19 +3732,19 @@ /** * Returns {@code true} if the UnitDefinition which has the substanceUnitsID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. * * @return {@code true} if the UnitDefinition which has the substanceUnitsID of this - * Model as id is not <code>null</code>. + * Model as id is not {@code null}. */ public boolean isSetSubstanceUnitsInstance() { return getSubstanceUnitsInstance() != null; } /** - * Returns {@code true} if the timeUnitsID of this {@link Model} is not <code>null</code>. + * Returns {@code true} if the timeUnitsID of this {@link Model} is not {@code null}. * - * @return {@code true} if the timeUnitsID of this {@link Model} is not <code>null</code>. + * @return {@code true} if the timeUnitsID of this {@link Model} is not {@code null}. */ public boolean isSetTimeUni... [truncated message content] |
From: <and...@us...> - 2012-09-11 10:24:00
|
Revision: 1417 http://jsbml.svn.sourceforge.net/jsbml/?rev=1417&view=rev Author: andreas-draeger Date: 2012-09-11 10:23:46 +0000 (Tue, 11 Sep 2012) Log Message: ----------- Added a new convenient function to check if a UnitDefinition represents a predefined unit (such as area, length etc.) and updated JavaDoc entries to use {@code ...} instead of <code>...</code>. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/ASTNode.java trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/AnnotationElement.java trunk/core/src/org/sbml/jsbml/Assignment.java trunk/core/src/org/sbml/jsbml/CVTerm.java trunk/core/src/org/sbml/jsbml/Event.java trunk/core/src/org/sbml/jsbml/FunctionDefinition.java trunk/core/src/org/sbml/jsbml/ListOf.java trunk/core/src/org/sbml/jsbml/LocalParameter.java trunk/core/src/org/sbml/jsbml/MathContainer.java trunk/core/src/org/sbml/jsbml/NamedSBase.java trunk/core/src/org/sbml/jsbml/Reaction.java trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java trunk/core/src/org/sbml/jsbml/SBO.java trunk/core/src/org/sbml/jsbml/SBase.java trunk/core/src/org/sbml/jsbml/SBaseWithDerivedUnit.java trunk/core/src/org/sbml/jsbml/Species.java trunk/core/src/org/sbml/jsbml/Unit.java trunk/core/src/org/sbml/jsbml/UnitDefinition.java trunk/core/src/org/sbml/jsbml/util/DocumentFactory.java trunk/core/src/org/sbml/jsbml/util/JAXPFacade.java trunk/core/src/org/sbml/jsbml/util/SAX2Parser.java trunk/core/src/org/sbml/jsbml/util/StringTools.java trunk/core/src/org/sbml/jsbml/util/SubModel.java trunk/core/src/org/sbml/jsbml/util/TreeNodeAdapter.java trunk/core/src/org/sbml/jsbml/xml/XMLAttributes.java trunk/core/src/org/sbml/jsbml/xml/XMLNamespaces.java trunk/core/src/org/sbml/jsbml/xml/XMLToken.java trunk/core/src/org/sbml/jsbml/xml/XMLTriple.java trunk/core/src/org/sbml/jsbml/xml/stax/SBMLReader.java trunk/examples/sbmlbargraph/src/org/sbml/bargraph/Config.java trunk/examples/sbmlbargraph/src/org/sbml/bargraph/VerifiableFile.java trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/Group.java trunk/extensions/groups/src/org/sbml/jsbml/ext/groups/GroupModel.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Curve.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ExtendedLayoutModel.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/Layout.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/ReactionGlyph.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/MultiSpecies.java trunk/extensions/multi/src/org/sbml/jsbml/ext/multi/ReactionRule.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/QualitativeModel.java trunk/extensions/qual/src/org/sbml/jsbml/ext/qual/Transition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/AbstractRenderPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/ColorDefinition.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Curve.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Ellipse.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/FontRenderStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GlobalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GradientStop.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive1D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/GraphicalPrimitive2D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Group.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Image.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LineEnding.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LinearGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalRenderInformation.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/LocalStyle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Point3D.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Polygon.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RadialGradient.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Rectangle.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderCubicBezier.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderInformationBase.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderLayoutPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/RenderListOfLayoutsPlugin.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Style.java trunk/extensions/render/src/org/sbml/jsbml/ext/render/Transformation2D.java Modified: trunk/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/ASTNode.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -2428,7 +2428,7 @@ * {@link Kind}, the created {@link UnitDefinition} will not be part of the * model, it is just a container for the {@link Kind}. * - * @return A {@link UnitDefinition} or <code>null</code>. + * @return A {@link UnitDefinition} or {@code null}. */ public UnitDefinition getUnitsInstance() { MathContainer parent = getParentSBMLObject(); Modified: trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -188,7 +188,7 @@ * @param sID * the identifier to be checked. If null or an invalid * identifier, an exception will be thrown. - * @return <code>true</code> only if the sID is a valid identifier. + * @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 Modified: trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/AbstractNamedSBaseWithUnit.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -54,7 +54,7 @@ /** * Initializes a new object of type {@link AbstractNamedSBaseWithUnit} whose - * identifier and name are set to <code>null</code> and whose level and + * identifier and name are set to {@code null} and whose level and * version are set to -1 each. */ public AbstractNamedSBaseWithUnit() { Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -646,7 +646,7 @@ * * @param sbase * the element to be checked. - * @return <code>true</code> if the given <code>sbase</code> and this object + * @return {@code true} if the given <code>sbase</code> and this object * have the same L/V configuration. * @throws LevelVersionError * In case the given {@link SBase} has a different, but defined Modified: trunk/core/src/org/sbml/jsbml/AnnotationElement.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AnnotationElement.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/AnnotationElement.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -40,7 +40,7 @@ /** * Creates a new empty {@link AnnotationElement} without any children, an * empty list of {@link TreeNodeChangeListener}s, and a parent that is - * <code>null</code>. + * {@code null}. */ public AnnotationElement() { super(); Modified: trunk/core/src/org/sbml/jsbml/Assignment.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Assignment.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/Assignment.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -40,7 +40,7 @@ /** * Error message to be displayed in case that a {@link Variable} with - * constant property set to <code>true</code> is to be assigned to this + * constant property set to {@code true} is to be assigned to this * {@link Assignment}. */ public static final String ILLEGAL_CONSTANT_VARIABLE_MSG = "Cannot set the constant variable %s as the target of this %s."; Modified: trunk/core/src/org/sbml/jsbml/CVTerm.java =================================================================== --- trunk/core/src/org/sbml/jsbml/CVTerm.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/CVTerm.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -181,9 +181,9 @@ } /** - * Returns <code>true</code> if this qualifier is a biological qualifier. + * Returns {@code true} if this qualifier is a biological qualifier. * - * @return <code>true</code> if this qualifier is a biological qualifier, + * @return {@code true} if this qualifier is a biological qualifier, * false otherwise. */ public boolean isBiologicalQualifier() { @@ -191,10 +191,10 @@ } /** - * Returns <code>true</code> if this qualifier is a model qualifier. + * Returns {@code true} if this qualifier is a model qualifier. * - * @return <code>true</code> if this qualifier is a model qualifier, - * <code>false</code> otherwise. + * @return {@code true} if this qualifier is a model qualifier, + * {@code false} otherwise. */ public boolean isModelQualifier() { return toString().startsWith("BQM_"); @@ -378,7 +378,7 @@ * @param urn * string representing the resource; e.g., * 'urn:miriam:kegg.reaction:R00351' - * @return <code>true</code> as specified in {@link Collection#add(Object)} + * @return {@code true} as specified in {@link Collection#add(Object)} */ public boolean addResource(String urn) { boolean contains = resourceURIs.contains(urn); @@ -394,7 +394,7 @@ * * @param resources a list of strings representing the resources; e.g., * 'urn:miriam:kegg.reaction:R00351' - * @return <code>true</code> if all the resources have been added properly. + * @return {@code true} if all the resources have been added properly. */ public boolean addResources(String... resources) { boolean success = true; @@ -413,7 +413,7 @@ * string representing the resource; e.g., * 'urn:miriam:kegg.reaction:R00351' * - * @return <code>true</code> if 'uri' has been added to the list of resourceURI of this + * @return {@code true} if 'uri' has been added to the list of resourceURI of this * CVTerm. */ public boolean addResourceURI(String uri) { @@ -572,20 +572,20 @@ } /** - * Returns <code>true</code> if this qualifier is a biological qualifier. + * Returns {@code true} if this qualifier is a biological qualifier. * - * @return <code>true</code> if this qualifier is a biological qualifier, - * <code>false</code> otherwise. + * @return {@code true} if this qualifier is a biological qualifier, + * {@code false} otherwise. */ public boolean isBiologicalQualifier() { return type.equals(Type.BIOLOGICAL_QUALIFIER); } /** - * Returns <code>true</code> if this qualifier is a model qualifier. + * Returns {@code true} if this qualifier is a model qualifier. * - * @return <code>true</code> if this qualifier is a model qualifier, - * <code>false</code> otherwise. + * @return {@code true} if this qualifier is a model qualifier, + * {@code false} otherwise. */ public boolean isModelQualifier() { return type.equals(Type.MODEL_QUALIFIER); @@ -616,19 +616,19 @@ } /** - * Returns <code>true</code> if the Type of this CVTerm is set. + * Returns {@code true} if the Type of this CVTerm is set. * - * @return <code>true</code> if the Type of this CVTerm is set. + * @return {@code true} if the Type of this CVTerm is set. */ public boolean isSetType() { return (type != null) && !type.equals(Type.UNKNOWN_QUALIFIER); } /** - * Returns <code>true</code> if the {@link Qualifier} of this {@link CVTerm} + * Returns {@code true} if the {@link Qualifier} of this {@link CVTerm} * is set. * - * @return <code>true</code> if the {@link Qualifier} of this {@link CVTerm} + * @return {@code true} if the {@link Qualifier} of this {@link CVTerm} * is set. */ public boolean isSetTypeQualifier() { Modified: trunk/core/src/org/sbml/jsbml/Event.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Event.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/Event.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -168,7 +168,7 @@ * Event. * * @param eventass - * @return <code>true</code> if the {@link #listOfEventAssignments} was + * @return {@code true} if the {@link #listOfEventAssignments} was * changed as a result of this call. */ public boolean addEventAssignment(EventAssignment eventass) { @@ -933,7 +933,7 @@ * Removes the {@link #listOfEventAssignments} from this {@link Model} and * notifies all registered instances of {@link TreeNodeChangeListener}. * - * @return <code>true</code> if calling this method lead to a change in this + * @return {@code true} if calling this method lead to a change in this * data structure. */ public boolean unsetListOfEventAssignments() { Modified: trunk/core/src/org/sbml/jsbml/FunctionDefinition.java =================================================================== --- trunk/core/src/org/sbml/jsbml/FunctionDefinition.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/FunctionDefinition.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -147,7 +147,7 @@ * @param sID * the identifier to be checked. If null or an invalid * identifier, an exception will be thrown. - * @return <code>true</code> only if the sID is a valid identifier. + * @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 Modified: trunk/core/src/org/sbml/jsbml/ListOf.java =================================================================== --- trunk/core/src/org/sbml/jsbml/ListOf.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/ListOf.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -315,7 +315,7 @@ /** * Allows you to influence the behavior of the {@link #toString()} method. - * If set to <code>true</code>, the whole content of this {@link ListOf} is + * If set to {@code true}, the whole content of this {@link ListOf} is * displayed by the {@link #toString()} method, just like it is done in * other {@link List} implementations. The default for JSBML, however, is, * to only display the {@link Type} of this list. Modified: trunk/core/src/org/sbml/jsbml/LocalParameter.java =================================================================== --- trunk/core/src/org/sbml/jsbml/LocalParameter.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/LocalParameter.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -184,13 +184,13 @@ * parameter represents a constant {@link Quantity}. However, per * definition, each local parameter has always been constant no matter if * its XML representation contains the <code>constant</code> attribute or - * not. Hence, this attribute could set to <code>true</code> only. This + * not. Hence, this attribute could set to {@code true} only. This * method checks if for this {@link LocalParameter} an explicit * <code>constant</code> flag has been set. * - * @return the isExplicitlySetConstant <code>true</code> if this + * @return the isExplicitlySetConstant {@code true} if this * {@link LocalParameter} contains an explicit <code>constant</code> - * flag, <code>false</code> otherwise. + * flag, {@code false} otherwise. */ public boolean isExplicitlySetConstant() { return isExplicitlySetConstant; @@ -224,7 +224,7 @@ /** * This method allows users to explicitly manipulate the * <code>constant</code> attribute of this {@link LocalParameter}. This - * attribute can set to <code>true</code> only. Therefore, this method does + * attribute can set to {@code true} only. Therefore, this method does * just decide whether or not the <code>constant</code> attribute should * occur in generated SBML code when serializing this {@link LocalParameter} * . Since this object always represents a constant {@link Quantity} this Modified: trunk/core/src/org/sbml/jsbml/MathContainer.java =================================================================== --- trunk/core/src/org/sbml/jsbml/MathContainer.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/MathContainer.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -112,7 +112,7 @@ /** * Sets the current {@link ASTNode} math element of this - * {@link MathContainer} to <code>null</code> and notifies all + * {@link MathContainer} to {@code null} and notifies all * {@link TreeNodeChangeListener}s assigned to this object about this * change. */ Modified: trunk/core/src/org/sbml/jsbml/NamedSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/NamedSBase.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/NamedSBase.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -45,11 +45,11 @@ /** * This method can be used to query if the identifier of this - * {@link NamedSBase} is required to be defined (i.e., not <code>null</code>) + * {@link NamedSBase} is required to be defined (i.e., not {@code null}) * in the definition of SBML. * - * @return <code>true</code> if the identifier of this element must be set in - * order to create a valid SBML representation. <code>false</code> + * @return {@code true} if the identifier of this element must be set in + * order to create a valid SBML representation. {@code false} * otherwise, i.e., if the identifier can be understood as an optional * attribute. */ Modified: trunk/core/src/org/sbml/jsbml/Reaction.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Reaction.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/Reaction.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -173,7 +173,7 @@ * Adds a {@link ModifierSpeciesReference} instance to this {@link Reaction}. * * @param modspecref - * @return <code>true</code> if the {@link #listOfModifiers} was + * @return {@code true} if the {@link #listOfModifiers} was * changed as a result of this call. */ public boolean addModifier(ModifierSpeciesReference modspecref) { @@ -184,7 +184,7 @@ * Adds a {@link SpeciesReference} instance to the listOfProducts of this {@link Reaction}. * * @param specref - * @return <code>true</code> if the {@link #listOfProducts} was + * @return {@code true} if the {@link #listOfProducts} was * changed as a result of this call. */ public boolean addProduct(SpeciesReference specref) { @@ -195,7 +195,7 @@ * Adds a {@link SpeciesReference} instance to the listOfReactants of this {@link Reaction}. * * @param specref - * @return <code>true</code> if the {@link #listOfReactants} was + * @return {@code true} if the {@link #listOfReactants} was * changed as a result of this call. */ public boolean addReactant(SpeciesReference specref) { @@ -1293,7 +1293,7 @@ * Sets the {@link KineticLaw} of this {@link Reaction} to null and notifies * all {@link TreeNodeChangeListener} about changes. * - * @return <code>true</code> if calling this method changed the properties + * @return {@code true} if calling this method changed the properties * of this element. */ public boolean unsetKineticLaw() { @@ -1310,7 +1310,7 @@ * Removes the {@link #listOfModifiers} from this {@link Reaction} and notifies * all registered instances of {@link TreeNodeChangeListener}. * - * @return <code>true</code> if calling this method lead to a change in this + * @return {@code true} if calling this method lead to a change in this * data structure. */ public boolean unsetListOfModifiers() { @@ -1327,7 +1327,7 @@ * Removes the {@link #listOfProducts} from this {@link Reaction} and notifies * all registered instances of {@link TreeNodeChangeListener}. * - * @return <code>true</code> if calling this method lead to a change in this + * @return {@code true} if calling this method lead to a change in this * data structure. */ public boolean unsetListOfProducts() { @@ -1344,7 +1344,7 @@ * Removes the {@link #listOfReactants} from this {@link Reaction} and notifies * all registered instances of {@link TreeNodeChangeListener}. * - * @return <code>true</code> if calling this method lead to a change in this + * @return {@code true} if calling this method lead to a change in this * data structure. */ public boolean unsetListOfReactants() { Modified: trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -97,12 +97,12 @@ * number of items in the log by using the * {@link #getNumErrors()} method. * Attempts to use an error index number that exceeds the actual number - * of errors in the log will result in a <code>null</code> being returned. + * of errors in the log will result in a {@code null} being returned. * <p> * @param n the index number of the error to retrieve (with 0 being the * first error). * <p> - * @return the <i>n</i>th {@link SBMLError} in this log, or <code>null</code> if <code>n</code> is + * @return the <i>n</i>th {@link SBMLError} in this log, or {@code null} if <code>n</code> is * greater than or equal to {@link #getNumErrors()}. * <p> * @see #getNumErrors() Modified: trunk/core/src/org/sbml/jsbml/SBO.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBO.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/SBO.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -1400,40 +1400,40 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isAntisenseRNA(int sboTerm) { return isChildOf(sboTerm, getAntisenseRNA()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isBindingActivator(int sboTerm) { return isChildOf(sboTerm, getBindingActivator()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isCatalyst(int sboTerm) { return isChildOf(sboTerm, getCatalyst()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isCatalyticActivator(int sboTerm) { return isChildOf(sboTerm, getCatalyticActivator()); @@ -1487,30 +1487,30 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isCompetetiveInhibitor(int sboTerm) { return isChildOf(sboTerm, getCompetetiveInhibitor()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isCompleteInhibitor(int sboTerm) { return isChildOf(sboTerm, getCompleteInhibitor()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isComplex(int sboTerm) { return isChildOf(sboTerm, getComplex()); @@ -1547,20 +1547,20 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isDrug(int sboTerm) { return isChildOf(sboTerm, getDrug()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isEmptySet(int sboTerm) { return isChildOf(sboTerm, getEmptySet()); @@ -1577,20 +1577,20 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isEnzymaticCatalysis(int sboTerm) { return isChildOf(sboTerm, getEnzymaticCatalysis()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isEssentialActivator(int sboTerm) { return isChildOf(sboTerm, getEssentialActivator()); @@ -1627,10 +1627,10 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isGene(int sboTerm) { return isChildOf(sboTerm, getGene()); @@ -1661,30 +1661,30 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isGeneric(int sboTerm) { return isChildOf(sboTerm, getGeneric()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isHillEquation(int sboTerm) { return isChildOf(sboTerm, getHillEquation()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isInhibitor(int sboTerm) { return isChildOf(sboTerm, getInhibitor()); @@ -1701,20 +1701,20 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isIon(int sboTerm) { return isChildOf(sboTerm, getIon()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isIonChannel(int sboTerm) { return isChildOf(sboTerm, getIonChannel()); @@ -1761,10 +1761,10 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isMessengerRNA(int sboTerm) { return isChildOf(sboTerm, getMessengerRNA()); @@ -1791,20 +1791,20 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isNonCompetetiveInhibitor(int sboTerm) { return isChildOf(sboTerm, getNonCompetetiveInhibitor()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isNonEssentialActivator(int sboTerm) { return isChildOf(sboTerm, getNonEssentialActivator()); @@ -1821,10 +1821,10 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isPartialInhibitor(int sboTerm) { return isChildOf(sboTerm, getPartialInhibitor()); @@ -1852,20 +1852,20 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isPhenotype(int sboTerm) { return isChildOf(sboTerm, getPhenotype()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isPhysicalCompartment(int sboTerm) { return isChildOf(sboTerm, getPhysicalCompartment()); @@ -1893,10 +1893,10 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isProtein(int sboTerm) { return isChildOf(sboTerm, getProtein()); @@ -1933,60 +1933,60 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isReceptor(int sboTerm) { return isChildOf(sboTerm, getReceptor()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isRNA(int sboTerm) { return isChildOf(sboTerm, getRNA()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isRNAOrMessengerRNA(int sboTerm) { return isRNA(sboTerm) || isMessengerRNA(sboTerm); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isSimpleMolecule(int sboTerm) { return isChildOf(sboTerm, getSimpleMolecule()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isSpecificActivator(int sboTerm) { return isChildOf(sboTerm, getSpecificActivator()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isStateTransition(int sboTerm) { return isChildOf(sboTerm, getStateTransition()); @@ -2003,130 +2003,130 @@ } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isStimulator(int sboTerm) { return isChildOf(sboTerm, getStimulator()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTranscription(int sboTerm) { return isChildOf(sboTerm, getTranscription()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTranscriptionalActivation(int sboTerm) { return isChildOf(sboTerm, getTranscriptionalActivation()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTranscriptionalInhibitor(int sboTerm) { return isChildOf(sboTerm, getTranscriptionalInhibitor()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTransitionOmitted(int sboTerm) { return isChildOf(sboTerm, getTransitionOmitted()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTranslation(int sboTerm) { return isChildOf(sboTerm, getTranslation()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTranslationalActivation(int sboTerm) { return isChildOf(sboTerm, getTranslationalActivation()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTranslationalInhibitor(int sboTerm) { return isChildOf(sboTerm, getTranslationalInhibitor()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTransport(int sboTerm) { return isChildOf(sboTerm, getTransport()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTrigger(int sboTerm) { return isChildOf(sboTerm, getTrigger()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isTruncated(int sboTerm) { return isChildOf(sboTerm, getTruncated()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isUnknownMolecule(int sboTerm) { return isChildOf(sboTerm, getUnknownMolecule()); } /** - * Returns <code>true</code> if the given term identifier comes from the stated branch of SBO. + * Returns {@code true} if the given term identifier comes from the stated branch of SBO. * <p> * @param sboTerm - * @return <code>true</code> if <code>term</code> is-a SBO <em>'product'</em>, <code>false</code> otherwise. + * @return {@code true} if <code>term</code> is-a SBO <em>'product'</em>, {@code false} otherwise. */ public static boolean isUnknownTransition(int sboTerm) { return isChildOf(sboTerm, getUnknownTransition()); Modified: trunk/core/src/org/sbml/jsbml/SBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBase.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/SBase.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -43,7 +43,7 @@ /** * @param term - * @return <code>true</code> if a {@link CVTerm} instance has been added to + * @return {@code true} if a {@link CVTerm} instance has been added to * the list of {@link CVTerm} of this object. */ public boolean addCVTerm(CVTerm term); @@ -100,11 +100,11 @@ public SBase clone(); /** - * Returns <code>true</code> if and only if the given {@link SBase} has exactly the same + * Returns {@code true} if and only if the given {@link SBase} has exactly the same * properties like this {@link SBase} instance. * * @param sbase - * @return <code>true</code> if and only if the given {@link Object} is an instance of + * @return {@code true} if and only if the given {@link Object} is an instance of * {@link SBase} that has exactly the same properties like this * SBase instance. */ @@ -351,13 +351,13 @@ /** * - * @return <code>true</code> if the {@link Annotation} 'about' {@link String} of this + * @return {@code true} if the {@link Annotation} 'about' {@link String} of this * object matches the metaid of this object. */ public boolean hasValidAnnotation(); /** - * Predicate returning <code>true</code> or <code>false</false> depending on whether this object's + * Predicate returning {@code true} or <code>false</false> depending on whether this object's * level/version and name space values correspond to a valid SBML * specification. * @@ -367,15 +367,15 @@ /** * - * @return <code>true</code> if this object is extended by other packages. + * @return {@code true} if this object is extended by other packages. */ public boolean isExtendedByOtherPackages(); /** - * Predicate returning <code>true</code> or <code>false</false> depending on whether this object's + * Predicate returning {@code true} or <code>false</false> depending on whether this object's * 'annotation' sub-element exists and has content. * - * @return <code>true</code> if the {@link Annotation} instance of this object is not + * @return {@code true} if the {@link Annotation} instance of this object is not * <code>null</false> and contains at least one {@link CVTerm} or one * {@link String} containing other annotations than RDF or a * {@link History} instance. @@ -384,38 +384,38 @@ /** * - * @return <code>true</code> if the {@link Annotation} instance of this object + * @return {@code true} if the {@link Annotation} instance of this object */ public boolean isSetHistory(); /** * - * @return <code>true</code> if the level is not <code>null</false>. + * @return {@code true} if the level is not <code>null</false>. */ public boolean isSetLevel(); /** - * Returns <code>true</code> if both, Level and Version are set for this + * Returns {@code true} if both, Level and Version are set for this * {@link SBase}. * - * @return <code>true</code> if {@link #isSetLevel()} and + * @return {@code true} if {@link #isSetLevel()} and * {@link #isSetVersion()}. */ public boolean isSetLevelAndVersion(); /** - * Predicate returning <code>true</code> or <code>false</false> depending on whether this object's + * Predicate returning {@code true} or <code>false</false> depending on whether this object's * 'metaid' attribute has been set. * - * @return <code>true</code> if the metaid is not <code>null</false>. + * @return {@code true} if the metaid is not <code>null</false>. */ public boolean isSetMetaId(); /** - * Predicate returning <code>true</code> or <code>false</false> depending on whether this object's + * Predicate returning {@code true} or <code>false</false> depending on whether this object's * 'notes' sub-element exists and has content. * - * @return <code>true</code> if the notes {@link String} is not <code>null</false>. + * @return {@code true} if the notes {@link String} is not <code>null</false>. */ public boolean isSetNotes(); @@ -423,22 +423,22 @@ * Check whether this {@link SBase} has been linked to a parent within the * hierarchical SBML data structure. * - * @return <code>true</code> if this {@link SBase} has a parent SBML object, - * <code>false</code> otherwise. + * @return {@code true} if this {@link SBase} has a parent SBML object, + * {@code false} otherwise. * @see #getParentSBMLObject() */ public boolean isSetParentSBMLObject(); /** * - * @return <code>true</code> if the SBOTerm is not -1. + * @return {@code true} if the SBOTerm is not -1. * @see SBO */ public boolean isSetSBOTerm(); /** * - * @return <code>true</code> if the version is not <code>null</false>. + * @return {@code true} if the version is not <code>null</false>. */ public boolean isSetVersion(); @@ -452,7 +452,7 @@ * : prefix of the XML attribute * @param value * : value of the XML attribute - * @return <code>true</code> if the attribute has been successfully read. + * @return {@code true} if the attribute has been successfully read. */ public boolean readAttribute(String attributeName, String prefix, String value); Modified: trunk/core/src/org/sbml/jsbml/SBaseWithDerivedUnit.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBaseWithDerivedUnit.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/SBaseWithDerivedUnit.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -34,7 +34,7 @@ public interface SBaseWithDerivedUnit extends SBase { /** - * Returns <code>true</code> or <code>false</code> depending on whether this + * Returns {@code true} or {@code false} depending on whether this * {@link SBaseWithDerivedUnit} refers to elements such as parameters or * numbers with undeclared units. * @@ -42,9 +42,9 @@ * returned by {@see getDerivedUnitDefinition()} may not accurately * represent the units of the expression. * - * @return <code>true</code> if the math expression of this {@link SBaseWithDerivedUnit} + * @return {@code true} if the math expression of this {@link SBaseWithDerivedUnit} * includes parameters/numbers with undeclared units, - * <code>false</code> otherwise. + * {@code false} otherwise. */ public boolean containsUndeclaredUnits(); Modified: trunk/core/src/org/sbml/jsbml/Species.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Species.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/Species.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -432,12 +432,12 @@ * corresponding {@link UnitDefinition} from the {@link Model} to which this * {@link Species} belongs will be returned. Otherwise, the size unit from * the surrounding {@link Compartment} of this {@link Species} will be - * returned. If this also fails, <code>null</code> will be returned. + * returned. If this also fails, {@code null} will be returned. * * @return The {@link UnitDefinition} instance which as the * {@link #spatialSizeUnitsID} of this {@link Species} as id or the * size unit of the surrounding {@link Compartment}. - * <code>Null</code> if it doesn't exist. + * {@code null} if it doesn't exist. * @deprecated Only valid for SBML Level 2 Versions 1 and 2. */ @Deprecated @@ -655,8 +655,8 @@ } /** - * @return <code>true</code> if the spatialSizeUnits of this {@link Species} - * is not <code>null</code>. + * @return {@code true} if the spatialSizeUnits of this {@link Species} + * is not {@code null}. * @deprecated Only valid for SBML Level 2 Versions 1 and 2. */ @Deprecated @@ -665,9 +665,9 @@ } /** - * @return <code>true</code> if the {@link UnitDefinition} which has the + * @return {@code true} if the {@link UnitDefinition} which has the * spatialSizeUnitsID of - * this {@link Species} as id is not <code>null</code>. + * this {@link Species} as id is not {@code null}. * @deprecated Only valid for SBML Level 2 Versions 1 and 2. */ @Deprecated @@ -971,7 +971,7 @@ * for inapropriate Level/Version combinations. * @throws SBMLException * in case that {@link #hasOnlySubstanceUnits()} is set to - * <code>true</code> or the spatial dimensions of the surrounding + * {@code true} or the spatial dimensions of the surrounding * compartment are zero. */ @Deprecated @@ -1020,7 +1020,7 @@ * for inapropriate Level/Version combinations. * @throws SBMLException * in case that {@link #hasOnlySubstanceUnits()} is set to - * <code>true</code> or the spatial dimensions of the surrounding + * {@code true} or the spatial dimensions of the surrounding * compartment are zero. */ @Deprecated Modified: trunk/core/src/org/sbml/jsbml/Unit.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Unit.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/Unit.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -326,7 +326,7 @@ * the SBML level. * @param version * the SBML version. - * @return <code>true</code> if the given string is valid for the + * @return {@code true} if the given string is valid for the * particular SBML level and version, false otherwise. * @see Unit#isPredefined(String, int) */ @@ -888,9 +888,9 @@ * the Level of SBML for which the determination should be made. * This is necessary because there are a few small differences in * allowed units between SBML Level 1 and Level 2. - * @return <code>true</code>, if name is one of the five SBML predefined + * @return {@code true}, if name is one of the five SBML predefined * unit identifiers ('substance', 'volume', 'area', 'length' or - * 'time'), <code>false</code> otherwise. The predefined unit + * 'time'), {@code false} otherwise. The predefined unit * identifiers 'length' and 'area' were added in Level 2 Version 1 * @deprecated use {@link #isPredefined(String, int)} */ @@ -910,9 +910,9 @@ * the Level of SBML for which the determination should be made. * This is necessary because there are a few small differences in * allowed units between SBML Level 1 and Level 2. - * @return <code>true</code>, if name is one of the five SBML predefined + * @return {@code true}, if name is one of the five SBML predefined * unit identifiers ('substance', 'volume', 'area', 'length' or - * 'time'), <code>false</code> otherwise. The predefined unit + * 'time'), {@code false} otherwise. The predefined unit * identifiers 'length' and 'area' were added in Level 2 Version 1 */ public static boolean isPredefined(String name, int level) { @@ -931,6 +931,22 @@ return false; } + /** + * Tests whether the given {@link UnitDefinition} belongs to the predefined + * SBML units. + * + * @param ud + * the {@link UnitDefinition} to test. + * @return {@code true}, if name is one of the five SBML predefined + * unit identifiers ('substance', 'volume', 'area', 'length' or + * 'time'), {@code false} otherwise. The predefined unit + * identifiers 'length' and 'area' were added in Level 2 Version 1 + * @see #isPredefined(String, int) + */ + public static boolean isPredefined(UnitDefinition ud) { + return isPredefined(ud.getId(), ud.getLevel()); + } + /** * * @param kind Modified: trunk/core/src/org/sbml/jsbml/UnitDefinition.java =================================================================== --- trunk/core/src/org/sbml/jsbml/UnitDefinition.java 2012-09-10 13:17:54 UTC (rev 1416) +++ trunk/core/src/org/sbml/jsbml/UnitDefinition.java 2012-09-11 10:23:46 UTC (rev 1417) @@ -87,7 +87,7 @@ /** * <p> - * Predicate returning <code>true</code> or <code>false</code> depending on + * Predicate returning {@code true} or {@code false} depending on * whether two UnitDefinition objects are compatible. * </p> * <p> @@ -102,8 +102,8 @@ * the first {@link UnitDefinition} object to compare * @param ud2 * the second {@link UnitDefinition} object to compare - * @return <code>true</code> if all the {@link Unit} objects in ud1 are - * compatible to the {@link Unit} objects in ud2, <code>false</code> + * @return {@code true} if all the {@link Unit} objects in ud1 are + * compatible to the {@link Unit} objects in ud2, {@code false} ... [truncated message content] |
From: <and...@us...> - 2012-09-28 12:04:37
|
Revision: 1419 http://jsbml.svn.sourceforge.net/jsbml/?rev=1419&view=rev Author: andreas-draeger Date: 2012-09-28 12:04:26 +0000 (Fri, 28 Sep 2012) Log Message: ----------- Corrected a potential source for NullPointerExceptions in layout. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java Modified: trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java =================================================================== --- trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-09-19 12:40:29 UTC (rev 1418) +++ trunk/core/src/org/sbml/jsbml/util/SimpleTreeNodeChangeListener.java 2012-09-28 12:04:26 UTC (rev 1419) @@ -65,7 +65,7 @@ //@Override public void nodeAdded(TreeNode sb) { if (logger.isDebugEnabled()) { - logger.debug(MessageFormat.format("[ADD]\t{0}", sb)); + logger.debug(MessageFormat.format("[ADD]\t{0}", sb)); } } Modified: trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java =================================================================== --- trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java 2012-09-19 12:40:29 UTC (rev 1418) +++ trunk/extensions/layout/src/org/sbml/jsbml/ext/layout/NamedSBaseGlyph.java 2012-09-28 12:04:26 UTC (rev 1419) @@ -132,9 +132,9 @@ @Override public int hashCode() { final int prime = 983; - int result = super.hashCode(); - result = prime * result + (isSetNamedSBase() ? 0 : sbaseID.hashCode()); - return result; + int hashCode = super.hashCode(); + hashCode += prime * (isSetNamedSBase() ? sbaseID.hashCode() : 0); + return hashCode; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-10-04 15:51:49
|
Revision: 1423 http://jsbml.svn.sourceforge.net/jsbml/?rev=1423&view=rev Author: andreas-draeger Date: 2012-10-04 15:51:38 +0000 (Thu, 04 Oct 2012) Log Message: ----------- * New Features: - Syntax check for metaids in the setMetaId method. * Bug Fixes: - The method nextMetaId in SBMLDocument sometimes created metaIds containing the invalid character '-', but only underscores are allowed there. Modified Paths: -------------- trunk/NEWS.txt trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/SBMLDocument.java Modified: trunk/NEWS.txt =================================================================== --- trunk/NEWS.txt 2012-10-04 10:06:29 UTC (rev 1422) +++ trunk/NEWS.txt 2012-10-04 15:51:38 UTC (rev 1423) @@ -6,6 +6,8 @@ * New Features: + - Syntax check for metaids in the setMetaId method. + - Some additional methods for more convenient working with tree data structures in TreeNodeWithChangeSupport. @@ -63,6 +65,9 @@ * Bug Fixes: + - The method nextMetaId in SBMLDocument sometimes created metaIds containing + the invalid character '-', but only underscores are allowed there. + - Several improvements and corrections in the work with TreeNodeChangeListeners. In many cases listeners were notified too early or sometimes even not at all because of inconsistent Modified: trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-10-04 10:06:29 UTC (rev 1422) +++ trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-10-04 15:51:38 UTC (rev 1423) @@ -50,7 +50,7 @@ private static final String idChar = "[" + letter + digit + underscore + "]"; private static final String SIdL2 = "^[" + letter + underscore + "]" + idChar + '*'; private static final Pattern SIdL2Pattern = Pattern.compile(SIdL2); - + /** * Checks whether the given idCandidate is a valid identifier according to * the SBML specifications. @@ -300,8 +300,7 @@ * @see org.sbml.jsbml.NamedSBase#setId(java.lang.String) */ public void setId(String id) { - String property = getLevel() == 1 ? TreeNodeChangeEvent.name - : TreeNodeChangeEvent.id; + String property = getLevel() == 1 ? TreeNodeChangeEvent.name : TreeNodeChangeEvent.id; String oldId = this.id; Model model = getModel(); if ((oldId != null) && (model != null)) { Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-10-04 10:06:29 UTC (rev 1422) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2012-10-04 15:51:38 UTC (rev 1423) @@ -1430,6 +1430,11 @@ if ((metaId != null) && (getLevel() == 1)) { throw new PropertyNotAvailableException(TreeNodeChangeEvent.metaId, this); } + // Meta-ids must follow the same restrictions as Ids and are defined since Level 2 (checked above). + if ((metaId == null) || !AbstractNamedSBase.isValidId(metaId, getLevel(), getVersion())) { + throw new IllegalArgumentException(MessageFormat.format( + "\"{0}\" is not a valid meta-identifier for this {1}.", metaId, getElementName())); + } SBMLDocument doc = getSBMLDocument(); String oldMetaId = this.metaId; if (doc != null) { Modified: trunk/core/src/org/sbml/jsbml/SBMLDocument.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-10-04 10:06:29 UTC (rev 1422) +++ trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-10-04 15:51:38 UTC (rev 1423) @@ -693,26 +693,34 @@ } /** - * @return true if the model of this SBMLDocument is not null. + * @return true if the {@link Model} of this {@link SBMLDocument} is not {@code null}. */ public boolean isSetModel() { return model != null; } - /** - * - * @return - */ + /** + * Randomly creates a new {@link String} that can be used as a metaid, i.e., a + * String that is a valid metaid and that is not yet used by any other element + * within this {@link SBMLDocument}. + * + * @return + */ public String nextMetaId() { String idOne; do { - idOne = '_' + UUID.randomUUID().toString(); + idOne = UUID.randomUUID().toString().replace('-', '_'); + if (Character.isDigit(idOne.charAt(0))) { + // Add an underscore at the beginning of the new metaid only if necessary. + idOne = '_' + idOne; + } } while (containsMetaId(idOne)); return idOne; } /** * + * @param stream */ public void printErrors(PrintStream stream) { int nbErrors = listOfErrors.getErrorCount(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2012-10-21 09:51:37
|
Revision: 1428 http://jsbml.svn.sourceforge.net/jsbml/?rev=1428&view=rev Author: andreas-draeger Date: 2012-10-21 09:51:27 +0000 (Sun, 21 Oct 2012) Log Message: ----------- Renamed FBA package to FBC package (also all classes etc.) Modified Paths: -------------- trunk/NEWS.txt trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java trunk/core/src/org/sbml/jsbml/SBMLDocument.java trunk/core/src/org/sbml/jsbml/UnitDefinition.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FluxBound.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FluxObjective.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/package-info.java Added Paths: ----------- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCList.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCModel.java trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java Removed Paths: ------------- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBAList.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBAModel.java trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBAParser.java Modified: trunk/NEWS.txt =================================================================== --- trunk/NEWS.txt 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/NEWS.txt 2012-10-21 09:51:27 UTC (rev 1428) @@ -185,6 +185,25 @@ map between ids and local parameters, instead of the remove method. ====================================================================== +Version 0.8.1 (xx-xx-2012) +====================================================================== + +* New Features: + + - Some additional methods for more convenient working with tree data + structures in TreeNodeWithChangeSupport. + +* Bug Fixes: + + - Several improvements and corrections in the work with + TreeNodeChangeListeners. In many cases listeners were notified too + early or sometimes even not at all because of inconsistent + notification mechanisms. + + - The method nextMetaid in SBMLDocument could create identifiers + that contain dashes, but only underscores are allowed. + +====================================================================== Version 0.8.0 (24-08-2012) ====================================================================== Modified: trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml =================================================================== --- trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/core/resources/org/sbml/jsbml/resources/cfg/PackageParserNamespaces.xml 2012-10-21 09:51:27 UTC (rev 1428) @@ -38,7 +38,7 @@ <entry key="http://www.sbml.org/sbml/level3/version1/groups/version1">org.sbml.jsbml.xml.parsers.GroupsParser</entry> <entry key="http://projects.eml.org/bcb/sbml/level2">org.sbml.jsbml.xml.parsers.LayoutParser</entry> <entry key="http://www.sbml.org/sbml/level3/version1/groups/version1">org.sbml.jsbml.xml.parsers.GroupsParser</entry> - <entry key="http://www.sbml.org/sbml/level3/version1/fbc/version1">org.sbml.jsbml.xml.parsers.FBAParser</entry> + <entry key="http://www.sbml.org/sbml/level3/version1/fbc/version1">org.sbml.jsbml.xml.parsers.FBCParser</entry> <entry key="http://www.sbml.org/sbml/level3/version1/qual/version1">org.sbml.jsbml.xml.parsers.QualParser</entry> <entry key="http://www.sbml.org/sbml/level3/version1/layout/version1">org.sbml.jsbml.xml.parsers.L3LayoutParser</entry> <entry key="http://www.sbml.org/sbml/level3/version1/multi/version1">org.sbml.jsbml.xml.parsers.MultiParser</entry> Modified: trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/core/src/org/sbml/jsbml/AbstractNamedSBase.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -47,7 +47,7 @@ private static final String underscore = "_"; private static final String letter = "a-zA-Z"; private static final String digit = "0-9"; - private static final String idChar = "[" + letter + digit + underscore + "]"; + private static final String idChar = '[' + letter + digit + underscore + ']'; private static final String SIdL2 = "^[" + letter + underscore + "]" + idChar + '*'; private static final Pattern SIdL2Pattern = Pattern.compile(SIdL2); Modified: trunk/core/src/org/sbml/jsbml/SBMLDocument.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/core/src/org/sbml/jsbml/SBMLDocument.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -245,21 +245,21 @@ try { new SBMLWriter().writeSBML(this, tmpFile); } catch (IOException e) { - logger.error("There was an error creating a temporary file :" + e.getMessage()); + logger.error("There was an error creating a temporary file: " + e.getMessage()); if (logger.isDebugEnabled()) { e.printStackTrace(); } return -1; } catch (XMLStreamException e) { - logger.error("There was an error creating a temporary file :" + e.getMessage()); + logger.error("There was an error creating a temporary file: " + e.getMessage()); if (logger.isDebugEnabled()) { e.printStackTrace(); } return -1; } catch (SBMLException e) { - logger.error("There was an error creating a temporary file :" + e.getMessage()); + logger.error("There was an error creating a temporary file: " + e.getMessage()); if (logger.isDebugEnabled()) { e.printStackTrace(); Modified: trunk/core/src/org/sbml/jsbml/UnitDefinition.java =================================================================== --- trunk/core/src/org/sbml/jsbml/UnitDefinition.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/core/src/org/sbml/jsbml/UnitDefinition.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -239,8 +239,7 @@ if (id == null) { logger.warn("Cannot create predefined unit object with id = null."); return null; - } else if (!(isPredefined(id, level) || (Unit.isUnitKind(id, level, - version)))) { + } else if (!(isPredefined(id, level) || (Unit.isUnitKind(id, level, version)))) { logger.warn(MessageFormat.format( "No such predefined unit {0} in SBML Level {1,number,integer}.", id, level)); Deleted: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBAList.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/FBAList.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBAList.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -1,46 +0,0 @@ -/* - * $Id$ - * $URL$ - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ -package org.sbml.jsbml.ext.fba; - -/** - * - * @author - * @version $Rev$ - * @since 1.0 - * @date 27.10.2011 - */ -public enum FBAList { - /** - * - */ - listOfFluxBounds, - /** - * - */ - listOfFluxObjectives, - /** - * - */ - listOfObjectives, - /** - * - */ - none -} Deleted: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBAModel.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/FBAModel.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBAModel.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -1,160 +0,0 @@ -/* - * $Id$ - * $URL$ - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ -package org.sbml.jsbml.ext.fba; - -import java.util.Map; - -import javax.swing.tree.TreeNode; - -import org.sbml.jsbml.ListOf; -import org.sbml.jsbml.Model; -import org.sbml.jsbml.SBase; -import org.sbml.jsbml.ext.AbstractSBasePlugin; - -/** - * - * @author - * @version $Rev$ - * @since 1.0 - * @date 27.10.2011 - */ -public class FBAModel extends AbstractSBasePlugin { - - /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = -7451190347195219863L; - private ListOf<FluxBound> listOfFluxBounds = new ListOf<FluxBound>(); - private ListOf<Objective> listOfObjectives = new ListOf<Objective>(); - - private Model model; - - public FBAModel(Model model) { - this.model = model; - } - - /* - * (non-Javadoc) - * @see java.lang.Object#clone() - */ - public FBAModel clone() { - // TODO - return null; - } - - public boolean readAttribute(String attributeName, String prefix, String value) { - return false; - } - - public Map<String, String> writeXMLAttributes() { - return null; - } - - public SBase getChildAt(int childIndex) { - return null; - } - public int getChildCount() { - return 0; - } - public TreeNode getParent() { - return model; - } - - - public boolean isSetListOfFluxBounds() { - if ((listOfFluxBounds == null) || listOfFluxBounds.isEmpty()) { - return false; - } - return true; - } - - /** - * @return the listOfFluxBounds - */ - public ListOf<FluxBound> getListOfFluxBounds() { - return listOfFluxBounds; - } - - /** - * - * @param i - * @return - */ - public FluxBound getFluxBound(int i) { - if ((i >= 0) && (i < listOfFluxBounds.size())) { - return listOfFluxBounds.get(i); - } - - return null; - } - - /** - * @param listOfFluxBounds the listOfFluxBounds to set - */ - public void addFluxBound(FluxBound fluxBound) { - model.setThisAsParentSBMLObject(fluxBound); - this.listOfFluxBounds.add(fluxBound); - } - - public boolean isSetListOfObjectives() { - if ((listOfObjectives == null) || listOfObjectives.isEmpty()) { - return false; - } - return true; - } - - /** - * @return the listOfObjectives - */ - public ListOf<Objective> getListOfObjectives() { - return listOfObjectives; - } - - /** - * - * @param i - * @return - */ - public Objective getObjective(int i) { - if ((i >= 0) && (i < listOfObjectives.size())) { - return listOfObjectives.get(i); - } - - return null; - } - - /** - * @param listOfObjectives the listOfObjectives to set - */ - public void addObjective(Objective objective) { - model.setThisAsParentSBMLObject(objective); - this.listOfObjectives.add(objective); - } - - /* (non-Javadoc) - * @see javax.swing.tree.TreeNode#getAllowsChildren() - */ - public boolean getAllowsChildren() { - // TODO Auto-generated method stub - return false; - } - - // TODO : implement !! -} Copied: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCList.java (from rev 1427, trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/FBAList.java) =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCList.java (rev 0) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCList.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -0,0 +1,46 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.fbc; + +/** + * + * @author + * @version $Rev$ + * @since 1.0 + * @date 27.10.2011 + */ +public enum FBCList { + /** + * + */ + listOfFluxBounds, + /** + * + */ + listOfFluxObjectives, + /** + * + */ + listOfObjectives, + /** + * + */ + none +} Copied: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCModel.java (from rev 1427, trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/FBAModel.java) =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCModel.java (rev 0) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCModel.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -0,0 +1,158 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.ext.fbc; + +import java.util.Map; + +import javax.swing.tree.TreeNode; + +import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.Model; +import org.sbml.jsbml.SBase; +import org.sbml.jsbml.ext.AbstractSBasePlugin; + +/** + * + * @author + * @version $Rev$ + * @since 1.0 + * @date 27.10.2011 + */ +public class FBCModel extends AbstractSBasePlugin { + + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -7451190347195219863L; + private ListOf<FluxBound> listOfFluxBounds = new ListOf<FluxBound>(); + private ListOf<Objective> listOfObjectives = new ListOf<Objective>(); + + private Model model; + + public FBCModel(Model model) { + this.model = model; + } + + /* + * (non-Javadoc) + * @see java.lang.Object#clone() + */ + public FBCModel clone() { + // TODO + return null; + } + + public boolean readAttribute(String attributeName, String prefix, String value) { + return false; + } + + public Map<String, String> writeXMLAttributes() { + return null; + } + + public SBase getChildAt(int childIndex) { + return null; + } + public int getChildCount() { + return 0; + } + public TreeNode getParent() { + return model; + } + + + public boolean isSetListOfFluxBounds() { + if ((listOfFluxBounds == null) || listOfFluxBounds.isEmpty()) { + return false; + } + return true; + } + + /** + * @return the listOfFluxBounds + */ + public ListOf<FluxBound> getListOfFluxBounds() { + return listOfFluxBounds; + } + + /** + * + * @param i + * @return + */ + public FluxBound getFluxBound(int i) { + if ((i >= 0) && (i < listOfFluxBounds.size())) { + return listOfFluxBounds.get(i); + } + + return null; + } + + /** + * @param listOfFluxBounds the listOfFluxBounds to set + */ + public void addFluxBound(FluxBound fluxBound) { + this.listOfFluxBounds.add(fluxBound); + } + + public boolean isSetListOfObjectives() { + if ((listOfObjectives == null) || listOfObjectives.isEmpty()) { + return false; + } + return true; + } + + /** + * @return the listOfObjectives + */ + public ListOf<Objective> getListOfObjectives() { + return listOfObjectives; + } + + /** + * + * @param i + * @return + */ + public Objective getObjective(int i) { + if ((i >= 0) && (i < listOfObjectives.size())) { + return listOfObjectives.get(i); + } + + return null; + } + + /** + * @param listOfObjectives the listOfObjectives to set + */ + public void addObjective(Objective objective) { + this.listOfObjectives.add(objective); + } + + /* (non-Javadoc) + * @see javax.swing.tree.TreeNode#getAllowsChildren() + */ + public boolean getAllowsChildren() { + // TODO Auto-generated method stub + return false; + } + + // TODO : implement !! +} Modified: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FluxBound.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/FluxBound.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FluxBound.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -17,7 +17,7 @@ * and also available online as <http://sbml.org/Software/JSBML/License>. * ---------------------------------------------------------------------------- */ -package org.sbml.jsbml.ext.fba; +package org.sbml.jsbml.ext.fbc; import java.util.Map; @@ -25,7 +25,7 @@ import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.UniqueNamedSBase; import org.sbml.jsbml.util.StringTools; -import org.sbml.jsbml.xml.parsers.FBAParser; +import org.sbml.jsbml.xml.parsers.FBCParser; /** * @@ -156,17 +156,17 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (reaction != null) { - attributes.put(FBAParser.shortLabel+ ":reaction", getReaction()); + attributes.put(FBCParser.shortLabel+ ":reaction", getReaction()); } if (operation != null) { - attributes.put(FBAParser.shortLabel+ ":operation", getOperation()); + attributes.put(FBCParser.shortLabel+ ":operation", getOperation()); } if (isSetValue()) { - attributes.put(FBAParser.shortLabel+ ":value", StringTools.toString(getValue())); + attributes.put(FBCParser.shortLabel+ ":value", StringTools.toString(getValue())); } if (isSetId()) { attributes.remove("id"); - attributes.put(FBAParser.shortLabel+ ":id", getId()); + attributes.put(FBCParser.shortLabel+ ":id", getId()); } return attributes; Modified: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FluxObjective.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/FluxObjective.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FluxObjective.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -17,13 +17,13 @@ * and also available online as <http://sbml.org/Software/JSBML/License>. * ---------------------------------------------------------------------------- */ -package org.sbml.jsbml.ext.fba; +package org.sbml.jsbml.ext.fbc; import java.util.Map; import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.util.StringTools; -import org.sbml.jsbml.xml.parsers.FBAParser; +import org.sbml.jsbml.xml.parsers.FBCParser; /** * @@ -122,10 +122,10 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (reaction != null) { - attributes.put(FBAParser.shortLabel+ ":reaction", getReaction()); + attributes.put(FBCParser.shortLabel+ ":reaction", getReaction()); } if (isSetCoefficient()) { - attributes.put(FBAParser.shortLabel+ ":coefficient", StringTools.toString(getCoefficient())); + attributes.put(FBCParser.shortLabel+ ":coefficient", StringTools.toString(getCoefficient())); } return attributes; Modified: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/Objective.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -17,7 +17,7 @@ * and also available online as <http://sbml.org/Software/JSBML/License>. * ---------------------------------------------------------------------------- */ -package org.sbml.jsbml.ext.fba; +package org.sbml.jsbml.ext.fbc; import java.util.Map; @@ -27,7 +27,7 @@ import org.sbml.jsbml.AbstractSBase; import org.sbml.jsbml.ListOf; import org.sbml.jsbml.UniqueNamedSBase; -import org.sbml.jsbml.xml.parsers.FBAParser; +import org.sbml.jsbml.xml.parsers.FBCParser; /** * @@ -129,11 +129,11 @@ Map<String, String> attributes = super.writeXMLAttributes(); if (type != null) { - attributes.put(FBAParser.shortLabel+ ":type", getType()); + attributes.put(FBCParser.shortLabel+ ":type", getType()); } if (isSetId()) { attributes.remove("id"); - attributes.put(FBAParser.shortLabel+ ":id", getId()); + attributes.put(FBCParser.shortLabel+ ":id", getId()); } return attributes; Modified: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/package-info.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fba/package-info.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/package-info.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -21,4 +21,4 @@ /** * */ -package org.sbml.jsbml.ext.fba; +package org.sbml.jsbml.ext.fbc; Deleted: trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBAParser.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBAParser.java 2012-10-15 13:01:51 UTC (rev 1427) +++ trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBAParser.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -1,392 +0,0 @@ -/* - * $Id: FBAParser.java 835 2011-10-24 13:32:22Z niko-rodrigue $ - * $URL: https://jsbml.svn.sourceforge.net/svnroot/jsbml/trunk/extensions/groups/src/org/sbml/jsbml/xml/parsers/FBAParser.java $ - * ---------------------------------------------------------------------------- - * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> - * for the latest version of JSBML and more information about SBML. - * - * Copyright (C) 2009-2012 jointly by the following organizations: - * 1. The University of Tuebingen, Germany - * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK - * 3. The California Institute of Technology, Pasadena, CA, USA - * - * This library is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as published by - * the Free Software Foundation. A copy of the license agreement is provided - * in the file named "LICENSE.txt" included with this software distribution - * and also available online as <http://sbml.org/Software/JSBML/License>. - * ---------------------------------------------------------------------------- - */ -package org.sbml.jsbml.xml.parsers; - -import java.util.ArrayList; -import java.util.Enumeration; - -import javax.swing.tree.TreeNode; - -import org.apache.log4j.Logger; -import org.sbml.jsbml.Annotation; -import org.sbml.jsbml.ListOf; -import org.sbml.jsbml.Model; -import org.sbml.jsbml.SBMLDocument; -import org.sbml.jsbml.SBase; -import org.sbml.jsbml.ext.SBasePlugin; -import org.sbml.jsbml.ext.fba.FBAList; -import org.sbml.jsbml.ext.fba.FBAModel; -import org.sbml.jsbml.ext.fba.FluxBound; -import org.sbml.jsbml.ext.fba.FluxObjective; -import org.sbml.jsbml.ext.fba.Objective; -import org.sbml.jsbml.xml.stax.SBMLObjectForXML; - -/** - * This class is used to parse the fba extension package elements and - * attributes. The namespaceURI URI of this parser is - * "http://www.sbml.org/sbml/level3/version1/fba/version1". This parser is - * able to read and write elements of the fba package (implements - * ReadingParser and WritingParser). - * - * @author Nicolas Rodriguez - * @since 1.0 - * @version $Rev: 835 $ - */ -public class FBAParser implements ReadingParser, WritingParser { - - /** - * The namespace URI of this parser. - */ - // private static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/fba/version1"; - private static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/fbc/version1"; - - public static final String shortLabel = "fbc"; - - - /** - * - * @return the namespaceURI of this parser. - */ - public static String getNamespaceURI() { - return namespaceURI; - } - - /** - * The FBAList enum which represents the name of the list this parser is - * currently reading. - * - */ - private FBAList groupList = FBAList.none; - - private Logger logger = Logger.getLogger(FBAParser.class); - - /* - * (non-Javadoc) - * - * @see org.sbml.jsbml.xml.WritingParser#getListOfSBMLElementsToWrite(Object - * sbase) - */ - @SuppressWarnings("unchecked") - public ArrayList<Object> getListOfSBMLElementsToWrite(Object sbase) { - - logger.debug("getListOfSBMLElementsToWrite : " + sbase.getClass().getCanonicalName()); - - ArrayList<Object> listOfElementsToWrite = new ArrayList<Object>(); - - if (sbase instanceof SBMLDocument) { - // nothing to do - // TODO : the 'required' attribute is written even if there is no plugin class for the SBMLDocument, so I am not totally sure how this is done. - } - else if (sbase instanceof Model) { - FBAModel modelGE = (FBAModel) ((Model) sbase).getExtension(namespaceURI); - - if (modelGE != null && modelGE.isSetListOfFluxBounds()) { - listOfElementsToWrite.add(modelGE.getListOfFluxBounds()); - groupList = FBAList.listOfFluxBounds; - } - if (modelGE != null && modelGE.isSetListOfObjectives()) { - listOfElementsToWrite.add(modelGE.getListOfObjectives()); - } - - } - else if (sbase instanceof TreeNode) { - Enumeration<TreeNode> children = ((TreeNode) sbase).children(); - - while (children.hasMoreElements()) { - listOfElementsToWrite.add(children.nextElement()); - } - } - - if (listOfElementsToWrite.isEmpty()) { - listOfElementsToWrite = null; - } else { - logger.debug("getListOfSBMLElementsToWrite size = " + listOfElementsToWrite.size()); - } - - return listOfElementsToWrite; - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processAttribute(String - * elementName, String attributeName, String value, String prefix, - * boolean isLastAttribute, Object contextObject) - */ - public void processAttribute(String elementName, String attributeName, - String value, String prefix, boolean isLastAttribute, - Object contextObject) { - - logger.debug("processAttribute\n"); - - boolean isAttributeRead = false; - - if (contextObject instanceof SBase) { - - SBase sbase = (SBase) contextObject; - - logger.debug("processAttribute : level, version = " + sbase.getLevel() + ", " + sbase.getVersion()); - - try { - isAttributeRead = sbase.readAttribute(attributeName, prefix, - value); - } catch (Throwable exc) { - System.err.println(exc.getMessage()); - } - } else if (contextObject instanceof Annotation) { - Annotation annotation = (Annotation) contextObject; - isAttributeRead = annotation.readAttribute(attributeName, prefix, - value); - } else if (contextObject instanceof SBasePlugin) { - isAttributeRead = ((SBasePlugin) contextObject).readAttribute(attributeName, prefix, value); - } - - if (!isAttributeRead) { - logger.warn("processAttribute : The attribute " + attributeName - + " on the element " + elementName + - " is not part of the SBML specifications"); - } - } - - /* - * (non-Javadoc) - * @see org.sbml.jsbml.xml.stax.ReadingParser#processCharactersOf(java.lang.String, java.lang.String, java.lang.Object) - */ - public void processCharactersOf(String elementName, String characters, - Object contextObject) { - - // TODO : the basic fba elements don't have any text. SBML syntax - // error, throw an exception, log en error ? - logger.debug("processCharactersOf : the basic FBA elements don't have any text. " + - "SBML syntax error. characters lost = " + characters); - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndDocument(SBMLDocument - * sbmlDocument) - */ - public void processEndDocument(SBMLDocument sbmlDocument) { - // Do some checking ?? - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndElement(String - * elementName, String prefix, boolean isNested, Object contextObject) - */ - public boolean processEndElement(String elementName, String prefix, - boolean isNested, Object contextObject) - { - - if (elementName.equals("listOfFluxBounds") - || elementName.equals("listOfObjectives")) - { - this.groupList = FBAList.none; - } - - return true; - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processNamespace(String - * elementName, String URI, String prefix, String localName, boolean - * hasAttributes, boolean isLastNamespace, Object contextObject) - */ - public void processNamespace(String elementName, String URI, String prefix, - String localName, boolean hasAttributes, boolean isLastNamespace, - Object contextObject) - { - // TODO : read the namespace, it could be some other extension objects - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.ReadingParser#processStartElement(String - * elementName, String prefix, boolean hasAttributes, boolean - * hasNamespaces, Object contextObject) - */ - // Create the proper object and link it to his parent. - @SuppressWarnings("unchecked") - public Object processStartElement(String elementName, String prefix, - boolean hasAttributes, boolean hasNamespaces, Object contextObject) - { - if (contextObject instanceof Model) { - Model model = (Model) contextObject; - FBAModel fbaModel = null; - - if (model.getExtension(namespaceURI) != null) { - fbaModel = (FBAModel) model.getExtension(namespaceURI); - } else { - fbaModel = new FBAModel(model); - model.addExtension(namespaceURI, fbaModel); - } - - if (elementName.equals("listOfFluxBounds")) { - - ListOf<FluxBound> listOfFluxBounds = fbaModel.getListOfFluxBounds(); - listOfFluxBounds.setSBaseListType(ListOf.Type.other); - listOfFluxBounds.addNamespace(namespaceURI); - model.setThisAsParentSBMLObject(listOfFluxBounds); - this.groupList = FBAList.listOfFluxBounds; - return listOfFluxBounds; - } - else if (elementName.equals("listOfObjectives")) { - - ListOf<Objective> listOfObjectives = fbaModel.getListOfObjectives(); - listOfObjectives.setSBaseListType(ListOf.Type.other); - listOfObjectives.addNamespace(namespaceURI); - model.setThisAsParentSBMLObject(listOfObjectives); - this.groupList = FBAList.listOfObjectives; - return listOfObjectives; - } - } else if (contextObject instanceof Objective) { - Objective objective = (Objective) contextObject; - if (elementName.equals("listOfFluxes")) { - ListOf<FluxObjective> listOfFluxObjectives = objective.getListOfFluxObjectives(); - listOfFluxObjectives.setSBaseListType(ListOf.Type.other); - listOfFluxObjectives.addNamespace(namespaceURI); - objective.setThisAsParentSBMLObject(listOfFluxObjectives); - this.groupList = FBAList.listOfFluxObjectives; - return listOfFluxObjectives; - } - } - - else if (contextObject instanceof ListOf<?>) { - ListOf<SBase> listOf = (ListOf<SBase>) contextObject; - - if (elementName.equals("fluxBound") - && this.groupList.equals(FBAList.listOfFluxBounds)) { - Model model = (Model) listOf.getParentSBMLObject(); - FBAModel extendeModel = (FBAModel) model.getExtension(namespaceURI); - - FluxBound fluxBound = new FluxBound(); - fluxBound.addNamespace(namespaceURI); - extendeModel.addFluxBound(fluxBound); - return fluxBound; - - } else if (elementName.equals("objective") - && this.groupList.equals(FBAList.listOfObjectives)) { - Model model = (Model) listOf.getParentSBMLObject(); - FBAModel extendeModel = (FBAModel) model.getExtension(namespaceURI); - - Objective objective = new Objective(); - objective.addNamespace(namespaceURI); - extendeModel.addObjective(objective); - - return objective; - } else if (elementName.equals("fluxObjective") - && this.groupList.equals(FBAList.listOfFluxObjectives)) { - Objective objective = (Objective) listOf.getParentSBMLObject(); - - FluxObjective fluxObjective = new FluxObjective(); - fluxObjective.addNamespace(namespaceURI); - objective.addFluxObjective(fluxObjective); - - return fluxObjective; - } - - - } - return contextObject; - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeAttributes(SBMLObjectForXML - * xmlObject, Object sbmlElementToWrite) - */ - public void writeAttributes(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) { - if (sbmlElementToWrite instanceof SBase) { - SBase sbase = (SBase) sbmlElementToWrite; - - xmlObject.addAttributes(sbase.writeXMLAttributes()); - } - - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeCharacters(SBMLObjectForXML - * xmlObject, Object sbmlElementToWrite) - */ - public void writeCharacters(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) - { - logger.error("writeCharacters : Group elements do not have any characters !!"); - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeElement(SBMLObjectForXML - * xmlObject, Object sbmlElementToWrite) - */ - public void writeElement(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) { - - logger.debug("FBAParser : writeElement"); - - if (sbmlElementToWrite instanceof SBase) { - SBase sbase = (SBase) sbmlElementToWrite; - - if (!xmlObject.isSetName()) { - if (sbase instanceof ListOf<?>) { - ListOf<?> listOf = (ListOf<?>) sbase; - - if (listOf.size() > 0) { - if (listOf.get(0) instanceof FluxBound) { - xmlObject.setName(FBAList.listOfFluxBounds.toString()); - } else if (listOf.get(0) instanceof Objective) { - xmlObject.setName(FBAList.listOfObjectives.toString()); - } else if (listOf.get(0) instanceof FluxObjective) { - xmlObject.setName(FBAList.listOfFluxObjectives.toString()); - } - } - } else { - xmlObject.setName(sbase.getElementName()); - } - } - if (!xmlObject.isSetPrefix()) { - xmlObject.setPrefix(shortLabel); - } - xmlObject.setNamespace(namespaceURI); - - } - - } - - /** - * - * @see org.sbml.jsbml.xml.parsers.WritingParser#writeNamespaces(SBMLObjectForXML - * xmlObject, Object sbmlElementToWrite) - */ - public void writeNamespaces(SBMLObjectForXML xmlObject, - Object sbmlElementToWrite) - { - if (sbmlElementToWrite instanceof SBase) { - // SBase sbase = (SBase) sbmlElementToWrite; - - xmlObject.setPrefix(shortLabel); - } - // TODO : write all namespaces - } - -} Copied: trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java (from rev 1427, trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBAParser.java) =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java (rev 0) +++ trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java 2012-10-21 09:51:27 UTC (rev 1428) @@ -0,0 +1,392 @@ +/* + * $Id$ + * $URL$ + * ---------------------------------------------------------------------------- + * This file is part of JSBML. Please visit <http://sbml.org/Software/JSBML> + * for the latest version of JSBML and more information about SBML. + * + * Copyright (C) 2009-2012 jointly by the following organizations: + * 1. The University of Tuebingen, Germany + * 2. EMBL European Bioinformatics Institute (EBML-EBI), Hinxton, UK + * 3. The California Institute of Technology, Pasadena, CA, USA + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation. A copy of the license agreement is provided + * in the file named "LICENSE.txt" included with this software distribution + * and also available online as <http://sbml.org/Software/JSBML/License>. + * ---------------------------------------------------------------------------- + */ +package org.sbml.jsbml.xml.parsers; + +import java.util.ArrayList; +import java.util.Enumeration; + +import javax.swing.tree.TreeNode; + +import org.apache.log4j.Logger; +import org.sbml.jsbml.Annotation; +import org.sbml.jsbml.ListOf; +import org.sbml.jsbml.Model; +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.SBase; +import org.sbml.jsbml.ext.SBasePlugin; +import org.sbml.jsbml.ext.fbc.FBCList; +import org.sbml.jsbml.ext.fbc.FBCModel; +import org.sbml.jsbml.ext.fbc.FluxBound; +import org.sbml.jsbml.ext.fbc.FluxObjective; +import org.sbml.jsbml.ext.fbc.Objective; +import org.sbml.jsbml.xml.stax.SBMLObjectForXML; + +/** + * This class is used to parse the fbc extension package elements and + * attributes. The namespaceURI URI of this parser is + * "http://www.sbml.org/sbml/level3/version1/fbc/version1". This parser is + * able to read and write elements of the fbc package (implements + * ReadingParser and WritingParser). + * + * @author Nicolas Rodriguez + * @since 1.0 + * @version $Rev: 835 $ + */ +public class FBCParser implements ReadingParser, WritingParser { + + /** + * The namespace URI of this parser. + */ + // private static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/fbc/version1"; + private static final String namespaceURI = "http://www.sbml.org/sbml/level3/version1/fbc/version1"; + + public static final String shortLabel = "fbc"; + + + /** + * + * @return the namespaceURI of this parser. + */ + public static String getNamespaceURI() { + return namespaceURI; + } + + /** + * The {@link FBCList} enum which represents the name of the list this parser is + * currently reading. + * + */ + private FBCList groupList = FBCList.none; + + private Logger logger = Logger.getLogger(FBCParser.class); + + /* + * (non-Javadoc) + * + * @see org.sbml.jsbml.xml.WritingParser#getListOfSBMLElementsToWrite(Object + * sbase) + */ + @SuppressWarnings("unchecked") + public ArrayList<Object> getListOfSBMLElementsToWrite(Object sbase) { + + logger.debug("getListOfSBMLElementsToWrite : " + sbase.getClass().getCanonicalName()); + + ArrayList<Object> listOfElementsToWrite = new ArrayList<Object>(); + + if (sbase instanceof SBMLDocument) { + // nothing to do + // TODO : the 'required' attribute is written even if there is no plugin class for the SBMLDocument, so I am not totally sure how this is done. + } + else if (sbase instanceof Model) { + FBCModel modelGE = (FBCModel) ((Model) sbase).getExtension(namespaceURI); + + if (modelGE != null && modelGE.isSetListOfFluxBounds()) { + listOfElementsToWrite.add(modelGE.getListOfFluxBounds()); + groupList = FBCList.listOfFluxBounds; + } + if (modelGE != null && modelGE.isSetListOfObjectives()) { + listOfElementsToWrite.add(modelGE.getListOfObjectives()); + } + + } + else if (sbase instanceof TreeNode) { + Enumeration<TreeNode> children = ((TreeNode) sbase).children(); + + while (children.hasMoreElements()) { + listOfElementsToWrite.add(children.nextElement()); + } + } + + if (listOfElementsToWrite.isEmpty()) { + listOfElementsToWrite = null; + } else { + logger.debug("getListOfSBMLElementsToWrite size = " + listOfElementsToWrite.size()); + } + + return listOfElementsToWrite; + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processAttribute(String + * elementName, String attributeName, String value, String prefix, + * boolean isLastAttribute, Object contextObject) + */ + public void processAttribute(String elementName, String attributeName, + String value, String prefix, boolean isLastAttribute, + Object contextObject) { + + logger.debug("processAttribute\n"); + + boolean isAttributeRead = false; + + if (contextObject instanceof SBase) { + + SBase sbase = (SBase) contextObject; + + logger.debug("processAttribute : level, version = " + sbase.getLevel() + ", " + sbase.getVersion()); + + try { + isAttributeRead = sbase.readAttribute(attributeName, prefix, + value); + } catch (Throwable exc) { + System.err.println(exc.getMessage()); + } + } else if (contextObject instanceof Annotation) { + Annotation annotation = (Annotation) contextObject; + isAttributeRead = annotation.readAttribute(attributeName, prefix, + value); + } else if (contextObject instanceof SBasePlugin) { + isAttributeRead = ((SBasePlugin) contextObject).readAttribute(attributeName, prefix, value); + } + + if (!isAttributeRead) { + logger.warn("processAttribute : The attribute " + attributeName + + " on the element " + elementName + + " is not part of the SBML specifications"); + } + } + + /* + * (non-Javadoc) + * @see org.sbml.jsbml.xml.stax.ReadingParser#processCharactersOf(java.lang.String, java.lang.String, java.lang.Object) + */ + public void processCharactersOf(String elementName, String characters, + Object contextObject) { + + // TODO : the basic fbc elements don't have any text. SBML syntax + // error, throw an exception, log en error ? + logger.debug("processCharactersOf : the basic FBC elements don't have any text. " + + "SBML syntax error. characters lost = " + characters); + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndDocument(SBMLDocument + * sbmlDocument) + */ + public void processEndDocument(SBMLDocument sbmlDocument) { + // Do some checking ?? + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processEndElement(String + * elementName, String prefix, boolean isNested, Object contextObject) + */ + public boolean processEndElement(String elementName, String prefix, + boolean isNested, Object contextObject) + { + + if (elementName.equals("listOfFluxBounds") + || elementName.equals("listOfObjectives")) + { + this.groupList = FBCList.none; + } + + return true; + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processNamespace(String + * elementName, String URI, String prefix, String localName, boolean + * hasAttributes, boolean isLastNamespace, Object contextObject) + */ + public void processNamespace(String elementName, String URI, String prefix, + String localName, boolean hasAttributes, boolean isLastNamespace, + Object contextObject) + { + // TODO : read the namespace, it could be some other extension objects + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.ReadingParser#processStartElement(String + * elementName, String prefix, boolean hasAttributes, boolean + * hasNamespaces, Object contextObject) + */ + // Create the proper object and link it to his parent. + @SuppressWarnings("unchecked") + public Object processStartElement(String elementName, String prefix, + boolean hasAttributes, boolean hasNamespaces, Object contextObject) + { + if (contextObject instanceof Model) { + Model model = (Model) contextObject; + FBCModel fbcModel = null; + + if (model.getExtension(namespaceURI) != null) { + fbcModel = (FBCModel) model.getExtension(namespaceURI); + } else { + fbcModel = new FBCModel(model); + model.addExtension(namespaceURI, fbcModel); + } + + if (elementName.equals("listOfFluxBounds")) { + + ListOf<FluxBound> listOfFluxBounds = fbcModel.getListOfFluxBounds(); + listOfFluxBounds.setSBaseListType(ListOf.Type.other); + listOfFluxBounds.addNamespace(namespaceURI); + model.registerChild(listOfFluxBounds); + this.groupList = FBCList.listOfFluxBounds; + return listOfFluxBounds; + } + else if (elementName.equals("listOfObjectives")) { + + ListOf<Objective> listOfObjectives = fbcModel.getListOfObjectives(); + listOfObjectives.setSBaseListType(ListOf.Type.other); + listOfObjectives.addNamespace(namespaceURI); + model.registerChild(listOfObjectives); + this.groupList = FBCList.listOfObjectives; + return listOfObjectives; + } + } else if (contextObject instanceof Objective) { + Objective objective = (Objective) contextObject; + if (elementName.equals("listOfFluxes")) { + ListOf<FluxObjective> listOfFluxObjectives = objective.getListOfFluxObjectives(); + listOfFluxObjectives.setSBaseListType(ListOf.Type.other); + listOfFluxObjectives.addNamespace(namespaceURI); + objective.registerChild(listOfFluxObjectives); + this.groupList = FBCList.listOfFluxObjectives; + return listOfFluxObjectives; + } + } + + else if (contextObject instanceof ListOf<?>) { + ListOf<SBase> listOf = (ListOf<SBase>) contextObject; + + if (elementName.equals("fluxBound") + && this.groupList.equals(FBCList.listOfFluxBounds)) { + Model model = (Model) listOf.getParentSBMLObject(); + FBCModel extendeModel = (FBCModel) model.getExtension(namespaceURI); + + FluxBound fluxBound = new FluxBound(); + fluxBound.addNamespace(namespaceURI); + extendeModel.addFluxBound(fluxBound); + return fluxBound; + + } else if (elementName.equals("objective") + && this.groupList.equals(FBCList.listOfObjectives)) { + Model model = (Model) listOf.getParentSBMLObject(); + FBCModel extendeModel = (FBCModel) model.getExtension(namespaceURI); + + Objective objective = new Objective(); + objective.addNamespace(namespaceURI); + extendeModel.addObjective(objective); + + return objective; + } else if (elementName.equals("fluxObjective") + && this.groupList.equals(FBCList.listOfFluxObjectives)) { + Objective objective = (Objective) listOf.getParentSBMLObject(); + + FluxObjective fluxObjective = new FluxObjective(); + fluxObjective.addNamespace(namespaceURI); + objective.addFluxObjective(fluxObjective); + + return fluxObjective; + } + + + } + return contextObject; + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeAttributes(SBMLObjectForXML + * xmlObject, Object sbmlElementToWrite) + */ + public void writeAttributes(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) { + if (sbmlElementToWrite instanceof SBase) { + SBase sbase = (SBase) sbmlElementToWrite; + + xmlObject.addAttributes(sbase.writeXMLAttributes()); + } + + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeCharacters(SBMLObjectForXML + * xmlObject, Object sbmlElementToWrite) + */ + public void writeCharacters(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) + { + logger.error("writeCharacters : Group elements do not have any characters !!"); + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeElement(SBMLObjectForXML + * xmlObject, Object sbmlElementToWrite) + */ + public void writeElement(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) { + + logger.debug("FBCParser : writeElement"); + + if (sbmlElementToWrite instanceof SBase) { + SBase sbase = (SBase) sbmlElementToWrite; + + if (!xmlObject.isSetName()) { + if (sbase instanceof ListOf<?>) { + ListOf<?> listOf = (ListOf<?>) sbase; + + if (listOf.size() > 0) { + if (listOf.get(0) instanceof FluxBound) { + xmlObject.setName(FBCList.listOfFluxBounds.toString()); + } else if (listOf.get(0) instanceof Objective) { + xmlObject.setName(FBCList.listOfObjectives.toString()); + } else if (listOf.get(0) instanceof FluxObjective) { + xmlObject.setName(FBCList.listOfFluxObjectives.toString()); + } + } + } else { + xmlObject.setName(sbase.getElementName()); + } + } + if (!xmlObject.isSetPrefix()) { + xmlObject.setPrefix(shortLabel); + } + xmlObject.setNamespace(namespaceURI); + + } + + } + + /** + * + * @see org.sbml.jsbml.xml.parsers.WritingParser#writeNamespaces(SBMLObjectForXML + * xmlObject, Object sbmlElementToWrite) + */ + public void writeNamespaces(SBMLObjectForXML xmlObject, + Object sbmlElementToWrite) + { + if (sbmlElementToWrite instanceof SBase) { + // SBase sbase = (SBase) sbmlElementToWrite; + + xmlObject.setPrefix(shortLabel); + } + // TODO : write all namespaces + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |