From: <nik...@us...> - 2015-05-01 09:44:23
|
Revision: 2267 http://sourceforge.net/p/jsbml/code/2267 Author: niko-rodrigue Date: 2015-05-01 09:44:19 +0000 (Fri, 01 May 2015) Log Message: ----------- merged from trunk until rev 2217 Revision Links: -------------- http://sourceforge.net/p/jsbml/code/2217 Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/AbstractSBase.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Annotation.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Event.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SBMLError.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SpeciesReference.java branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGeometry.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateReference.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DiffusionCoefficient.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Domain.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DomainType.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/MixedGeometry.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricGeometry.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricObject.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/PolygonObject.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SampledField.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SampledFieldGeometry.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SampledVolume.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/xml/parsers/SpatialParser.java branches/astnode2-merging-alternate/extensions/spatial/test/org/sbml/jsbml/ext/spatial/SpatialTest.java Added Paths: ----------- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoints.java branches/astnode2-merging-alternate/src/ Property Changed: ---------------- branches/astnode2-merging-alternate/ Index: branches/astnode2-merging-alternate =================================================================== --- branches/astnode2-merging-alternate 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate 2015-05-01 09:44:19 UTC (rev 2267) Property changes on: branches/astnode2-merging-alternate ___________________________________________________________________ Added: svn:mergeinfo ## -0,0 +1 ## +/trunk:2191,2194-2195,2197-2200,2202-2206,2209-2213,2216-2217 \ No newline at end of property Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/AbstractSBase.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/AbstractSBase.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -1743,6 +1743,8 @@ "Cannot register {0}.", sbase.getElementName())); } + // TODO - set package version and namespace if needed + /* * Now, we can add all previous listeners. The next change will * be fired after registering all ids. @@ -1772,6 +1774,8 @@ private void registerChild(SBasePlugin sbasePlugin) { // Could/Should be used by the method #firePropertyChange + // TODO - set package version and namespace if needed + int childCount = sbasePlugin.getChildCount(); if (childCount > 0) { Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Annotation.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Annotation.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Annotation.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -157,9 +157,8 @@ * */ public Annotation(String annotation) throws XMLStreamException { - this(); // parse the String as an XMLNode - nonRDFannotation = XMLNode.convertStringToXMLNode(annotation); + this(XMLNode.convertStringToXMLNode(annotation)); } /** @@ -182,6 +181,15 @@ } /** + * + * @param annotation + */ + public Annotation(XMLNode annotation) { + this(); + nonRDFannotation = annotation; + } + + /** * Adds a {@link CVTerm}. * * @param cvTerm @@ -201,6 +209,23 @@ } /** + * Adds an additional namespace to the set of declared namespaces of this + * {@link SBase}. + * + * @param prefix the prefix of the namespace to add + * @param uri the namespace uri + * + */ + public void addDeclaredNamespace(String prefix, String uri) + { + if (!isSetNonRDFannotation()) { + nonRDFannotation = new XMLNode(new XMLTriple("annotation", null, null), new XMLAttributes()); + } + + nonRDFannotation.addNamespace(uri, prefix); + } + + /** * Appends some 'annotation' to the non RDF annotation {@link XMLNode} of this object. * * @param annotation some non RDF annotations. @@ -246,6 +271,18 @@ return new Annotation(this); } + /** + * @see org.sbml.jsbml.SBase#getHistory() + * @return + */ + private History createHistory() { + history = new History(); + history.parent = this; + history.addAllChangeListeners(getListOfTreeNodeChangeListeners()); + + return history; + } + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractTreeNode#equals(java.lang.Object) */ @@ -301,6 +338,7 @@ return l; } + /** * Returns the about String of this object. * @@ -310,6 +348,7 @@ return about == null ? "" : about; } + /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getAllowsChildren() */ @@ -318,7 +357,6 @@ return true; } - /** * Returns the {@link XMLNode} representing non RDF annotations. * @@ -330,58 +368,6 @@ return nonRDFannotation; } - - /** - * - * - * @return - */ - public XMLNode getFullAnnotation() { - - XMLNode nonRdfAnnotationClone = null; - - if (isSetNonRDFannotation()) { - nonRdfAnnotationClone = nonRDFannotation.clone(); - } - - // TODO - get the list of AnnotationWriter from the manager - List<AnnotationWriter> annotationParsers = new ArrayList<AnnotationWriter>(); - // hack to delete - annotationParsers.add(new SBMLRDFAnnotationParser()); - - // calling the annotation parsers so that they update the XMLNode before returning it to the user - for (AnnotationWriter annoWriter : annotationParsers) { - nonRdfAnnotationClone = annoWriter.writeAnnotation((SBase) getParent(), nonRdfAnnotationClone); - } - - return nonRdfAnnotationClone; - } - - /** - * - * - * @return - */ - public String getFullAnnotationString() { - - XMLNode fullAnnotation = getFullAnnotation(); - - // System.out.println("getFullAnnotationString - " + fullAnnotation); - - if (fullAnnotation != null) { - try { - return fullAnnotation.toXMLString(); - } catch (XMLStreamException e) { - Logger logger = Logger.getLogger(Annotation.class); - if (logger.isDebugEnabled()) { - e.printStackTrace(); - } - } - } - - return ""; - } - /* (non-Javadoc) * @see javax.swing.tree.TreeNode#getChildAt(int) */ @@ -414,7 +400,7 @@ // } throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", - childIndex, +Math.min(pos, 0))); + childIndex, Math.min(pos, 0))); } /* (non-Javadoc) @@ -447,27 +433,84 @@ /** - * Returns the {@link History} of the Annotation. + * Gives the number of {@link CVTerm}s in this {@link Annotation}. * - * @return the {@link History} of the Annotation. + * @return the number of controlled vocabulary terms in this {@link Annotation}. */ - public History getHistory() { - if (!isSetHistory()) { - createHistory(); + public int getCVTermCount() { + return isSetListOfCVTerms() ? listOfCVTerms.size() : 0; + } + + /** + * + * @return + */ + public XMLNamespaces getDeclaredNamespaces() { + return isSetNonRDFannotation() ? nonRDFannotation.getNamespaces() : null; + } + + /** + * + * + * @return + */ + public XMLNode getFullAnnotation() { + + XMLNode nonRdfAnnotationClone = null; + + if (isSetNonRDFannotation()) { + nonRdfAnnotationClone = nonRDFannotation.clone(); } - return history; + // TODO - get the list of AnnotationWriter from the manager + List<AnnotationWriter> annotationParsers = new ArrayList<AnnotationWriter>(); + // hack to delete + annotationParsers.add(new SBMLRDFAnnotationParser()); + + // calling the annotation parsers so that they update the XMLNode before returning it to the user + for (AnnotationWriter annoWriter : annotationParsers) { + nonRdfAnnotationClone = annoWriter.writeAnnotation((SBase) getParent(), nonRdfAnnotationClone); + } + + return nonRdfAnnotationClone; } + /** - * @see org.sbml.jsbml.SBase#getHistory() + * + * * @return */ - private History createHistory() { - history = new History(); - history.parent = this; - history.addAllChangeListeners(getListOfTreeNodeChangeListeners()); + public String getFullAnnotationString() { + XMLNode fullAnnotation = getFullAnnotation(); + + // System.out.println("getFullAnnotationString - " + fullAnnotation); + + if (fullAnnotation != null) { + try { + return fullAnnotation.toXMLString(); + } catch (XMLStreamException e) { + Logger logger = Logger.getLogger(Annotation.class); + if (logger.isDebugEnabled()) { + e.printStackTrace(); + } + } + } + + return ""; + } + + /** + * Returns the {@link History} of the Annotation. + * + * @return the {@link History} of the Annotation. + */ + public History getHistory() { + if (!isSetHistory()) { + createHistory(); + } + return history; } @@ -483,6 +526,19 @@ return listOfCVTerms; } + /** + * Returns the {@link XMLNode} containing annotations other than + * the official RDF annotation, as defined in the SBML specifications. + * + * @return the {@link XMLNode} containing annotations other than RDF + * annotation. Return null if there are none. + */ + public XMLNode getNonRDFannotation() { + if (nonRDFannotation != null) { + return nonRDFannotation; + } + return null; + } /** * Returns the String containing annotations other than RDF @@ -503,21 +559,6 @@ } /** - * Returns the {@link XMLNode} containing annotations other than - * the official RDF annotation, as defined in the SBML specifications. - * - * @return the {@link XMLNode} containing annotations other than RDF - * annotation. Return null if there are none. - */ - public XMLNode getNonRDFannotation() { - if (nonRDFannotation != null) { - return nonRDFannotation; - } - return null; - } - - - /** * Gives the number of {@link CVTerm}s in this {@link Annotation}. * * @return the number of controlled vocabulary terms in this {@link Annotation}. @@ -527,13 +568,13 @@ return getCVTermCount(); } + /** - * Gives the number of {@link CVTerm}s in this {@link Annotation}. * - * @return the number of controlled vocabulary terms in this {@link Annotation}. + * @return */ - public int getCVTermCount() { - return isSetListOfCVTerms() ? listOfCVTerms.size() : 0; + public XMLNode getXMLNode() { + return getNonRDFannotation(); } /* (non-Javadoc) @@ -552,7 +593,6 @@ return hashCode; } - /** * * @return @@ -572,6 +612,7 @@ return about != null; } + /** * Checks if the {@link Annotation} is initialized. * @@ -613,7 +654,6 @@ return history != null && !history.isEmpty(); } - /** * Checks if the list of {@link CVTerm} is not empty. * @@ -653,6 +693,7 @@ return isSetNonRDFannotation(); } + /** * Checks if the RDF part of the Annotation is initialized. * @@ -699,7 +740,6 @@ return false; } - /** * Removes the given {@link CVTerm}. * @@ -718,6 +758,8 @@ return success; } + + /** * Removes the {@link CVTerm} at the given index. * @@ -748,8 +790,6 @@ firePropertyChange(TreeNodeChangeEvent.about, oldAbout, this.about); } - - /** * Changes the {@link History} instance to 'history' * @@ -766,6 +806,18 @@ /** * Sets the value of the non RDF annotations * + * @param nonRDFAnnotationStr + * @throws XMLStreamException + */ + public void setNonRDFAnnotation(String nonRDFAnnotationStr) throws XMLStreamException { + if (nonRDFAnnotationStr != null) { + setNonRDFAnnotation(XMLNode.convertStringToXMLNode(StringTools.toXMLAnnotationString(nonRDFAnnotationStr))); + } + } + + /** + * Sets the value of the non RDF annotations + * * @param nonRDFAnnotation */ public void setNonRDFAnnotation(XMLNode nonRDFAnnotation) { @@ -791,18 +843,6 @@ } /** - * Sets the value of the non RDF annotations - * - * @param nonRDFAnnotationStr - * @throws XMLStreamException - */ - public void setNonRDFAnnotation(String nonRDFAnnotationStr) throws XMLStreamException { - if (nonRDFAnnotationStr != null) { - setNonRDFAnnotation(XMLNode.convertStringToXMLNode(StringTools.toXMLAnnotationString(nonRDFAnnotationStr))); - } - } - - /** * Clears the {@link List} of {@link CVTerm}s. */ public void unsetCVTerms() { @@ -841,29 +881,4 @@ } } - /** - * Adds an additional namespace to the set of declared namespaces of this - * {@link SBase}. - * - * @param prefix the prefix of the namespace to add - * @param uri the namespace uri - * - */ - public void addDeclaredNamespace(String prefix, String uri) - { - if (!isSetNonRDFannotation()) { - nonRDFannotation = new XMLNode(new XMLTriple("annotation", null, null), new XMLAttributes()); - } - - nonRDFannotation.addNamespace(uri, prefix); - } - - /** - * - * @return - */ - public XMLNamespaces getDeclaredNamespaces() { - return isSetNonRDFannotation() ? nonRDFannotation.getNamespaces() : null; - } - } Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Event.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Event.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/Event.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -332,6 +332,18 @@ return t; } + /** + * Creates a new {@link Trigger} instance and sets it to this {@link Event}. + * + * @param math math the math expression for the new {@link Trigger} + * @return the new {@link Trigger} instance. + */ + public Trigger createTrigger(ASTNode math) { + Trigger t = createTrigger(); + t.setMath(math); + return t; + } + /* (non-Javadoc) * @see org.sbml.jsbml.AbstractNamedSBaseWithUnit#equals(java.lang.Object) */ Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SBMLError.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SBMLError.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SBMLError.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -131,6 +131,8 @@ */ public SBMLError(String message) { super(message); + this.message = new Message(); + this.message.setMessage(message); } /** Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SpeciesReference.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SpeciesReference.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/SpeciesReference.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -198,6 +198,20 @@ return isSetStoichiometry() ? false : true; } + /** + * + * @param math + * @return + * @deprecated since SBML Level 3 this should not be used anymore. + */ + @Deprecated + public StoichiometryMath createStoichiometryMath(ASTNode math) { + StoichiometryMath sm = new StoichiometryMath(getLevel(), getVersion()); + sm.setMath(math); + setStoichiometryMath(sm); + return sm; + } + /* (non-Javadoc) * @see org.sbml.jsbml.SimpleSpeciesReference#equals(java.lang.Object) */ @@ -345,8 +359,8 @@ /** * - * @return the stoichiometryMath of this SpeciesReference. Can be null if - * the stoichiometryMath is not set. + * @return the stoichiometryMath of this SpeciesReference. Can be {@code null} + * if the stoichiometryMath is not set. * @deprecated since SBML Level 3 this should not be used anymore. */ @Deprecated Modified: branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java =================================================================== --- branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -178,6 +178,36 @@ */ public static final String or = "or"; + /** + * Introduced to FBC in version 2. + */ + public static final String associatedSpecies = "associatedSpecies"; + + /** + * + */ + public static final String fluxObjective = "fluxObjective"; + + /** + * + */ + public static final String objective = "objective"; + + /** + * + */ + public static final String fluxBound = "fluxBound"; + + /** + * + */ + public static final String listOfFluxObjectives = "listOfFluxObjectives"; + + /** + * + */ + public static final String listOfFluxes = "listOfFluxes"; + static { namespaces = new ArrayList<String>(); namespaces.add(namespaceURI_L3V1V1); Modified: branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java =================================================================== --- branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -23,6 +23,7 @@ import java.util.Map; import org.sbml.jsbml.AbstractNamedSBase; +import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.UniqueNamedSBase; /** @@ -48,6 +49,65 @@ /** * */ + private String associatedSpecies; + + + /** + * Returns the value of {@link #associatedSpecies}. + * + * @return the value of {@link #associatedSpecies}. + */ + public String getAssociatedSpecies() { + //TODO: if variable is boolean, create an additional "isVar" + //TODO: return primitive data type if possible (e.g., int instead of Integer) + if (isSetAssociatedSpecies()) { + return associatedSpecies; + } + // This is necessary if we cannot return null here. For variables of type String return an empty String if no value is defined. + throw new PropertyUndefinedError(FBCConstants.associatedSpecies, this); + } + + + /** + * Returns whether {@link #associatedSpecies} is set. + * + * @return whether {@link #associatedSpecies} is set. + */ + public boolean isSetAssociatedSpecies() { + return associatedSpecies != null; + } + + + /** + * Sets the value of associatedSpecies + * + * @param associatedSpecies the value of associatedSpecies to be set. + */ + public void setAssociatedSpecies(String associatedSpecies) { + String oldAssociatedSpecies = this.associatedSpecies; + this.associatedSpecies = associatedSpecies; + firePropertyChange(FBCConstants.associatedSpecies, oldAssociatedSpecies, this.associatedSpecies); + } + + + /** + * Unsets the variable associatedSpecies. + * + * @return {@code true} if associatedSpecies was set before, otherwise {@code false}. + */ + public boolean unsetAssociatedSpecies() { + if (isSetAssociatedSpecies()) { + String oldAssociatedSpecies = associatedSpecies; + associatedSpecies = null; + firePropertyChange(FBCConstants.associatedSpecies, oldAssociatedSpecies, associatedSpecies); + return true; + } + return false; + } + + /** + * + */ public GeneProduct() { super(); initDefaults(); @@ -186,6 +246,8 @@ if (attributeName.equals(FBCConstants.geneProductIdentifier) || attributeName.equals(FBCConstants.label)) { setLabel(value); + } else if (attributeName.equals(FBCConstants.associatedSpecies)) { + setAssociatedSpecies(value); } else { isAttributeRead = false; } @@ -260,6 +322,9 @@ if (isSetLabel()) { attributes.put(FBCConstants.shortLabel + ":" + FBCConstants.label, getLabel()); } + if (isSetAssociatedSpecies()) { + attributes.put(FBCConstants.shortLabel + ":" + FBCConstants.associatedSpecies, getAssociatedSpecies()); + } return attributes; } Modified: branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java =================================================================== --- branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -313,7 +313,7 @@ } throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", - index, +Math.min(pos, 0))); + index, Math.min(pos, 0))); } /* (non-Javadoc) Modified: branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java =================================================================== --- branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -69,6 +69,7 @@ * @since 1.0 * @version $Rev$ */ +@SuppressWarnings("deprecation") @ProviderFor(ReadingParser.class) public class FBCParser extends AbstractReaderWriter implements PackageParser { @@ -191,7 +192,7 @@ */ // Create the proper object and link it to his parent. @Override - @SuppressWarnings({"unchecked", "deprecation"}) + @SuppressWarnings({"unchecked"}) public Object processStartElement(String elementName, String uri, String prefix, boolean hasAttributes, boolean hasNamespaces, Object contextObject) { @@ -226,7 +227,7 @@ } else if (contextObject instanceof Objective) { Objective objective = (Objective) contextObject; - if (elementName.equals("listOfFluxObjectives") || elementName.equals("listOfFluxes")) { + if (elementName.equals(FBCConstants.listOfFluxObjectives) || elementName.equals(FBCConstants.listOfFluxes)) { // listOfFluxes was the first name of listOfFluxObjectives in the preliminary specifications ListOf<FluxObjective> listOfFluxObjectives = objective.getListOfFluxObjectives(); groupList = FBCList.listOfFluxObjectives; @@ -285,7 +286,7 @@ else if (contextObject instanceof ListOf<?>) { ListOf<SBase> listOf = (ListOf<SBase>) contextObject; - if (elementName.equals("fluxBound") + if (elementName.equals(FBCConstants.fluxBound) && groupList.equals(FBCList.listOfFluxBounds)) { Model model = (Model) listOf.getParentSBMLObject(); FBCModelPlugin extendeModel = (FBCModelPlugin) model.getExtension(FBCConstants.shortLabel); @@ -294,7 +295,7 @@ extendeModel.addFluxBound(fluxBound); return fluxBound; - } else if (elementName.equals("objective") + } else if (elementName.equals(FBCConstants.objective) && groupList.equals(FBCList.listOfObjectives)) { Model model = (Model) listOf.getParentSBMLObject(); FBCModelPlugin extendeModel = (FBCModelPlugin) model.getExtension(FBCConstants.shortLabel); @@ -303,7 +304,7 @@ extendeModel.addObjective(objective); return objective; - } else if (elementName.equals("fluxObjective") + } else if (elementName.equals(FBCConstants.fluxObjective) && groupList.equals(FBCList.listOfFluxObjectives)) { Objective objective = (Objective) listOf.getParentSBMLObject(); @@ -311,7 +312,7 @@ objective.addFluxObjective(fluxObjective); return fluxObjective; - } else if (elementName.equals("geneProduct") + } else if (elementName.equals(FBCConstants.geneProduct) && groupList.equals(FBCList.listOfGeneProducts)) { Model model = (Model) listOf.getParentSBMLObject(); FBCModelPlugin extendeModel = (FBCModelPlugin) model.getExtension(FBCConstants.shortLabel); @@ -329,12 +330,13 @@ /* (non-Javadoc) * @see org.sbml.jsbml.xml.parsers.WritingParser#writeElement(org.sbml.jsbml.xml.stax.SBMLObjectForXML, java.lang.Object) */ - @SuppressWarnings("deprecation") @Override public void writeElement(SBMLObjectForXML xmlObject, Object sbmlElementToWrite) { - logger.debug("FBCParser: writeElement"); + if (logger.isDebugEnabled()) { + logger.debug("FBCParser: writeElement"); + } if (sbmlElementToWrite instanceof SBase) { SBase sbase = (SBase) sbmlElementToWrite; Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -33,7 +33,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -103,6 +104,9 @@ this.spatialId = spatialId; } + @Override + public abstract AbstractSpatialNamedSBase clone(); + /** * Initializes the default values using the namespace. */ Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -1,143 +1,152 @@ -/* - * $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-2015 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 - * 4. The University of California, San Diego, La Jolla, CA, USA - * 5. The Babraham Institute, Cambridge, UK - * - * 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.spatial; - -import java.util.Map; - -import org.sbml.jsbml.Model; -import org.sbml.jsbml.SBMLDocument; -import org.sbml.jsbml.SBase; -import org.sbml.jsbml.ext.AbstractSBasePlugin; - -/** - * - * @author Alex Thomas - * @version $Rev$ - * @since 1.0 - * @date Jan 22, 2014 - */ -public abstract class AbstractSpatialSBasePlugin extends AbstractSBasePlugin { - - /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = -75143209163226722L; - - /** - * - */ - public AbstractSpatialSBasePlugin() { - super(); - initDefaults(); - } - - /** - * @param plugin - */ - public AbstractSpatialSBasePlugin(AbstractSpatialSBasePlugin plugin) { - super(plugin); - } - - /** - * @param extendedSBase - */ - public AbstractSpatialSBasePlugin(SBase extendedSBase) { - super(extendedSBase); - initDefaults(); - } - - /** - * Initializes the default values using the namespace. - */ - public void initDefaults() { - setNamespace(SpatialConstants.namespaceURI); // TODO - removed once the mechanism are in place to set package version and namespace - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractTreeNode#getParent() - */ - @Override - public SBase getParent() { - if (isSetExtendedSBase()) { - return (SBase) getExtendedSBase().getParent(); - } - - return null; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.AbstractSBasePlugin#getParentSBMLObject() - */ - @Override - public SBase getParentSBMLObject() { - return getParent(); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getPackageName() - */ - @Override - public String getPackageName() { - return SpatialConstants.shortLabel; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getPrefix() - */ - @Override - public String getPrefix() { - return SpatialConstants.shortLabel; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.SBasePlugin#getURI() - */ - @Override - public String getURI() { - return getElementNamespace(); - } - - /* (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.AbstractSBasePlugin#writeXMLAttributes() - */ - @Override - public Map<String, String> writeXMLAttributes() { - return super.writeXMLAttributes(); - } - - /** - * @return - */ - public Model getModel() { - SBMLDocument doc = getSBMLDocument(); - return doc != null ? doc.getModel() : null; - } - -} +/* + * $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-2015 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 + * 4. The University of California, San Diego, La Jolla, CA, USA + * 5. The Babraham Institute, Cambridge, UK + * + * 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.spatial; + +import java.util.Map; + +import org.sbml.jsbml.Model; +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.SBase; +import org.sbml.jsbml.ext.AbstractSBasePlugin; + +/** + * + * @author Alex Thomas + * @author Piero Dalle Pezze + * @version $Rev$ + * @since 1.0 + * @date Jan 22, 2014 + */ +public abstract class AbstractSpatialSBasePlugin extends AbstractSBasePlugin { + + /** + * Generated serial version identifier. + */ + private static final long serialVersionUID = -75143209163226722L; + + /** + * + */ + public AbstractSpatialSBasePlugin() { + super(); + initDefaults(); + } + + /** + * @param plugin + */ + public AbstractSpatialSBasePlugin(AbstractSpatialSBasePlugin plugin) { + super(plugin); + } + + /** + * @param extendedSBase + */ + public AbstractSpatialSBasePlugin(SBase extendedSBase) { + super(extendedSBase); + initDefaults(); + } + + @Override + public abstract AbstractSpatialSBasePlugin clone(); + + /** + * Initializes the default values using the namespace. + */ + public void initDefaults() { + setNamespace(SpatialConstants.namespaceURI); // TODO - removed once the mechanism are in place to set package version and namespace + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.AbstractTreeNode#getParent() + */ + @Override + public SBase getParent() { + if (isSetExtendedSBase()) { + return (SBase) getExtendedSBase().getParent(); + } + + return null; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.AbstractSBasePlugin#getParentSBMLObject() + */ + @Override + public SBase getParentSBMLObject() { + return getParent(); + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getPackageName() + */ + @Override + public String getPackageName() { + return SpatialConstants.shortLabel; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getPrefix() + */ + @Override + public String getPrefix() { + return SpatialConstants.shortLabel; + } + + /* (non-Javadoc) + * @see org.sbml.jsbml.ext.SBasePlugin#getURI() + */ + @Override + public String getURI() { + return getElementNamespace(); + } + + /* (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.AbstractSBasePlugin#writeXMLAttributes() + */ + @Override + public Map<String, String> writeXMLAttributes() { + return super.writeXMLAttributes(); + } + + /** + * @return + */ + public Model getModel() { + SBMLDocument doc = getSBMLDocument(); + return doc != null ? doc.getModel() : null; + } + + @Override + public String toString() { + return super.toString(); + } + +} Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -39,14 +39,13 @@ /** * Generated serial version identifier. */ - private static final long serialVersionUID = 8982184068116596444L; - + private static final long serialVersionUID = 8982184068116596444L; + /** * */ private CoordinateKind coordinate; - /** * */ Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -33,7 +33,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -283,5 +284,16 @@ } return equal; } + + @Override + public int hashCode() { + final int prime = 1039;//Change this prime number + int hashCode = super.hashCode(); + if (isSetListOfAnalyticVolumes()) { + hashCode += prime * getListOfAnalyticVolumes().hashCode(); + } + return hashCode; + } + } Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -35,7 +35,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -102,14 +103,17 @@ public AnalyticVolume(AnalyticVolume node) { super(node); if (node.isSetSpatialId()) { - spatialId = new String(node.getSpatialId()); + setSpatialId(node.getSpatialId()); } if (node.isSetOrdinal()) { - ordinal = new Integer(node.getOrdinal()); + setOrdinal(node.getOrdinal()); } if (node.isSetFunctionType()) { - functionType = node.getFunctionType(); + setFunctionType(node.getFunctionType()); } + if (node.isSetDomainType()) { + setDomainType(node.getDomainType()); + } } /** @@ -302,7 +306,7 @@ * @param ordinal */ public void setOrdinal(int ordinal) { - int oldOrdinal = this.ordinal; + Integer oldOrdinal = this.ordinal; this.ordinal = ordinal; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, this.ordinal); } @@ -315,7 +319,7 @@ */ public boolean unsetOrdinal() { if (isSetOrdinal()) { - int oldOrdinal = ordinal; + Integer oldOrdinal = ordinal; ordinal = null; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, ordinal); return true; @@ -372,7 +376,7 @@ */ @Override public int hashCode() { - final int prime = 431;//Change this prime number + final int prime = 1093;//Changed. It was 431 int hashCode = super.hashCode(); if (isSetSpatialId()) { hashCode += prime * getSpatialId().hashCode(); @@ -411,14 +415,7 @@ attributes.remove("functionType"); attributes.put(SpatialConstants.shortLabel + ":functionType", getFunctionType().toString()); } - if (isSetSBOTerm()) { - attributes.remove(TreeNodeChangeEvent.sboTerm); - attributes.put(SpatialConstants.shortLabel + ":" + TreeNodeChangeEvent.sboTerm, getSBOTermID()); - } - if (isSetMetaId()) { - attributes.remove(TreeNodeChangeEvent.metaId); - attributes.put(SpatialConstants.shortLabel + ":" + TreeNodeChangeEvent.metaId, getMetaId()); - } + return attributes; } Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -126,7 +126,7 @@ * @param value */ public void setValue(double value) { - double oldValue = this.value; + Double oldValue = this.value; this.value = value; firePropertyChange(SpatialConstants.value, oldValue, this.value); } @@ -140,7 +140,7 @@ */ public boolean unsetValue() { if (isSetValue()) { - double oldValue = value; + Double oldValue = value; value = null; firePropertyChange(SpatialConstants.value, oldValue, value); return true; Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -29,6 +29,7 @@ /** * @author Alex-Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 @@ -99,8 +100,20 @@ return new CSGHomogeneousTransformation(this); } - @Override + public int hashCode() { + final int prime = 1697; + int hashCode = super.hashCode(); + if (isSetForwardTransformation()) { + hashCode += prime * getForwardTransformation().hashCode(); + } + if (isSetReverseTransformation()) { + hashCode += prime * getReverseTransformation().hashCode(); + } + return hashCode; + } + + @Override public boolean equals(Object object) { boolean equal = super.equals(object); if (equal) { Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -79,19 +79,15 @@ */ public CSGObject(CSGObject csgo) { super(csgo); - if (csgo.isSetDomainType()) { - domainType = new String(csgo.getDomainType()); + setDomainType(csgo.getDomainType()); } - if (csgo.isSetOrdinal()) { - ordinal = new Integer(csgo.getOrdinal()); + setOrdinal(csgo.getOrdinal()); } - if (csgo.isSetCSGNode()) { setCSGNode((CSGNode) csgo.getCSGNode().clone()); } - } @@ -228,7 +224,7 @@ * @param ordinal */ public void setOrdinal(int ordinal) { - int oldOrdinal = this.ordinal; + Integer oldOrdinal = this.ordinal; this.ordinal = ordinal; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, this.ordinal); } @@ -242,7 +238,7 @@ */ public boolean unsetOrdinal() { if (isSetOrdinal()) { - int oldOrdinal = ordinal; + Integer oldOrdinal = ordinal; ordinal = null; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, ordinal); return true; @@ -303,7 +299,7 @@ @Override public int hashCode() { - final int prime = 1999;//Change this prime number + final int prime = 1669; int hashCode = super.hashCode(); if (isSetOrdinal()) { hashCode += prime * getOrdinal(); Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -103,12 +103,9 @@ */ public CSGPrimitive(CSGPrimitive csgp) { super(csgp); - - if (csgp.isSetPrimitiveType()) { - primitiveType = csgp.getPrimitiveType(); + setPrimitiveType(csgp.getPrimitiveType()); } - } @@ -213,7 +210,7 @@ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1081; int hashCode = super.hashCode(); if (isSetPrimitiveType()) { hashCode += prime * getPrimitiveType().hashCode(); Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -64,11 +64,9 @@ */ public CSGPseudoPrimitive(CSGPseudoPrimitive csgp) { super(csgp); - if (csgp.isSetCsgObjectRef()) { - csgObjectRef = new String(csgp.getCsgObjectRef()); + setCsgObjectRef(csgp.getCsgObjectRef()); } - } @@ -166,7 +164,7 @@ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1741; int hashCode = super.hashCode(); if (isSetCsgObjectRef()) { hashCode += prime * getCsgObjectRef().hashCode(); Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -29,6 +29,7 @@ /** * @author Alex Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 @@ -70,17 +71,19 @@ public CSGRotation(CSGRotation csgt) { super(csgt); if (csgt.isSetRotateAxisX()) { - rotateAxisX = new Double(csgt.getRotateAxisX()); + setRotateAxisX(csgt.getRotateAxisX()); } if (csgt.isSetRotateAxisY()) { - rotateAxisY = new Double(csgt.getRotateAxisY()); + setRotateAxisY(csgt.getRotateAxisY()); } if (csgt.isSetRotateAxisZ()) { - rotateAxisZ = new Double(csgt.getRotateAxisZ()); + setRotateAxisZ(csgt.getRotateAxisZ()); } + if (csgt.isSetRotateAngleInRadians()) { + setRotateAngleInRadians(csgt.getRotateAngleInRadians()); + } } - /** * @param level * @param version @@ -165,7 +168,7 @@ * @param rotateAxisX */ public void setRotateAxisX(double rotateAxisX) { - double oldRotateAxisX = this.rotateAxisX; + Double oldRotateAxisX = this.rotateAxisX; this.rotateAxisX = rotateAxisX; firePropertyChange(SpatialConstants.rotateAxisX, oldRotateAxisX, this.rotateAxisX); } @@ -179,7 +182,7 @@ */ public boolean unsetRotateAxisX() { if (isSetRotateAxisX()) { - double oldRotateAxisX = rotateAxisX; + Double oldRotateAxisX = rotateAxisX; rotateAxisX = null; firePropertyChange(SpatialConstants.rotateAxisX, oldRotateAxisX, rotateAxisX); return true; @@ -217,7 +220,7 @@ * @param rotateAxisY */ public void setRotateAxisY(double rotateAxisY) { - double oldRotateAxisY = this.rotateAxisY; + Double oldRotateAxisY = this.rotateAxisY; this.rotateAxisY = rotateAxisY; firePropertyChange(SpatialConstants.rotateAxisY, oldRotateAxisY, this.rotateAxisY); } @@ -231,7 +234,7 @@ */ public boolean unsetRotateAxisY() { if (isSetRotateAxisY()) { - double oldRotateAxisY = rotateAxisY; + Double oldRotateAxisY = rotateAxisY; rotateAxisY = null; firePropertyChange(SpatialConstants.rotateAxisY, oldRotateAxisY, rotateAxisY); return true; @@ -269,7 +272,7 @@ * @param rotateAxisZ */ public void setRotateAxisZ(double rotateAxisZ) { - double oldRotateAxisZ = this.rotateAxisZ; + Double oldRotateAxisZ = this.rotateAxisZ; this.rotateAxisZ = rotateAxisZ; firePropertyChange(SpatialConstants.rotateAxisZ, oldRotateAxisZ, this.rotateAxisZ); } @@ -283,7 +286,7 @@ */ public boolean unsetRotateAxisZ() { if (isSetRotateAxisZ()) { - double oldRotateAxisZ = rotateAxisZ; + Double oldRotateAxisZ = rotateAxisZ; rotateAxisZ = null; firePropertyChange(SpatialConstants.rotateAxisZ, oldRotateAxisZ, rotateAxisZ); return true; @@ -321,7 +324,7 @@ * @param rotateAngleInRadians */ public void setRotateAngleInRadians(double rotateAngleInRadians) { - double oldRotateAngleInRadians = this.rotateAngleInRadians; + Double oldRotateAngleInRadians = this.rotateAngleInRadians; this.rotateAngleInRadians = rotateAngleInRadians; firePropertyChange(SpatialConstants.rotateAngleInRadians, oldRotateAngleInRadians, this.rotateAngleInRadians); } @@ -335,7 +338,7 @@ */ public boolean unsetRotateAngleInRadians() { if (isSetRotateAngleInRadians()) { - double oldRotateAngleInRadians = rotateAngleInRadians; + Double oldRotateAngleInRadians = rotateAngleInRadians; rotateAngleInRadians = null; firePropertyChange(SpatialConstants.rotateAngleInRadians, oldRotateAngleInRadians, rotateAngleInRadians); return true; @@ -345,7 +348,7 @@ @Override public int hashCode() { - final int prime = 313;//Change this prime number + final int prime = 1787; int hashCode = super.hashCode(); if (isSetRotateAxisX()) { hashCode += prime * getRotateAxisX(); @@ -367,20 +370,16 @@ public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetRotateAxisX()) { - attributes.remove("rotateAxisX"); - attributes.put(SpatialConstants.shortLabel + ":rotateAxisX", String.valueOf(getRotateAxisX())); + attributes.put(SpatialConstants.shortLabel + ":rotateAxisX", rotateAxisX.toString()); } if (isSetRotateAxisY()) { - attributes.remove("rotateAxisY"); - attributes.put(SpatialConstants.shortLabel + ":rotateAxisY", String.valueOf(getRotateAxisY())); + attributes.put(SpatialConstants.shortLabel + ":rotateAxisY", rotateAxisY.toString()); } if (isSetRotateAxisZ()) { - attributes.remove("rotateAxisZ"); - attributes.put(SpatialConstants.shortLabel + ":rotateAxisZ", String.valueOf(getRotateAxisZ())); + attributes.put(SpatialConstants.shortLabel + ":rotateAxisZ", rotateAxisZ.toString()); } if (isSetRotateAngleInRadians()) { - attributes.remove("rotateAngleInRadians"); - attributes.put(SpatialConstants.shortLabel + ":rotateAngleInRadians", String.valueOf(getRotateAngleInRadians())); + attributes.put(SpatialConstants.shortLabel + ":rotateAngleInRadians", rotateAngleInRadians.toString()); } return attributes; } Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -30,6 +30,7 @@ /** * @author Alex Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 @@ -68,13 +69,13 @@ public CSGScale(CSGScale csgt) { super(csgt); if (csgt.isSetScaleX()) { - scaleX = new Double(csgt.getScaleX()); + setScaleX(csgt.getScaleX()); } if (csgt.isSetScaleY()) { - scaleY = new Double(csgt.getScaleY()); + setScaleY(csgt.getScaleY()); } if (csgt.isSetScaleZ()) { - scaleZ = new Double(csgt.getScaleZ()); + setScaleZ(csgt.getScaleZ()); } } @@ -159,7 +160,7 @@ * @param scaleX */ public void setScaleX(double scaleX) { - double oldScaleX = this.scaleX; + Double oldScaleX = this.scaleX; this.scaleX = scaleX; firePropertyChange(SpatialConstants.scaleX, oldScaleX, this.scaleX); } @@ -173,7 +174,7 @@ */ public boolean unsetScaleX() { if (isSetScaleX()) { - double oldScaleX = scaleX; + Double oldScaleX = scaleX; scaleX = null; firePropertyChange(SpatialConstants.scaleX, oldScaleX, scaleX); return true; @@ -211,7 +212,7 @@ * @param scaleY */ public void setScaleY(double scaleY) { - double oldScaleY = this.scaleY; + Double oldScaleY = this.scaleY; this.scaleY = scaleY; firePropertyChange(SpatialConstants.scaleY, oldScaleY, this.scaleY); } @@ -225,7 +226,7 @@ */ public boolean unsetScaleY() { if (isSetScaleY()) { - double oldScaleY = scaleY; + Double oldScaleY = scaleY; scaleY = null; firePropertyChange(SpatialConstants.scaleY, oldScaleY, scaleY); return true; @@ -263,7 +264,7 @@ * @param scaleZ */ public void setScaleZ(double scaleZ) { - double oldScaleZ = this.scaleZ; + Double oldScaleZ = this.scaleZ; this.scaleZ = scaleZ; firePropertyChange(SpatialConstants.scaleZ, oldScaleZ, this.scaleZ); } @@ -277,7 +278,7 @@ */ public boolean unsetScaleZ() { if (isSetScaleZ()) { - double oldScaleZ = scaleZ; + Double oldScaleZ = scaleZ; scaleZ = null; firePropertyChange(SpatialConstants.scaleZ, oldScaleZ, scaleZ); return true; @@ -288,7 +289,7 @@ @Override public int hashCode() { - final int prime = 313;//Change this prime number + final int prime = 1777; int hashCode = super.hashCode(); if (isSetScaleX()) { hashCode += prime * getScaleX(); @@ -307,16 +308,13 @@ public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetScaleX()) { - attributes.remove("scaleX"); - attributes.put(SpatialConstants.shortLabel + ":scaleX", String.valueOf(getScaleX())); + attributes.put(SpatialConstants.shortLabel + ":scaleX", scaleX.toString()); } if (isSetScaleY()) { - attributes.remove("scaleY"); - attributes.put(SpatialConstants.shortLabel + ":scaleY", String.valueOf(getScaleY())); + attributes.put(SpatialConstants.shortLabel + ":scaleY", scaleY.toString()); } if (isSetScaleZ()) { - attributes.remove("scaleZ"); - attributes.put(SpatialConstants.shortLabel + ":scaleZ", String.valueOf(getScaleZ())); + attributes.put(SpatialConstants.shortLabel + ":scaleZ", scaleZ.toString()); } return attributes; } Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -36,6 +36,7 @@ /** * @author Alex Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 @@ -105,15 +106,15 @@ } if (csgso.isSetOperationType()) { - operationType = csgso.getOperationType(); + setOperationType(csgso.getOperationType()); } if (csgso.isSetComplementA()) { - complementA = new String(csgso.getComplementA()); + setComplementA(csgso.getComplementA()); } if (csgso.isSetComplementB()) { - complementB = new String(csgso.getComplementB()); + setComplementB(csgso.getComplementB()); } } @@ -638,7 +639,7 @@ */ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1861; int hashCode = super.hashCode(); if (isSetOperationType()) { hashCode += prime * getOperationType().hashCode(); Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java 2015-04-30 15:40:25 UTC (rev 2266) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java 2015-05-01 09:44:19 UTC (rev 2267) @@ -29,6 +29,7 @@ /** * @author Alex-Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 Modified: branches/astnode2-merging-... [truncated message content] |