You can subscribe to this list here.
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(27) |
Jun
(63) |
Jul
(17) |
Aug
(58) |
Sep
(7) |
Oct
(9) |
Nov
(3) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2013 |
Jan
(16) |
Feb
(5) |
Mar
(8) |
Apr
(3) |
May
(9) |
Jun
(7) |
Jul
(11) |
Aug
(1) |
Sep
(5) |
Oct
(33) |
Nov
(21) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(43) |
Mar
(36) |
Apr
(22) |
May
(69) |
Jun
(76) |
Jul
(66) |
Aug
(53) |
Sep
(39) |
Oct
(62) |
Nov
(28) |
Dec
(16) |
2015 |
Jan
(7) |
Feb
(2) |
Mar
(51) |
Apr
(97) |
May
(58) |
Jun
(20) |
Jul
(8) |
Aug
(5) |
Sep
(5) |
Oct
(27) |
Nov
(28) |
Dec
(43) |
2016 |
Jan
(17) |
Feb
(4) |
Mar
(12) |
Apr
(5) |
May
(15) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <pd...@us...> - 2015-04-22 14:15:33
|
Revision: 2210 http://sourceforge.net/p/jsbml/code/2210 Author: pdp10 Date: 2015-04-22 13:16:42 +0000 (Wed, 22 Apr 2015) Log Message: ----------- update spatial package v0.90 Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/xml/parsers/SpatialParser.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/xml/parsers/SpatialParser.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/xml/parsers/SpatialParser.java 2015-04-22 13:15:55 UTC (rev 2209) +++ trunk/extensions/spatial/src/org/sbml/jsbml/xml/parsers/SpatialParser.java 2015-04-22 13:16:42 UTC (rev 2210) @@ -68,7 +68,7 @@ import org.sbml.jsbml.ext.spatial.SpatialConstants; import org.sbml.jsbml.ext.spatial.SpatialModelPlugin; import org.sbml.jsbml.ext.spatial.SpatialParameterPlugin; -import org.sbml.jsbml.ext.spatial.SpatialPoint; +import org.sbml.jsbml.ext.spatial.SpatialPoints; import org.sbml.jsbml.ext.spatial.SpatialReactionPlugin; import org.sbml.jsbml.ext.spatial.SpatialSpeciesPlugin; import org.sbml.jsbml.ext.spatial.SpatialSymbolReference; @@ -77,6 +77,7 @@ /** * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -378,7 +379,7 @@ } else if (contextObject instanceof ParametricGeometry) { ParametricGeometry pg = (ParametricGeometry) contextObject; if (elementName.equals(SpatialConstants.listOfSpatialPoints)){ - ListOf<SpatialPoint> listOfSpatialPoints = pg.getListOfSpatialPoints(); + ListOf<SpatialPoints> listOfSpatialPoints = pg.getListOfSpatialPoints(); return listOfSpatialPoints; } else if (elementName.equals(SpatialConstants.listOfParametricObjects)){ ListOf<ParametricObject> listOfParametricObjects = pg.getListOfParametricObjects(); @@ -387,9 +388,11 @@ } else if (contextObject instanceof ParametricObject) { ParametricObject po = (ParametricObject) contextObject; if (elementName.equals(SpatialConstants.imageData)){ - PolygonObject polygonObject = new PolygonObject(); - po.setPolygonObject(polygonObject); - return polygonObject; + // TODO: THIS NEEDS to be updated with the details provided in the spatial package v0.90, + // See ArrayData text child and PointIndex text child + //PolygonObject polygonObject = new PolygonObject(); + //po.setPolygonObject(polygonObject); + //return polygonObject; } } @@ -491,10 +494,10 @@ CSGHomogeneousTransformation elem = new CSGHomogeneousTransformation(); csgso.addCSGNode(elem); return elem; - } else if (elementName.equals(SpatialConstants.spatialPoint)) { + } else if (elementName.equals(SpatialConstants.spatialPoints)) { ParametricGeometry pg = (ParametricGeometry) listOf.getParentSBMLObject(); - SpatialPoint elem = new SpatialPoint(); - pg.addSpatialPoint(elem); + SpatialPoints elem = new SpatialPoints(); + pg.addSpatialPoints(elem); return elem; } else if (elementName.equals(SpatialConstants.parametricObject)) { ParametricGeometry pg = (ParametricGeometry) listOf.getParentSBMLObject(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2015-04-22 14:12:16
|
Revision: 2213 http://sourceforge.net/p/jsbml/code/2213 Author: andreas-draeger Date: 2015-04-22 13:50:09 +0000 (Wed, 22 Apr 2015) Log Message: ----------- Updated FBC package according to latest specification draft. Modified Paths: -------------- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java Modified: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java 2015-04-22 13:22:24 UTC (rev 2212) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/FBCConstants.java 2015-04-22 13:50:09 UTC (rev 2213) @@ -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: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java 2015-04-22 13:22:24 UTC (rev 2212) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/GeneProduct.java 2015-04-22 13:50:09 UTC (rev 2213) @@ -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: trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java 2015-04-22 13:22:24 UTC (rev 2212) +++ trunk/extensions/fbc/src/org/sbml/jsbml/ext/fbc/Objective.java 2015-04-22 13:50:09 UTC (rev 2213) @@ -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: trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java =================================================================== --- trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java 2015-04-22 13:22:24 UTC (rev 2212) +++ trunk/extensions/fbc/src/org/sbml/jsbml/xml/parsers/FBCParser.java 2015-04-22 13:50:09 UTC (rev 2213) @@ -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; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-22 13:22:35
|
Revision: 2212 http://sourceforge.net/p/jsbml/code/2212 Author: pdp10 Date: 2015-04-22 13:22:24 +0000 (Wed, 22 Apr 2015) Log Message: ----------- Removed class ImageData following specs spatial package v0.90 Removed Paths: ------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java Deleted: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java 2015-04-22 13:20:39 UTC (rev 2211) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java 2015-04-22 13:22:24 UTC (rev 2212) @@ -1,359 +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-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.text.MessageFormat; -import java.util.Arrays; -import java.util.Map; -import java.util.StringTokenizer; - -import org.sbml.jsbml.AbstractSBase; -import org.sbml.jsbml.PropertyUndefinedError; -import org.sbml.jsbml.util.StringTools; - -/** - * @author Alex Thomas - * @author Andreas Dräger - * @since 1.0 - * @version $Rev$ - * @deprecated - */ -public class ImageData extends AbstractSBase { - - /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = 1872012239027099782L; - - /** - * - */ - private Integer samplesLength; // TODO: is this field really required?? - /** - * - */ - private Integer[] samples; - - /** - * - */ - private String dataType; - - /** - * - */ - public ImageData() { - super(); - initDefaults(); - } - - /** - * @param im - */ - public ImageData(ImageData im) { - super(im); - if (im.isSetSamples()) { - setSamples(im.getSamples().clone()); - samplesLength = samples.length; - } - if (im.isSetDataType()) { - setDataType(im.getDataType()); - } - } - - /** - * @param level - * @param version - */ - public ImageData(int level, int version) { - super(level, version); - initDefaults(); - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#clone() - */ - @Override - public ImageData clone() { - return new ImageData(this); - } - - /** - * 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 - setPackageVersion(-1); - packageName = SpatialConstants.shortLabel; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#equals(java.lang.Object) - */ - @Override - public boolean equals(Object object) { - boolean equal = super.equals(object); - if (equal) { - ImageData im = (ImageData) object; - - equal &= im.isSetSamples() == isSetSamples(); - if (equal && isSetSamples()) { - equal &= im.getSamples().equals(getSamples()); - } - - equal &= im.isSetDataType() == isSetDataType(); - if (equal && isSetDataType()) { - equal &= im.getDataType().equals(getDataType()); - } - - } - return equal; - } - - - /** - * Returns the value of samples - * - * @return the value of samples - */ - public Integer[] getSamples() { - if (isSetSamples()) { - return samples; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.samples, this); - } - - - /** - * Returns whether samples is set - * - * @return whether samples is set - */ - public boolean isSetSamples() { - return samples != null; - } - - /** - * Sets the value of samples - * @param samples - */ - public void setSamples(Integer... samples) { - Integer[] oldSamples = this.samples; - this.samples = samples; - samplesLength = samples.length; - firePropertyChange(SpatialConstants.samples, oldSamples, this.samples); - firePropertyChange(SpatialConstants.samples, oldSamples.length, samplesLength); - } - - /** - * Unsets the variable samples - * - * @return {@code true}, if samples was set before, - * otherwise {@code false} - */ - public boolean unsetSamples() { - if (isSetSamples()) { - Integer[] oldSamples = samples; - samples = null; - samplesLength = null; - firePropertyChange(SpatialConstants.samples, oldSamples, samples); - firePropertyChange(SpatialConstants.samplesLength, oldSamples.length, samplesLength); - return true; - } - return false; - } - - - /** - * Returns the value of samplesLength - * - * @return the value of samplesLength - */ - public int getSamplesLength() { - if (isSetSamplesLength()) { - return samplesLength; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.samplesLength, this); - } - - - /** - * Returns whether samplesLength is set - * - * @return whether samplesLength is set - */ - public boolean isSetSamplesLength() { - return samplesLength != null; - } - - - /** - * Returns the value of dataType - * - * @return the value of dataType - */ - public String getDataType() { - if (isSetDataType()) { - return dataType; - } - return null; - } - - - /** - * Returns whether dataType is set - * - * @return whether dataType is set - */ - public boolean isSetDataType() { - return dataType != null; - } - - /** - * Sets the value of dataType - * @param dataType - */ - public void setDataType(String dataType) { - String oldDataType = this.dataType; - this.dataType = dataType; - firePropertyChange(SpatialConstants.dataType, oldDataType, this.dataType); - } - - /** - * Unsets the variable dataType - * - * @return {@code true}, if dataType was set before, - * otherwise {@code false} - */ - public boolean unsetDataType() { - if (isSetDataType()) { - String oldDataType = dataType; - dataType = null; - firePropertyChange(SpatialConstants.dataType, oldDataType, dataType); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#hashCode() - */ - @Override - public int hashCode() { - final int prime = 983;//Change this prime number - int hashCode = super.hashCode(); - if (isSetSamples()) { - hashCode += prime * getSamples().hashCode(); - } - if (isSetDataType()) { - hashCode += prime * getDataType().hashCode(); - } - - return hashCode; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#writeXMLAttributes() - */ - @Override - public Map<String, String> writeXMLAttributes() { - Map<String, String> attributes = super.writeXMLAttributes(); - if (isSetSamples()) { - attributes.remove("samples"); - attributes.put(SpatialConstants.shortLabel + ":samples", Arrays.toString(getSamples())); - } - - if (isSetSamplesLength()) { - attributes.remove("samplesLength"); - attributes.put(SpatialConstants.shortLabel + ":samplesLength", - String.valueOf(getSamplesLength())); - } - - if (isSetDataType()) { - attributes.remove("dataType"); - attributes.put(SpatialConstants.shortLabel + ":dataType", - getDataType()); - } - return attributes; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.AbstractSBase#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)) - && (SpatialConstants.shortLabel == prefix); - if (!isAttributeRead) { - isAttributeRead = true; - if (attributeName.equals(SpatialConstants.samples)) { - StringTokenizer test = new StringTokenizer(value); - Integer[] samplesTemp = new Integer[test.countTokens()]; - int i = 0; - while(test.hasMoreTokens()) { - try { - samplesTemp[i] = StringTools.parseSBMLInt(test.nextToken()); - i++; - } catch (Exception e) { - MessageFormat.format( - SpatialConstants.bundle.getString("COULD_NOT_READ"), value, - SpatialConstants.pointIndex); - } - } - if (samplesTemp.length > 0) { - unsetSamples(); - setSamples(samplesTemp); - } - } - else if (attributeName.equals(SpatialConstants.dataType)) { - try { - setDataType(value); - } catch (Exception e) { - MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.dataType); - } - } - else { - isAttributeRead = false; - } - } - return isAttributeRead; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("ImageData [samplesLength="); - builder.append(samplesLength); - builder.append(", dataType="); - builder.append(dataType); - builder.append(", samples="); - builder.append(Arrays.toString(samples)); // TODO - Should we really print the whole content of the array here? - builder.append("]"); - return builder.toString(); - } - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-22 13:20:47
|
Revision: 2211 http://sourceforge.net/p/jsbml/code/2211 Author: pdp10 Date: 2015-04-22 13:20:39 +0000 (Wed, 22 Apr 2015) Log Message: ----------- removed class SpatialPoint. This is replaced with SpatialPoints following the update in spatial package v0.90 Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java Removed Paths: ------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-22 13:16:42 UTC (rev 2210) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-22 13:20:39 UTC (rev 2211) @@ -461,10 +461,6 @@ */ public static final String listOfParametricObjects = "listOfParametricObjects"; /** - * @deprecated - */ - public static final String spatialPoint = "spatialPoint"; - /** * */ public static final String spatialPoints = "spatialPoints"; Deleted: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java 2015-04-22 13:16:42 UTC (rev 2210) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java 2015-04-22 13:20:39 UTC (rev 2211) @@ -1,469 +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-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.text.MessageFormat; -import java.util.Map; - -import org.sbml.jsbml.PropertyUndefinedError; -import org.sbml.jsbml.util.StringTools; - -/** - * @author Alex Thomas - * @author Andreas Dräger - * @since 1.0 - * @version $Rev$ - * @deprecated - */ -public class SpatialPoint extends AbstractSpatialNamedSBase { - - /** - * - */ - private String domain; - - /** - * - */ - private Double coord1; - /** - * - */ - private Double coord2; - /** - * - */ - private Double coord3; - - /** - * Generated serial version identifier. - */ - private static final long serialVersionUID = -1171421071571874086L; - - /** - * - */ - public SpatialPoint() { - super(); - } - - /** - * @param sp - */ - public SpatialPoint(SpatialPoint sp) { - super(sp); - - - if (sp.isSetDomain()) { - domain = new String(sp.getDomain()); - } - - if (sp.isSetCoord1()) { - coord1 = new Double(sp.getCoord1()); - } - - if (sp.isSetCoord2()) { - coord2 = new Double(sp.getCoord2()); - } - - if (sp.isSetCoord3()) { - coord3 = new Double(sp.getCoord3()); - } - } - - - /** - * @param level - * @param version - */ - public SpatialPoint(int level, int version) { - super(level, version); - } - - - /** - * - * @param id - * @param level - * @param version - */ - public SpatialPoint(String id, int level, int version) { - super(id, level, version); - } - - - @Override - public SpatialPoint clone() { - return new SpatialPoint(this); - } - - - @Override - public boolean equals(Object object) { - boolean equal = super.equals(object); - if (equal) { - SpatialPoint sp = (SpatialPoint) object; - - equal &= sp.isSetDomain() == isSetDomain(); - if (equal && isSetDomain()) { - equal &= sp.getDomain().equals(getDomain()); - } - - equal &= sp.isSetCoord1() == isSetCoord1(); - if (equal && isSetCoord1()) { - equal &= sp.getCoord1() == getCoord1(); - } - - equal &= sp.isSetCoord2() == isSetCoord2(); - if (equal && isSetCoord2()) { - equal &= sp.getCoord2() == getCoord2(); - } - - equal &= sp.isSetCoord3() == isSetCoord3(); - if (equal && isSetCoord3()) { - equal &= sp.getCoord3() == getCoord3(); - } - //TODO: add equal statements for each attribute and class - } - return equal; - } - - /** - * Returns the value of coord1 - * - * @return the value of coord1 - */ - public double getCoord1() { - if (isSetCoord1()) { - return coord1; - } - //TODO: This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.coord1, this); - } - - - /** - * Returns whether coord1 is set - * - * @return whether coord1 is set - */ - public boolean isSetCoord1() { - return coord1 != null; - } - - /** - * Sets the value of coord1 - * @param coord1 - */ - public void setCoord1(double coord1) { - double oldCoord1 = this.coord1; - this.coord1 = coord1; - firePropertyChange(SpatialConstants.coord1, oldCoord1, this.coord1); - } - - - /** - * Unsets the variable coord1 - * - * @return {@code true}, if coord1 was set before, - * otherwise {@code false} - */ - public boolean unsetCoord1() { - if (isSetCoord1()) { - double oldCoord1 = coord1; - coord1 = null; - firePropertyChange(SpatialConstants.coord1, oldCoord1, coord1); - return true; - } - return false; - } - - /** - * Returns the value of coord2 - * - * @return the value of coord2 - */ - public double getCoord2() { - if (isSetCoord2()) { - return coord2; - } - //TODO: This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.coord2, this); - } - - - /** - * Returns whether coord2 is set - * - * @return whether coord2 is set - */ - public boolean isSetCoord2() { - return coord2 != null; - } - - /** - * Sets the value of coord2 - * @param coord2 - */ - public void setCoord2(double coord2) { - double oldCoord2 = this.coord2; - this.coord2 = coord2; - firePropertyChange(SpatialConstants.coord2, oldCoord2, this.coord2); - } - - - /** - * Unsets the variable coord2 - * - * @return {@code true}, if coord2 was set before, - * otherwise {@code false} - */ - public boolean unsetCoord2() { - if (isSetCoord2()) { - double oldCoord2 = coord2; - coord2 = null; - firePropertyChange(SpatialConstants.coord2, oldCoord2, coord2); - return true; - } - return false; - } - - /** - * Returns the value of coord3 - * - * @return the value of coord3 - */ - public double getCoord3() { - if (isSetCoord3()) { - return coord3; - } - // TODO:This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.coord3, this); - } - - - /** - * Returns whether coord3 is set - * - * @return whether coord3 is set - */ - public boolean isSetCoord3() { - return coord3 != null; - } - - /** - * Sets the value of coord3 - * @param coord3 - */ - public void setCoord3(double coord3) { - double oldCoord3 = this.coord3; - this.coord3 = coord3; - firePropertyChange(SpatialConstants.coord3, oldCoord3, this.coord3); - } - - - /** - * Unsets the variable coord3 - * - * @return {@code true}, if coord3 was set before, - * otherwise {@code false} - */ - public boolean unsetCoord3() { - if (isSetCoord3()) { - double oldCoord3 = coord3; - coord3 = null; - firePropertyChange(SpatialConstants.coord3, oldCoord3, coord3); - return true; - } - return false; - } - - /** - * Returns the value of domain - * - * @return the value of domain - */ - public String getDomain() { - if (isSetDomain()) { - return domain; - } - // TODO: This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.domain, this); - } - - - /** - * Returns whether domain is set - * - * @return whether domain is set - */ - public boolean isSetDomain() { - return domain != null; - } - - /** - * Sets the value of domain - * @param domain - */ - public void setDomain(String domain) { - String oldDomain = this.domain; - this.domain = domain; - firePropertyChange(SpatialConstants.domain, oldDomain, this.domain); - } - - /** - * Unsets the variable domain - * - * @return {@code true}, if domain was set before, - * otherwise {@code false} - */ - public boolean unsetDomain() { - if (isSetDomain()) { - String oldDomain = domain; - domain = null; - firePropertyChange(SpatialConstants.domain, oldDomain, domain); - return true; - } - return false; - } - - /* (non-Javadoc) - * @see org.sbml.jsbml.ext.spatial.AbstractSpatialNamedSBase#hashCode() - */ - @Override - public int hashCode() { - final int prime = 983;//Change this prime number - int hashCode = super.hashCode(); - if (isSetDomain()) { - hashCode += prime * getDomain().hashCode(); - } - - if (isSetCoord1()) { - hashCode += prime * getCoord1(); - } - - if (isSetCoord2()) { - hashCode += prime * getCoord2(); - } - - if (isSetCoord3()) { - hashCode += prime * getCoord3(); - } - return hashCode; - } - - - @Override - public Map<String, String> writeXMLAttributes() { - Map<String, String> attributes = super.writeXMLAttributes(); - if (isSetDomain()) { - attributes.remove("domain"); - attributes.put(SpatialConstants.shortLabel + ":domain", getDomain()); - } - - if (isSetCoord1()) { - attributes.remove("coord1"); - attributes.put(SpatialConstants.shortLabel + ":coord1", - String.valueOf(getCoord1())); - } - - if (isSetCoord2()) { - attributes.remove("coord1"); - attributes.put(SpatialConstants.shortLabel + ":coord1", - String.valueOf(getCoord2())); - } - - if (isSetCoord3()) { - attributes.remove("coord3"); - attributes.put(SpatialConstants.shortLabel + ":coord3", - String.valueOf(getCoord3())); - } - return attributes; - } - - - @Override - public boolean readAttribute(String attributeName, String prefix, String value) { - boolean isAttributeRead = (super.readAttribute(attributeName, prefix, value)) - && (SpatialConstants.shortLabel == prefix); - if (!isAttributeRead) { - isAttributeRead = true; - if (attributeName.equals(SpatialConstants.domain)) { - try { - setDomain(value); - } catch (Exception e) { - MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, - SpatialConstants.domain); - } - } - - else if (attributeName.equals(SpatialConstants.coord1)) { - try { - setCoord1(StringTools.parseSBMLDouble(value)); - } catch (Exception e) { - MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.coord1); - } - } - - else if (attributeName.equals(SpatialConstants.coord2)) { - try { - setCoord2(StringTools.parseSBMLDouble(value)); - } catch (Exception e) { - MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.coord2); - } - } - - else if (attributeName.equals(SpatialConstants.coord3)) { - try { - setCoord3(StringTools.parseSBMLDouble(value)); - } catch (Exception e) { - MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.coord3); - } - } - else { - isAttributeRead = false; - } - } - return isAttributeRead; - } - - /* (non-Javadoc) - * @see java.lang.Object#toString() - */ - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append("SpatialPoint [domain="); - builder.append(domain); - builder.append(", coord1="); - builder.append(coord1); - builder.append(", coord2="); - builder.append(coord2); - builder.append(", coord3="); - builder.append(coord3); - builder.append("]"); - return builder.toString(); - } - - - -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-22 13:16:06
|
Revision: 2209 http://sourceforge.net/p/jsbml/code/2209 Author: pdp10 Date: 2015-04-22 13:15:55 +0000 (Wed, 22 Apr 2015) Log Message: ----------- update spatial package v0.90 Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricGeometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricObject.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/PolygonObject.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java Added Paths: ----------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoints.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricGeometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricGeometry.java 2015-04-22 11:47:04 UTC (rev 2208) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricGeometry.java 2015-04-22 13:15:55 UTC (rev 2209) @@ -31,7 +31,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -40,7 +41,7 @@ /** * */ - ListOf<SpatialPoint> listOfSpatialPoints; + ListOf<SpatialPoints> listOfSpatialPoints; /** * */ @@ -121,6 +122,18 @@ return equal; } + @Override + public int hashCode() { + final int prime = 1999; + int hashCode = super.hashCode(); + if (isSetListOfParametricObjects()) { + hashCode += prime * getListOfParametricObjects().hashCode(); + } + if (isSetListOfSpatialPoints()) { + hashCode += prime * getListOfSpatialPoints().hashCode(); + } + return hashCode; + } /** * Returns {@code true}, if listOfParametricObjects contains at least one element. @@ -281,9 +294,9 @@ * * @return the listOfSpatialPoints */ - public ListOf<SpatialPoint> getListOfSpatialPoints() { + public ListOf<SpatialPoints> getListOfSpatialPoints() { if (!isSetListOfSpatialPoints()) { - listOfSpatialPoints = new ListOf<SpatialPoint>(getLevel(), + listOfSpatialPoints = new ListOf<SpatialPoints>(getLevel(), getVersion()); listOfSpatialPoints.setNamespace(SpatialConstants.namespaceURI); listOfSpatialPoints.setSBaseListType(ListOf.Type.other); @@ -299,7 +312,7 @@ * * @param listOfSpatialPoints */ - public void setListOfSpatialPoints(ListOf<SpatialPoint> listOfSpatialPoints) { + public void setListOfSpatialPoints(ListOf<SpatialPoints> listOfSpatialPoints) { unsetListOfSpatialPoints(); this.listOfSpatialPoints = listOfSpatialPoints; registerChild(this.listOfSpatialPoints); @@ -315,7 +328,7 @@ */ public boolean unsetListOfSpatialPoints() { if (isSetListOfSpatialPoints()) { - ListOf<SpatialPoint> oldSpatialPoints = listOfSpatialPoints; + ListOf<SpatialPoints> oldSpatialPoints = listOfSpatialPoints; listOfSpatialPoints = null; oldSpatialPoints.fireNodeRemovedEvent(); return true; @@ -325,27 +338,27 @@ /** - * Adds a new {@link SpatialPoint} to the listOfSpatialPoints. + * Adds a new {@link SpatialPoints} to the listOfSpatialPoints. * <p>The listOfSpatialPoints is initialized if necessary. * - * @param spatialPoint the element to add to the list + * @param spatialPoints the element to add to the list * @return true (as specified by {@link Collection#add}) */ - public boolean addSpatialPoint(SpatialPoint spatialPoint) { - return getListOfSpatialPoints().add(spatialPoint); + public boolean addSpatialPoints(SpatialPoints spatialPoints) { + return getListOfSpatialPoints().add(spatialPoints); } /** * Removes an element from the listOfSpatialPoints. * - * @param spatialPoint the element to be removed from the list + * @param spatialPoints the element to be removed from the list * @return true if the list contained the specified element * @see List#remove(Object) */ - public boolean removeSpatialPoint(SpatialPoint spatialPoint) { + public boolean removeSpatialPoints(SpatialPoints spatialPoints) { if (isSetListOfSpatialPoints()) { - return getListOfSpatialPoints().remove(spatialPoint); + return getListOfSpatialPoints().remove(spatialPoints); } return false; } @@ -358,7 +371,7 @@ * @throws IndexOutOfBoundsException if the listOf is not set or * if the index is out of bound (index < 0 || index > list.size) */ - public void removeSpatialPoint(int i) { + public void removeSpatialPoints(int i) { if (!isSetListOfSpatialPoints()) { throw new IndexOutOfBoundsException(Integer.toString(i)); } @@ -370,31 +383,31 @@ /* - * TODO: if the ID is mandatory for SpatialPoint objects, + * TODO: if the ID is mandatory for SpatialPoints objects, * one should also add this methods */ - //public void removeSpatialPoint(String id) { + //public void removeSpatialPoints(String id) { // getListOfSpatialPoints().removeFirst(new NameFilter(id)); //} /** - * Creates a new SpatialPoint element and adds it to the ListOfSpatialPoints list + * Creates a new SpatialPoints element and adds it to the ListOfSpatialPoints list * @return */ - public SpatialPoint createSpatialPoint() { - return createSpatialPoint(null); + public SpatialPoints createSpatialPoints() { + return createSpatialPoints(null); } /** - * Creates a new {@link SpatialPoint} element and adds it to the ListOfSpatialPoints list + * Creates a new {@link SpatialPoints} element and adds it to the ListOfSpatialPoints list * @param id * - * @return a new {@link SpatialPoint} element + * @return a new {@link SpatialPoints} element */ - public SpatialPoint createSpatialPoint(String id) { - SpatialPoint spatialPoint = new SpatialPoint(id, getLevel(), getVersion()); - addSpatialPoint(spatialPoint); - return spatialPoint; + public SpatialPoints createSpatialPoints(String id) { + SpatialPoints spatialPoints = new SpatialPoints(getLevel(), getVersion()); + addSpatialPoints(spatialPoints); + return spatialPoints; } /* (non-Javadoc) Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricObject.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricObject.java 2015-04-22 11:47:04 UTC (rev 2208) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParametricObject.java 2015-04-22 13:15:55 UTC (rev 2209) @@ -24,14 +24,14 @@ import java.text.MessageFormat; import java.util.Map; -import javax.swing.tree.TreeNode; - import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.util.StringTools; /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -55,6 +55,36 @@ QUADRILATERAL; } + public enum CompressionKind { + /** + * + */ + UNCOMPRESSED, + /** + * + */ + DEFLATED, + /** + * + */ + BASE64; + } + + public enum DataKind { + /** + * + */ + UINT8, + /** + * + */ + UINT16, + /** + * + */ + UINT32; + } + /** * */ @@ -66,7 +96,17 @@ /** * */ - private PolygonObject polygonObject; + private CompressionKind compression; + /** + * + */ + private Integer pointIndexLength; + /** + * + */ + private DataKind dataType; + + /** * Generated serial version identifier. */ @@ -84,19 +124,21 @@ */ public ParametricObject(ParametricObject po) { super(po); - if (po.isSetDomainType()) { - domainType = new String(po.getDomainType()); + setDomainType(po.getDomainType()); } - if (po.isSetPolygonType()) { setPolygonType(po.getPolygonType()); } - - if (po.isSetPolygonObject()) { - setPolygonObject(po.getPolygonObject().clone()); + if (po.isSetCompression()) { + setCompression(po.getCompression()); } - + if (po.isSetPointIndexLength()) { + setPointIndexLength(po.getPointIndexLength()); + } + if (po.isSetDataType()) { + setDataType(po.getDataType()); + } } @@ -136,16 +178,22 @@ if (equal && isSetDomainType()) { equal &= po.getDomainType().equals(getDomainType()); } - equal &= po.isSetPolygonType() == isSetPolygonType(); if (equal && isSetPolygonType()) { equal &= po.getPolygonType().equals(getPolygonType()); } - - equal &= po.isSetPolygonObject() == isSetPolygonObject(); - if (equal && isSetPolygonObject()) { - equal &= po.getPolygonObject().equals(getPolygonObject()); + equal &= po.isSetCompression() == isSetCompression(); + if (equal && isSetCompression()) { + equal &= po.getCompression().equals(getCompression()); } + equal &= po.isSetPointIndexLength() == isSetPointIndexLength(); + if (equal && isSetPointIndexLength()) { + equal &= po.getPointIndexLength() == getPointIndexLength(); + } + equal &= po.isSetDataType() == isSetDataType(); + if (equal && isSetDataType()) { + equal &= po.getDataType().equals(getDataType()); + } } return equal; } @@ -233,7 +281,7 @@ return domainType != null; } - + /** * Sets the value of domain * @param domain @@ -261,100 +309,182 @@ return false; } + + /** - * Returns the value of polygonObject + * Returns the value of compression. * - * @return the value of polygonObject + * @return the value of compression. */ - public PolygonObject getPolygonObject() { - if (isSetPolygonObject()) { - return polygonObject; + public CompressionKind getCompression() { + if (isSetCompression()) { + return compression; } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.polygonObject, this); + // 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(SpatialConstants.compression, this); } /** - * Returns whether polygonObject is set + * Returns whether compression is set. * - * @return whether polygonObject is set + * @return whether compression is set. */ - public boolean isSetPolygonObject() { - return polygonObject != null; + public boolean isSetCompression() { + return this.compression != null; } + /** + * Sets the value of compression + * @param compression + */ + public void setCompression(String compression) { + setCompression(CompressionKind.valueOf(compression)); + } /** - * Sets the value of polygonObject - * @param polygonObject + * Sets the value of compression + * + * @param compression the value of compression to be set. */ - public void setPolygonObject(PolygonObject polygonObject) { - PolygonObject oldPolygonObject = this.polygonObject; - this.polygonObject = polygonObject; - firePropertyChange(SpatialConstants.polygonObject, oldPolygonObject, this.polygonObject); + public void setCompression(CompressionKind compression) { + CompressionKind oldCompression = this.compression; + this.compression = compression; + firePropertyChange(SpatialConstants.compression, oldCompression, this.compression); } /** - * Unsets the variable polygonObject + * Unsets the variable compression. * - * @return {@code true}, if polygonObject was set before, - * otherwise {@code false} + * @return {@code true} if compression was set before, otherwise {@code false}. */ - public boolean unsetPolygonObject() { - if (isSetPolygonObject()) { - PolygonObject oldPolygonObject = polygonObject; - polygonObject = null; - firePropertyChange(SpatialConstants.polygonObject, oldPolygonObject, polygonObject); + public boolean unsetCompression() { + if (isSetCompression()) { + CompressionKind oldCompression = this.compression; + this.compression = null; + firePropertyChange(SpatialConstants.compression, oldCompression, this.compression); return true; } return false; } + + + /** + * Returns the value of pointIndexLength. + * + * @return the value of pointIndexLength. + */ + public int getPointIndexLength() { + if (isSetPointIndexLength()) { + return pointIndexLength.intValue(); + } + // 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(SpatialConstants.pointIndexLength, this); + } - @Override - public boolean getAllowsChildren() { - return true; + /** + * Returns whether pointIndexLength is set. + * + * @return whether pointIndexLength is set. + */ + public boolean isSetPointIndexLength() { + return this.pointIndexLength != null; } - @Override - public int getChildCount() { - int count = super.getChildCount(); - if (isSetPolygonObject()) { - count++; - } - return count; + /** + * Sets the value of pointIndexLength + * + * @param pointIndexLength the value of pointIndexLength to be set. + */ + public void setPointIndexLength(int pointIndexLength) { + Integer oldPointIndexLength = this.pointIndexLength; + this.pointIndexLength = pointIndexLength; + firePropertyChange(SpatialConstants.pointIndexLength, oldPointIndexLength, this.pointIndexLength); } - @Override - public TreeNode getChildAt(int index) { - if (index < 0) { - throw new IndexOutOfBoundsException(index + " < 0"); + /** + * Unsets the variable pointIndexLength. + * + * @return {@code true} if pointIndexLength was set before, otherwise {@code false}. + */ + public boolean unsetPointIndexLength() { + if (isSetPointIndexLength()) { + Integer oldPointIndexLength = this.pointIndexLength; + this.pointIndexLength = null; + firePropertyChange(SpatialConstants.pointIndexLength, oldPointIndexLength, this.pointIndexLength); + return true; } - int count = super.getChildCount(), pos = 0; - if (index < count) { - return super.getChildAt(index); - } else { - index -= count; + return false; + } + + + /** + * Returns the value of dataType. + * + * @return the value of dataType. + */ + public DataKind getDataType() { + if (isSetDataType()) { + return dataType; } - if (isSetPolygonObject()) { - if (pos == index) { - return getPolygonObject(); - } - pos++; + // 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(SpatialConstants.dataType, this); + } + + + /** + * Returns whether dataType is set. + * + * @return whether dataType is set. + */ + public boolean isSetDataType() { + return this.dataType != null; + } + + /** + * Sets the value of dataType + * @param dataType + */ + public void setDataType(String dataType) { + setDataType(DataKind.valueOf(dataType)); + } + + /** + * Sets the value of dataType + * + * @param dataType the value of dataType to be set. + */ + public void setDataType(DataKind dataType) { + DataKind oldDataType = this.dataType; + this.dataType = dataType; + firePropertyChange(SpatialConstants.dataType, oldDataType, this.dataType); + } + + + /** + * Unsets the variable dataType. + * + * @return {@code true} if dataType was set before, otherwise {@code false}. + */ + public boolean unsetDataType() { + if (isSetDataType()) { + DataKind oldDataType = this.dataType; + this.dataType = null; + firePropertyChange(SpatialConstants.dataType, oldDataType, this.dataType); + return true; } - throw new IndexOutOfBoundsException(MessageFormat.format( - "Index {0,number,integer} >= {1,number,integer}", index, - +Math.min(pos, 0))); + return false; } + @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 2003; int hashCode = super.hashCode(); if (isSetDomainType()) { hashCode += prime * getDomainType().hashCode(); @@ -362,6 +492,15 @@ if (isSetPolygonType()) { hashCode += prime * getPolygonType().hashCode(); } + if (isSetCompression()) { + hashCode += prime * getCompression().hashCode(); + } + if (isSetPointIndexLength()) { + hashCode += prime * getPointIndexLength(); + } + if (isSetDataType()) { + hashCode += prime * getDataType().hashCode(); + } return hashCode; } @@ -373,12 +512,26 @@ attributes.remove("domainType"); attributes.put(SpatialConstants.shortLabel + ":domainType", getDomainType()); } - if (isSetPolygonType()) { attributes.remove("polygonType"); attributes.put(SpatialConstants.shortLabel + ":polygonType", getPolygonType().toString()); } + if (isSetCompression()) { + attributes.remove("compression"); + attributes.put(SpatialConstants.shortLabel + ":compression", + getCompression().toString()); + } + if (isSetPointIndexLength()) { + attributes.remove("pointIndexLength"); + attributes.put(SpatialConstants.shortLabel + ":pointIndexLength", + String.valueOf(getPointIndexLength())); + } + if (isSetDataType()) { + attributes.remove("dataType"); + attributes.put(SpatialConstants.shortLabel + ":dataType", + getDataType().toString()); + } return attributes; } @@ -398,7 +551,6 @@ SpatialConstants.domainType); } } - else if (attributeName.equals(SpatialConstants.polygonType)) { try { setPolygonType(value); @@ -406,6 +558,27 @@ MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); } } + else if (attributeName.equals(SpatialConstants.compression)) { + try { + setCompression(value); + } catch (Exception e) { + MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); + } + } + else if (attributeName.equals(SpatialConstants.pointIndexLength)) { + try { + setPointIndexLength(StringTools.parseSBMLInt(value)); + } catch (Exception e) { + MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); + } + } + else if (attributeName.equals(SpatialConstants.dataType)) { + try { + setDataType(value); + } catch (Exception e) { + MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); + } + } else { isAttributeRead = false; } @@ -424,6 +597,12 @@ builder.append(polygonType); builder.append(", domain="); builder.append(domainType); + builder.append(", compression="); + builder.append(compression); + builder.append(", pointIndexLength="); + builder.append(pointIndexLength); + builder.append(", dataType="); + builder.append(dataType); builder.append("]"); return builder.toString(); } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/PolygonObject.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/PolygonObject.java 2015-04-22 11:47:04 UTC (rev 2208) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/PolygonObject.java 2015-04-22 13:15:55 UTC (rev 2209) @@ -36,6 +36,7 @@ * @version $Rev$ * @since 1.0 * @date Jan 21, 2014 + * @deprecated */ public class PolygonObject extends AbstractSBase { Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-22 11:47:04 UTC (rev 2208) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-22 13:15:55 UTC (rev 2209) @@ -461,10 +461,14 @@ */ public static final String listOfParametricObjects = "listOfParametricObjects"; /** - * + * @deprecated */ public static final String spatialPoint = "spatialPoint"; /** + * + */ + public static final String spatialPoints = "spatialPoints"; + /** * */ public static final String parametricObject = "parametricObject"; @@ -507,8 +511,17 @@ * */ public static final String data = "data"; + /** + * + */ + public static final String pointIndexLength = "pointIndexLength"; /** + * + */ + public static final String arrayDataLength = "arrayDataLength"; + + /** * @param level * @param version * @return Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java 2015-04-22 11:47:04 UTC (rev 2208) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoint.java 2015-04-22 13:15:55 UTC (rev 2209) @@ -31,7 +31,8 @@ * @author Alex Thomas * @author Andreas Dräger * @since 1.0 - * @version $Rev$ + * @version $Rev$ + * @deprecated */ public class SpatialPoint extends AbstractSpatialNamedSBase { Added: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoints.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoints.java (rev 0) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoints.java 2015-04-22 13:15:55 UTC (rev 2209) @@ -0,0 +1,432 @@ +/* + * $Id: SpatialPoints.java 0 2015-04-22 04:50:45Z pdp10 $ + * $URL: svn+ssh://pd...@sv.../p/jsbml/code/trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialPoints.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-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.text.MessageFormat; +import java.util.Map; + +import org.sbml.jsbml.AbstractSBase; +import org.sbml.jsbml.PropertyUndefinedError; +import org.sbml.jsbml.util.StringTools; + + +/** + * @author Piero Dalle Pezze + * @since 1.0 + * @version $Rev: 0 $ + */ +public class SpatialPoints extends AbstractSBase { + + /** + * + */ + private static final long serialVersionUID = -3467717442431545263L; + + + public enum CompressionKind { + /** + * + */ + UNCOMPRESSED, + /** + * + */ + DEFLATED, + /** + * + */ + BASE64; + } + + public enum DataKind { + /** + * + */ + UINT8, + /** + * + */ + UINT16, + /** + * + */ + UINT32, + /** + * + */ + FLOAT, + /** + * + */ + DOUBLE; + } + + /** + * + */ + private CompressionKind compression; + /** + * + */ + private Integer arrayDataLength; + /** + * + */ + private DataKind dataType; + + + + + /** + * Creates an SpatialPoints instance + */ + public SpatialPoints() { + super(); + initDefaults(); + } + + /** + * Creates a SpatialPoints instance with a level and version. + * + * @param level SBML Level + * @param version SBML Version + */ + public SpatialPoints(int level, int version) { + super(level, version); + } + + + /** + * Clone constructor + */ + public SpatialPoints(SpatialPoints sp) { + super(sp); + if (sp.isSetCompression()) { + setCompression(sp.getCompression()); + } + if (sp.isSetArrayDataLength()) { + setArrayDataLength(sp.getArrayDataLength()); + } + if (sp.isSetDataType()) { + setDataType(sp.getDataType()); + } + } + + + /** + * clones this class + */ + public SpatialPoints clone() { + return new SpatialPoints(this); + } + + @Override + public boolean equals(Object object) { + boolean equal = super.equals(object); + if (equal) { + SpatialPoints sp = (SpatialPoints) object; + + equal &= sp.isSetCompression() == isSetCompression(); + if (equal && isSetCompression()) { + equal &= sp.getCompression().equals(getCompression()); + } + equal &= sp.isSetArrayDataLength() == isSetArrayDataLength(); + if (equal && isSetArrayDataLength()) { + equal &= sp.getArrayDataLength() == getArrayDataLength(); + } + equal &= sp.isSetDataType() == isSetDataType(); + if (equal && isSetDataType()) { + equal &= sp.getDataType().equals(getDataType()); + } + } + return equal; + } + + /** + * 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 + packageName = SpatialConstants.shortLabel; + setPackageVersion(-1); + } + + /** + * Returns the value of compression. + * + * @return the value of compression. + */ + public CompressionKind getCompression() { + if (isSetCompression()) { + return compression; + } + // 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(SpatialConstants.compression, this); + } + + + /** + * Returns whether compression is set. + * + * @return whether compression is set. + */ + public boolean isSetCompression() { + return this.compression != null; + } + + /** + * Sets the value of compression + * @param compression + */ + public void setCompression(String compression) { + setCompression(CompressionKind.valueOf(compression)); + } + + /** + * Sets the value of compression + * + * @param compression the value of compression to be set. + */ + public void setCompression(CompressionKind compression) { + CompressionKind oldCompression = this.compression; + this.compression = compression; + firePropertyChange(SpatialConstants.compression, oldCompression, this.compression); + } + + + /** + * Unsets the variable compression. + * + * @return {@code true} if compression was set before, otherwise {@code false}. + */ + public boolean unsetCompression() { + if (isSetCompression()) { + CompressionKind oldCompression = this.compression; + this.compression = null; + firePropertyChange(SpatialConstants.compression, oldCompression, this.compression); + return true; + } + return false; + } + + + /** + * Returns the value of arrayDataLength. + * + * @return the value of arrayDataLength. + */ + public int getArrayDataLength() { + if (isSetArrayDataLength()) { + return arrayDataLength.intValue(); + } + // 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(SpatialConstants.arrayDataLength, this); + } + + + /** + * Returns whether arrayDataLength is set. + * + * @return whether arrayDataLength is set. + */ + public boolean isSetArrayDataLength() { + return this.arrayDataLength != null; + } + + + /** + * Sets the value of arrayDataLength + * + * @param arrayDataLength the value of arrayDataLength to be set. + */ + public void setArrayDataLength(int arrayDataLength) { + Integer oldArrayDataLength = this.arrayDataLength; + this.arrayDataLength = arrayDataLength; + firePropertyChange(SpatialConstants.arrayDataLength, oldArrayDataLength, this.arrayDataLength); + } + + + /** + * Unsets the variable arrayDataLength. + * + * @return {@code true} if arrayDataLength was set before, otherwise {@code false}. + */ + public boolean unsetArrayDataLength() { + if (isSetArrayDataLength()) { + Integer oldArrayDataLength = this.arrayDataLength; + this.arrayDataLength = null; + firePropertyChange(SpatialConstants.arrayDataLength, oldArrayDataLength, this.arrayDataLength); + return true; + } + return false; + } + + + /** + * Returns the value of dataType. + * + * @return the value of dataType. + */ + public DataKind getDataType() { + if (isSetDataType()) { + return dataType; + } + // 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(SpatialConstants.dataType, this); + } + + + /** + * Returns whether dataType is set. + * + * @return whether dataType is set. + */ + public boolean isSetDataType() { + return this.dataType != null; + } + + /** + * Sets the value of dataType + * @param dataType + */ + public void setDataType(String dataType) { + setDataType(DataKind.valueOf(dataType)); + } + + /** + * Sets the value of dataType + * + * @param dataType the value of dataType to be set. + */ + public void setDataType(DataKind dataType) { + DataKind oldDataType = this.dataType; + this.dataType = dataType; + firePropertyChange(SpatialConstants.dataType, oldDataType, this.dataType); + } + + + /** + * Unsets the variable dataType. + * + * @return {@code true} if dataType was set before, otherwise {@code false}. + */ + public boolean unsetDataType() { + if (isSetDataType()) { + DataKind oldDataType = this.dataType; + this.dataType = null; + firePropertyChange(SpatialConstants.dataType, oldDataType, this.dataType); + return true; + } + return false; + } + + + + @Override + public int hashCode() { + final int prime = 2011; + int hashCode = super.hashCode(); + if (isSetCompression()) { + hashCode += prime * getCompression().hashCode(); + } + if (isSetArrayDataLength()) { + hashCode += prime * getArrayDataLength(); + } + if (isSetDataType()) { + hashCode += prime * getDataType().hashCode(); + } + return hashCode; + } + + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetCompression()) { + attributes.remove("compression"); + attributes.put(SpatialConstants.shortLabel + ":compression", + getCompression().toString()); + } + if (isSetArrayDataLength()) { + attributes.remove("arrayDataLength"); + attributes.put(SpatialConstants.shortLabel + ":arrayDataLength", + String.valueOf(getArrayDataLength())); + } + if (isSetDataType()) { + attributes.remove("dataType"); + attributes.put(SpatialConstants.shortLabel + ":dataType", + getDataType().toString()); + } + + return attributes; + } + + + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = (super.readAttribute(attributeName, prefix, value)) + && (SpatialConstants.shortLabel == prefix); + if (attributeName.equals(SpatialConstants.compression)) { + try { + setCompression(value); + } catch (Exception e) { + MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); + } + } + else if (attributeName.equals(SpatialConstants.arrayDataLength)) { + try { + setArrayDataLength(StringTools.parseSBMLInt(value)); + } catch (Exception e) { + MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); + } + } + else if (attributeName.equals(SpatialConstants.dataType)) { + try { + setDataType(value); + } catch (Exception e) { + MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ"), value, SpatialConstants.polygonType); + } + } + else { + isAttributeRead = false; + } + return isAttributeRead; + } + + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("ParametricObject [compression="); + builder.append(compression); + builder.append(", arrayDataLength="); + builder.append(arrayDataLength); + builder.append(", dataType="); + builder.append(dataType); + builder.append("]"); + return builder.toString(); + } + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-22 13:15:45
|
Revision: 2207 http://sourceforge.net/p/jsbml/code/2207 Author: niko-rodrigue Date: 2015-04-22 11:35:00 +0000 (Wed, 22 Apr 2015) Log Message: ----------- corrected one error in FormulaParserLL3.jj that was not adding the first argument of a function in most cases, some problems remain there, I think. Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.jj branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/ASTNodeInfixParsingTest.java Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java 2015-04-22 09:57:59 UTC (rev 2206) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java 2015-04-22 11:35:00 UTC (rev 2207) @@ -548,67 +548,84 @@ } final public Token string() throws ParseException { + trace_call("string"); + try { Token t; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LOG: - t = jj_consume_token(LOG); - break; - case STRING: - t = jj_consume_token(STRING); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOG: + t = jj_consume_token(LOG); + break; + case STRING: + t = jj_consume_token(STRING); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } {if (true) return t;} throw new Error("Missing return statement in function"); + } finally { + trace_return("string"); + } } final public ASTNode parse() throws ParseException { + trace_call("parse"); + try { ASTNode node = null; - node = expression(); + node = expression(); {if (true) return node;} throw new Error("Missing return statement in function"); + } finally { + trace_return("parse"); + } } final private ASTNode expression() throws ParseException { + trace_call("expression"); + try { ASTNode value = null; - value = termLevel2(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 0: - jj_consume_token(0); - break; - case EOL: - jj_consume_token(EOL); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + value = termLevel2(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 0: + jj_consume_token(0); + break; + case EOL: + jj_consume_token(EOL); + break; + default: + jj_la1[1] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } {if (true) return value;} throw new Error("Missing return statement in function"); + } finally { + trace_return("expression"); + } } final private ASTNode termLevel2() throws ParseException { + trace_call("termLevel2"); + try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; Token t; - leftChild = termLevel3(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BOOLEAN_LOGIC: - ; - break; - default: - jj_la1[2] = jj_gen; - break label_1; - } - t = jj_consume_token(BOOLEAN_LOGIC); - rightChild = termLevel3(); + leftChild = termLevel3(); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOOLEAN_LOGIC: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + t = jj_consume_token(BOOLEAN_LOGIC); + rightChild = termLevel3(); // TODO - do we want to ignore the case for those cases ? String s = t.image; Type type = null; // ASTNode.Type.valueOf(stringToType.getProperty(s.toLowerCase()).toUpperCase()); @@ -630,29 +647,34 @@ node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel2"); + } } final private ASTNode termLevel3() throws ParseException { + trace_call("termLevel3"); + try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; Token t; - leftChild = termLevel4(); - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMPARISON: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_2; - } - t = jj_consume_token(COMPARISON); - rightChild = termLevel4(); + leftChild = termLevel4(); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMPARISON: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_2; + } + t = jj_consume_token(COMPARISON); + rightChild = termLevel4(); String s = t.image; Type type = null; @@ -684,83 +706,93 @@ node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel3"); + } } final private ASTNode termLevel4() throws ParseException { + trace_call("termLevel4"); + try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; - leftChild = termLevel5(); - label_3: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - case MINUS: - ; - break; - default: - jj_la1[4] = jj_gen; - break label_3; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - rightChild = termLevel5(); + leftChild = termLevel5(); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + ; + break; + default: + jj_la1[4] = jj_gen; + break label_3; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + rightChild = termLevel5(); node = new ASTNode('+'); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - break; - case MINUS: - jj_consume_token(MINUS); - rightChild = termLevel5(); + break; + case MINUS: + jj_consume_token(MINUS); + rightChild = termLevel5(); node = new ASTNode('-'); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - break; - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + break; + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } } - } {if (true) return leftChild;} throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel4"); + } } final private ASTNode termLevel5() throws ParseException { + trace_call("termLevel5"); + try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; - leftChild = termLevel6(); - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - case DIVIDE: - case MODULO: - ; - break; - default: - jj_la1[6] = jj_gen; - break label_4; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - jj_consume_token(TIMES); - rightChild = termLevel6(); + leftChild = termLevel6(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TIMES: + case DIVIDE: + case MODULO: + ; + break; + default: + jj_la1[6] = jj_gen; + break label_4; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TIMES: + jj_consume_token(TIMES); + rightChild = termLevel6(); node = new ASTNode('*'); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - break; - case DIVIDE: - jj_consume_token(DIVIDE); - rightChild = termLevel6(); + break; + case DIVIDE: + jj_consume_token(DIVIDE); + rightChild = termLevel6(); Integer left, right; left = getInteger(leftChild); right = getInteger(rightChild); @@ -778,85 +810,100 @@ node.addChild(rightChild); leftChild = node; } - break; - case MODULO: - jj_consume_token(MODULO); - rightChild = termLevel6(); + break; + case MODULO: + jj_consume_token(MODULO); + rightChild = termLevel6(); node = createModulo(leftChild, rightChild); leftChild = node; - break; - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } } - } {if (true) return leftChild;} throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel5"); + } } final private ASTNode termLevel6() throws ParseException { + trace_call("termLevel6"); + try { ASTNode node = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case MINUS: - jj_consume_token(MINUS); - node = termLevel7(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case MINUS: + jj_consume_token(MINUS); + node = termLevel7(); ASTNode uiMinus = new ASTNode('-'); uiMinus.addChild(node); {if (true) return uiMinus;} - break; - case NOT: - jj_consume_token(NOT); - node = termLevel7(); + break; + case NOT: + jj_consume_token(NOT); + node = termLevel7(); ASTNode not = new ASTNode(Type.LOGICAL_NOT); not.addChild(node); {if (true) return not;} - break; - case INTEGER: - case NUMBER: - case EXPNUMBER: - case OPEN_PAR: - case LEFT_BRACES: - case LOG: - case STRING: - node = termLevel7(); + break; + case INTEGER: + case NUMBER: + case EXPNUMBER: + case OPEN_PAR: + case LEFT_BRACES: + case LOG: + case STRING: + node = termLevel7(); {if (true) return node;} - break; - default: - jj_la1[8] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } + throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel6"); } - throw new Error("Missing return statement in function"); } final private ASTNode termLevel7() throws ParseException { + trace_call("termLevel7"); + try { ASTNode rightChild; ASTNode leftChild; ASTNode node = null; - leftChild = termLevel8(); - label_5: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case POWER: - ; - break; - default: - jj_la1[9] = jj_gen; - break label_5; - } - jj_consume_token(POWER); - rightChild = termLevel8(); + leftChild = termLevel8(); + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case POWER: + ; + break; + default: + jj_la1[9] = jj_gen; + break label_5; + } + jj_consume_token(POWER); + rightChild = termLevel8(); node = new ASTNode(Type.POWER); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel7"); + } } final private ASTNode termLevel8() throws ParseException, NumberFormatException { + trace_call("termLevel8"); + try { Token t; double d; int i; @@ -866,21 +913,21 @@ String s; String vals [ ]; ArrayList < ASTNode > arguments = new ArrayList < ASTNode > (); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER: - t = jj_consume_token(INTEGER); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: + t = jj_consume_token(INTEGER); i = Integer.parseInt(t.image); // Could use StringTools.parseXXX methods here but not doing so allow to support different locale ?? node.setValue(i); {if (true) return node;} - break; - case NUMBER: - t = jj_consume_token(NUMBER); + break; + case NUMBER: + t = jj_consume_token(NUMBER); d = Double.parseDouble(t.image); node.setValue(d); {if (true) return node;} - break; - case EXPNUMBER: - t = jj_consume_token(EXPNUMBER); + break; + case EXPNUMBER: + t = jj_consume_token(EXPNUMBER); s = t.image; vals = s.toLowerCase().split("e"); if (vals [ 1 ].startsWith("+")) @@ -893,28 +940,28 @@ } node.setValue(Double.parseDouble(vals [ 0 ]), i); {if (true) return node;} - break; - default: - jj_la1[14] = jj_gen; - if (jj_2_1(2)) { - t = string(); - jj_consume_token(OPEN_PAR); - child = termLevel2(); - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPLITTER: - ; - break; - default: - jj_la1[10] = jj_gen; - break label_6; + break; + default: + jj_la1[14] = jj_gen; + if (jj_2_1(2)) { + t = string(); + jj_consume_token(OPEN_PAR); + child = termLevel2(); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SPLITTER: + ; + break; + default: + jj_la1[10] = jj_gen; + break label_6; + } + jj_consume_token(SPLITTER); + furtherChild = termLevel2(); + arguments.add(furtherChild); } - jj_consume_token(SPLITTER); - furtherChild = termLevel2(); - arguments.add(furtherChild); - } - jj_consume_token(CLOSE_PAR); + jj_consume_token(CLOSE_PAR); s = t.image; Type type = null; if (ignoreCase) @@ -925,10 +972,11 @@ { type = ASTNode.Type.valueOf(stringToType.getProperty(s.toLowerCase()).toUpperCase()); node.setType(type); + node.addChild(child); } else if (s.equals("ln")) { - checkSize(arguments, 0); + checkSize(arguments, 0); // TODO - we need to set the type for all those if-then-else cases node.addChild(child); } else if (s.equals("lambda")) @@ -983,95 +1031,96 @@ { node.setName(s); } + for (ASTNode argument : arguments) { node.addChild(argument); } {if (true) return node;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case OPEN_PAR: - jj_consume_token(OPEN_PAR); - node = termLevel2(); - jj_consume_token(CLOSE_PAR); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OPEN_PAR: + jj_consume_token(OPEN_PAR); + node = termLevel2(); + jj_consume_token(CLOSE_PAR); {if (true) return node;} - break; - default: - jj_la1[15] = jj_gen; - if (jj_2_2(4)) { - t = jj_consume_token(STRING); + break; + default: + jj_la1[15] = jj_gen; + if (jj_2_2(4)) { + t = jj_consume_token(STRING); ASTNode selector = new ASTNode(); selector.setType(ASTNode.Type.FUNCTION_SELECTOR); selector.addChild(new ASTNode(t.image)); - label_7: - while (true) { - jj_consume_token(LEFT_BRACKET); - node = termLevel2(); + label_7: + while (true) { + jj_consume_token(LEFT_BRACKET); + node = termLevel2(); selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[11] = jj_gen; - break label_7; + jj_consume_token(RIGHT_BRACKET); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_BRACKET: + ; + break; + default: + jj_la1[11] = jj_gen; + break label_7; + } } - } {if (true) return selector;} - } else if (jj_2_3(2)) { - jj_consume_token(LEFT_BRACES); - node = termLevel2(); + } else if (jj_2_3(2)) { + jj_consume_token(LEFT_BRACES); + node = termLevel2(); ASTNode selector = new ASTNode(); vector = new ASTNode(); boolean isSelector = false; selector.setType(ASTNode.Type.FUNCTION_SELECTOR); vector.setType(ASTNode.Type.VECTOR); vector.addChild(node); - label_8: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPLITTER: - ; - break; - default: - jj_la1[12] = jj_gen; - break label_8; + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SPLITTER: + ; + break; + default: + jj_la1[12] = jj_gen; + break label_8; + } + jj_consume_token(SPLITTER); + node = termLevel2(); + vector.addChild(node); } - jj_consume_token(SPLITTER); - node = termLevel2(); - vector.addChild(node); - } - jj_consume_token(RIGHT_BRACES); + jj_consume_token(RIGHT_BRACES); selector.addChild(vector); - label_9: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[13] = jj_gen; - break label_9; - } - jj_consume_token(LEFT_BRACKET); - node = termLevel2(); + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_BRACKET: + ; + break; + default: + jj_la1[13] = jj_gen; + break label_9; + } + jj_consume_token(LEFT_BRACKET); + node = termLevel2(); isSelector = true; selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - } + jj_consume_token(RIGHT_BRACKET); + } {if (true) return isSelector ? selector : vector;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACES: - jj_consume_token(LEFT_BRACES); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_BRACES: + jj_consume_token(LEFT_BRACES); vector = new ASTNode(); vector.setType(ASTNode.Type.VECTOR); - jj_consume_token(RIGHT_BRACES); + jj_consume_token(RIGHT_BRACES); {if (true) return vector;} - break; - case STRING: - t = jj_consume_token(STRING); + break; + case STRING: + t = jj_consume_token(STRING); s = t.image; if (ignoreCase) { @@ -1119,17 +1168,20 @@ node = new ASTNode(s); } {if (true) return node;} - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } } } } } + throw new Error("Missing return statement in function"); + } finally { + trace_return("termLevel8"); } - throw new Error("Missing return statement in function"); } private boolean jj_2_1(int xla) { @@ -1232,17 +1284,17 @@ return false; } - private boolean jj_3R_14() { - if (jj_scan_token(BOOLEAN_LOGIC)) return true; - return false; - } - private boolean jj_3R_35() { if (jj_scan_token(OPEN_PAR)) return true; if (jj_3R_12()) return true; return false; } + private boolean jj_3R_14() { + if (jj_scan_token(BOOLEAN_LOGIC)) return true; + return false; + } + private boolean jj_3R_29() { if (jj_3R_30()) return true; Token xsp; @@ -1369,6 +1421,12 @@ return false; } + private boolean jj_3_3() { + if (jj_scan_token(LEFT_BRACES)) return true; + if (jj_3R_12()) return true; + return false; + } + private boolean jj_3R_26() { if (jj_scan_token(TIMES)) return true; return false; @@ -1393,12 +1451,6 @@ return false; } - private boolean jj_3_3() { - if (jj_scan_token(LEFT_BRACES)) return true; - if (jj_3R_12()) return true; - return false; - } - /** Generated Token Manager. */ public FormulaParserLL3TokenManager token_source; SimpleCharStream jj_input_stream; @@ -1511,6 +1563,7 @@ } } } + trace_token(token, ""); return token; } token = oldToken; @@ -1548,6 +1601,7 @@ else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; + trace_token(token, " (in getNextToken)"); return token; } @@ -1633,14 +1687,57 @@ return new ParseException(token, exptokseq, tokenImage); } - /** Enable tracing. */ + private int trace_indent = 0; + private boolean trace_enabled = true; + +/** Enable tracing. */ final public void enable_tracing() { + trace_enabled = true; } - /** Disable tracing. */ +/** Disable tracing. */ final public void disable_tracing() { + trace_enabled = false; } + private void trace_call(String s) { + if (trace_enabled) { + for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } + System.out.println("Call: " + s); + } + trace_indent = trace_indent + 2; + } + + private void trace_return(String s) { + trace_indent = trace_indent - 2; + if (trace_enabled) { + for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } + System.out.println("Return: " + s); + } + } + + private void trace_token(Token t, String where) { + if (trace_enabled) { + for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } + System.out.print("Consumed token: <" + tokenImage[t.kind]); + if (t.kind != 0 && !tokenImage[t.kind].equals("\"" + t.image + "\"")) { + System.out.print(": \"" + t.image + "\""); + } + System.out.println(" at line " + t.beginLine + " column " + t.beginColumn + ">" + where); + } + } + + private void trace_scan(Token t1, int t2) { + if (trace_enabled) { + for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } + System.out.print("Visited token: <" + tokenImage[t1.kind]); + if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")) { + System.out.print(": \"" + t1.image + "\""); + } + System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">"); + } + } + private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 3; i++) { Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.jj =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.jj 2015-04-22 09:57:59 UTC (rev 2206) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.jj 2015-04-22 11:35:00 UTC (rev 2207) @@ -4,7 +4,7 @@ options { JDK_VERSION = "1.5"; - + DEBUG_PARSER = false; static = false; } @@ -1078,10 +1078,11 @@ { type = ASTNode.Type.valueOf(stringToType.getProperty(s.toLowerCase()).toUpperCase()); node.setType(type); + node.addChild(child); } else if (s.equals("ln")) { - checkSize(arguments, 0); + checkSize(arguments, 0); // TODO - we need to set the type for all those if-then-else cases node.addChild(child); } else if (s.equals("lambda")) @@ -1136,6 +1137,7 @@ { node.setName(s); } + for (ASTNode argument : arguments) { node.addChild(argument); Modified: branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/ASTNodeInfixParsingTest.java =================================================================== --- branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/ASTNodeInfixParsingTest.java 2015-04-22 09:57:59 UTC (rev 2206) +++ branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/ASTNodeInfixParsingTest.java 2015-04-22 11:35:00 UTC (rev 2207) @@ -126,6 +126,7 @@ assertTrue(n.getType() == ASTNode.Type.FUNCTION_COS); assertTrue(n.isFunction() == true); assertTrue(n.isName() == false); + assertTrue(n.getChildCount() == 1); assertTrue(n.getName() == null); // TODO - should the original String be conserved and accessible through getName() assertTrue(n.toFormula().equals("cos(x)")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-22 12:19:34
|
Revision: 2208 http://sourceforge.net/p/jsbml/code/2208 Author: niko-rodrigue Date: 2015-04-22 11:47:04 +0000 (Wed, 22 Apr 2015) Log Message: ----------- recompiled FormulaParserLL3.jj whithout debugging information + corrected the last failing test for core. Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/TestInfixOperatorPrecedence.java Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java 2015-04-22 11:35:00 UTC (rev 2207) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java 2015-04-22 11:47:04 UTC (rev 2208) @@ -548,84 +548,67 @@ } final public Token string() throws ParseException { - trace_call("string"); - try { Token t; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LOG: - t = jj_consume_token(LOG); - break; - case STRING: - t = jj_consume_token(STRING); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LOG: + t = jj_consume_token(LOG); + break; + case STRING: + t = jj_consume_token(STRING); + break; + default: + jj_la1[0] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } {if (true) return t;} throw new Error("Missing return statement in function"); - } finally { - trace_return("string"); - } } final public ASTNode parse() throws ParseException { - trace_call("parse"); - try { ASTNode node = null; - node = expression(); + node = expression(); {if (true) return node;} throw new Error("Missing return statement in function"); - } finally { - trace_return("parse"); - } } final private ASTNode expression() throws ParseException { - trace_call("expression"); - try { ASTNode value = null; - value = termLevel2(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 0: - jj_consume_token(0); - break; - case EOL: - jj_consume_token(EOL); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + value = termLevel2(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case 0: + jj_consume_token(0); + break; + case EOL: + jj_consume_token(EOL); + break; + default: + jj_la1[1] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } {if (true) return value;} throw new Error("Missing return statement in function"); - } finally { - trace_return("expression"); - } } final private ASTNode termLevel2() throws ParseException { - trace_call("termLevel2"); - try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; Token t; - leftChild = termLevel3(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case BOOLEAN_LOGIC: - ; - break; - default: - jj_la1[2] = jj_gen; - break label_1; - } - t = jj_consume_token(BOOLEAN_LOGIC); - rightChild = termLevel3(); + leftChild = termLevel3(); + label_1: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case BOOLEAN_LOGIC: + ; + break; + default: + jj_la1[2] = jj_gen; + break label_1; + } + t = jj_consume_token(BOOLEAN_LOGIC); + rightChild = termLevel3(); // TODO - do we want to ignore the case for those cases ? String s = t.image; Type type = null; // ASTNode.Type.valueOf(stringToType.getProperty(s.toLowerCase()).toUpperCase()); @@ -647,34 +630,29 @@ node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel2"); - } } final private ASTNode termLevel3() throws ParseException { - trace_call("termLevel3"); - try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; Token t; - leftChild = termLevel4(); - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case COMPARISON: - ; - break; - default: - jj_la1[3] = jj_gen; - break label_2; - } - t = jj_consume_token(COMPARISON); - rightChild = termLevel4(); + leftChild = termLevel4(); + label_2: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case COMPARISON: + ; + break; + default: + jj_la1[3] = jj_gen; + break label_2; + } + t = jj_consume_token(COMPARISON); + rightChild = termLevel4(); String s = t.image; Type type = null; @@ -706,93 +684,83 @@ node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel3"); - } } final private ASTNode termLevel4() throws ParseException { - trace_call("termLevel4"); - try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; - leftChild = termLevel5(); - label_3: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - case MINUS: - ; - break; - default: - jj_la1[4] = jj_gen; - break label_3; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - rightChild = termLevel5(); + leftChild = termLevel5(); + label_3: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + case MINUS: + ; + break; + default: + jj_la1[4] = jj_gen; + break label_3; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case PLUS: + jj_consume_token(PLUS); + rightChild = termLevel5(); node = new ASTNode('+'); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - break; - case MINUS: - jj_consume_token(MINUS); - rightChild = termLevel5(); + break; + case MINUS: + jj_consume_token(MINUS); + rightChild = termLevel5(); node = new ASTNode('-'); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - break; - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + break; + default: + jj_la1[5] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel4"); - } } final private ASTNode termLevel5() throws ParseException { - trace_call("termLevel5"); - try { ASTNode rightChild = null; ASTNode leftChild; ASTNode node = null; - leftChild = termLevel6(); - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - case DIVIDE: - case MODULO: - ; - break; - default: - jj_la1[6] = jj_gen; - break label_4; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - jj_consume_token(TIMES); - rightChild = termLevel6(); + leftChild = termLevel6(); + label_4: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TIMES: + case DIVIDE: + case MODULO: + ; + break; + default: + jj_la1[6] = jj_gen; + break label_4; + } + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case TIMES: + jj_consume_token(TIMES); + rightChild = termLevel6(); node = new ASTNode('*'); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - break; - case DIVIDE: - jj_consume_token(DIVIDE); - rightChild = termLevel6(); + break; + case DIVIDE: + jj_consume_token(DIVIDE); + rightChild = termLevel6(); Integer left, right; left = getInteger(leftChild); right = getInteger(rightChild); @@ -810,100 +778,85 @@ node.addChild(rightChild); leftChild = node; } - break; - case MODULO: - jj_consume_token(MODULO); - rightChild = termLevel6(); + break; + case MODULO: + jj_consume_token(MODULO); + rightChild = termLevel6(); node = createModulo(leftChild, rightChild); leftChild = node; - break; - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + break; + default: + jj_la1[7] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel5"); - } } final private ASTNode termLevel6() throws ParseException { - trace_call("termLevel6"); - try { ASTNode node = null; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case MINUS: - jj_consume_token(MINUS); - node = termLevel7(); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case MINUS: + jj_consume_token(MINUS); + node = termLevel7(); ASTNode uiMinus = new ASTNode('-'); uiMinus.addChild(node); {if (true) return uiMinus;} - break; - case NOT: - jj_consume_token(NOT); - node = termLevel7(); + break; + case NOT: + jj_consume_token(NOT); + node = termLevel7(); ASTNode not = new ASTNode(Type.LOGICAL_NOT); not.addChild(node); {if (true) return not;} - break; - case INTEGER: - case NUMBER: - case EXPNUMBER: - case OPEN_PAR: - case LEFT_BRACES: - case LOG: - case STRING: - node = termLevel7(); + break; + case INTEGER: + case NUMBER: + case EXPNUMBER: + case OPEN_PAR: + case LEFT_BRACES: + case LOG: + case STRING: + node = termLevel7(); {if (true) return node;} - break; - default: - jj_la1[8] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + break; + default: + jj_la1[8] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); + } throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel6"); - } } final private ASTNode termLevel7() throws ParseException { - trace_call("termLevel7"); - try { ASTNode rightChild; ASTNode leftChild; ASTNode node = null; - leftChild = termLevel8(); - label_5: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case POWER: - ; - break; - default: - jj_la1[9] = jj_gen; - break label_5; - } - jj_consume_token(POWER); - rightChild = termLevel8(); + leftChild = termLevel8(); + label_5: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case POWER: + ; + break; + default: + jj_la1[9] = jj_gen; + break label_5; + } + jj_consume_token(POWER); + rightChild = termLevel8(); node = new ASTNode(Type.POWER); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; - } + } {if (true) return leftChild;} throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel7"); - } } final private ASTNode termLevel8() throws ParseException, NumberFormatException { - trace_call("termLevel8"); - try { Token t; double d; int i; @@ -913,21 +866,21 @@ String s; String vals [ ]; ArrayList < ASTNode > arguments = new ArrayList < ASTNode > (); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER: - t = jj_consume_token(INTEGER); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case INTEGER: + t = jj_consume_token(INTEGER); i = Integer.parseInt(t.image); // Could use StringTools.parseXXX methods here but not doing so allow to support different locale ?? node.setValue(i); {if (true) return node;} - break; - case NUMBER: - t = jj_consume_token(NUMBER); + break; + case NUMBER: + t = jj_consume_token(NUMBER); d = Double.parseDouble(t.image); node.setValue(d); {if (true) return node;} - break; - case EXPNUMBER: - t = jj_consume_token(EXPNUMBER); + break; + case EXPNUMBER: + t = jj_consume_token(EXPNUMBER); s = t.image; vals = s.toLowerCase().split("e"); if (vals [ 1 ].startsWith("+")) @@ -940,28 +893,28 @@ } node.setValue(Double.parseDouble(vals [ 0 ]), i); {if (true) return node;} - break; - default: - jj_la1[14] = jj_gen; - if (jj_2_1(2)) { - t = string(); - jj_consume_token(OPEN_PAR); - child = termLevel2(); - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPLITTER: - ; - break; - default: - jj_la1[10] = jj_gen; - break label_6; - } - jj_consume_token(SPLITTER); - furtherChild = termLevel2(); + break; + default: + jj_la1[14] = jj_gen; + if (jj_2_1(2)) { + t = string(); + jj_consume_token(OPEN_PAR); + child = termLevel2(); + label_6: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SPLITTER: + ; + break; + default: + jj_la1[10] = jj_gen; + break label_6; + } + jj_consume_token(SPLITTER); + furtherChild = termLevel2(); arguments.add(furtherChild); - } - jj_consume_token(CLOSE_PAR); + } + jj_consume_token(CLOSE_PAR); s = t.image; Type type = null; if (ignoreCase) @@ -1037,90 +990,90 @@ node.addChild(argument); } {if (true) return node;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case OPEN_PAR: - jj_consume_token(OPEN_PAR); - node = termLevel2(); - jj_consume_token(CLOSE_PAR); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case OPEN_PAR: + jj_consume_token(OPEN_PAR); + node = termLevel2(); + jj_consume_token(CLOSE_PAR); {if (true) return node;} - break; - default: - jj_la1[15] = jj_gen; - if (jj_2_2(4)) { - t = jj_consume_token(STRING); + break; + default: + jj_la1[15] = jj_gen; + if (jj_2_2(4)) { + t = jj_consume_token(STRING); ASTNode selector = new ASTNode(); selector.setType(ASTNode.Type.FUNCTION_SELECTOR); selector.addChild(new ASTNode(t.image)); - label_7: - while (true) { - jj_consume_token(LEFT_BRACKET); - node = termLevel2(); + label_7: + while (true) { + jj_consume_token(LEFT_BRACKET); + node = termLevel2(); selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[11] = jj_gen; - break label_7; - } + jj_consume_token(RIGHT_BRACKET); + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_BRACKET: + ; + break; + default: + jj_la1[11] = jj_gen; + break label_7; } + } {if (true) return selector;} - } else if (jj_2_3(2)) { - jj_consume_token(LEFT_BRACES); - node = termLevel2(); + } else if (jj_2_3(2)) { + jj_consume_token(LEFT_BRACES); + node = termLevel2(); ASTNode selector = new ASTNode(); vector = new ASTNode(); boolean isSelector = false; selector.setType(ASTNode.Type.FUNCTION_SELECTOR); vector.setType(ASTNode.Type.VECTOR); vector.addChild(node); - label_8: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SPLITTER: - ; - break; - default: - jj_la1[12] = jj_gen; - break label_8; - } - jj_consume_token(SPLITTER); - node = termLevel2(); + label_8: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case SPLITTER: + ; + break; + default: + jj_la1[12] = jj_gen; + break label_8; + } + jj_consume_token(SPLITTER); + node = termLevel2(); vector.addChild(node); + } + jj_consume_token(RIGHT_BRACES); + selector.addChild(vector); + label_9: + while (true) { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_BRACKET: + ; + break; + default: + jj_la1[13] = jj_gen; + break label_9; } - jj_consume_token(RIGHT_BRACES); - selector.addChild(vector); - label_9: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[13] = jj_gen; - break label_9; - } - jj_consume_token(LEFT_BRACKET); - node = termLevel2(); + jj_consume_token(LEFT_BRACKET); + node = termLevel2(); isSelector = true; selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - } + jj_consume_token(RIGHT_BRACKET); + } {if (true) return isSelector ? selector : vector;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACES: - jj_consume_token(LEFT_BRACES); + } else { + switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { + case LEFT_BRACES: + jj_consume_token(LEFT_BRACES); vector = new ASTNode(); vector.setType(ASTNode.Type.VECTOR); - jj_consume_token(RIGHT_BRACES); + jj_consume_token(RIGHT_BRACES); {if (true) return vector;} - break; - case STRING: - t = jj_consume_token(STRING); + break; + case STRING: + t = jj_consume_token(STRING); s = t.image; if (ignoreCase) { @@ -1168,20 +1121,17 @@ node = new ASTNode(s); } {if (true) return node;} - break; - default: - jj_la1[16] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } + break; + default: + jj_la1[16] = jj_gen; + jj_consume_token(-1); + throw new ParseException(); } } } } + } throw new Error("Missing return statement in function"); - } finally { - trace_return("termLevel8"); - } } private boolean jj_2_1(int xla) { @@ -1563,7 +1513,6 @@ } } } - trace_token(token, ""); return token; } token = oldToken; @@ -1601,7 +1550,6 @@ else token = token.next = token_source.getNextToken(); jj_ntk = -1; jj_gen++; - trace_token(token, " (in getNextToken)"); return token; } @@ -1687,57 +1635,14 @@ return new ParseException(token, exptokseq, tokenImage); } - private int trace_indent = 0; - private boolean trace_enabled = true; - -/** Enable tracing. */ + /** Enable tracing. */ final public void enable_tracing() { - trace_enabled = true; } -/** Disable tracing. */ + /** Disable tracing. */ final public void disable_tracing() { - trace_enabled = false; } - private void trace_call(String s) { - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.println("Call: " + s); - } - trace_indent = trace_indent + 2; - } - - private void trace_return(String s) { - trace_indent = trace_indent - 2; - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.println("Return: " + s); - } - } - - private void trace_token(Token t, String where) { - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.print("Consumed token: <" + tokenImage[t.kind]); - if (t.kind != 0 && !tokenImage[t.kind].equals("\"" + t.image + "\"")) { - System.out.print(": \"" + t.image + "\""); - } - System.out.println(" at line " + t.beginLine + " column " + t.beginColumn + ">" + where); - } - } - - private void trace_scan(Token t1, int t2) { - if (trace_enabled) { - for (int i = 0; i < trace_indent; i++) { System.out.print(" "); } - System.out.print("Visited token: <" + tokenImage[t1.kind]); - if (t1.kind != 0 && !tokenImage[t1.kind].equals("\"" + t1.image + "\"")) { - System.out.print(": \"" + t1.image + "\""); - } - System.out.println(" at line " + t1.beginLine + " column " + t1.beginColumn + ">; Expected token: <" + tokenImage[t2] + ">"); - } - } - private void jj_rescan_token() { jj_rescan = true; for (int i = 0; i < 3; i++) { Modified: branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/TestInfixOperatorPrecedence.java =================================================================== --- branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/TestInfixOperatorPrecedence.java 2015-04-22 11:35:00 UTC (rev 2207) +++ branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/TestInfixOperatorPrecedence.java 2015-04-22 11:47:04 UTC (rev 2208) @@ -107,7 +107,7 @@ // TODO: Test by comparing nodes in the tree System.out.println(n.toMathML()); System.out.println(n.toFormula()); - assertTrue(n.toFormula().equals("5+2*4+4*8")); + assertTrue(n.toFormula().equals("5+(2*4)+(4*8)")); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-22 09:58:02
|
Revision: 2206 http://sourceforge.net/p/jsbml/code/2206 Author: niko-rodrigue Date: 2015-04-22 09:57:59 +0000 (Wed, 22 Apr 2015) Log Message: ----------- corrected the spatial package classes to avoid NullPointerException when setting int/Integer, double/Double or boolean/Boolean (because of the auto-boxing) Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -24,7 +24,6 @@ import java.text.MessageFormat; import java.util.Collection; import java.util.List; -import java.util.Map; import javax.swing.tree.TreeNode; Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Boundary.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -224,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); } @@ -238,7 +238,7 @@ */ public boolean unsetOrdinal() { if (isSetOrdinal()) { - int oldOrdinal = ordinal; + Integer oldOrdinal = ordinal; ordinal = null; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, ordinal); return true; Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -168,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); } @@ -182,7 +182,7 @@ */ public boolean unsetRotateAxisX() { if (isSetRotateAxisX()) { - double oldRotateAxisX = rotateAxisX; + Double oldRotateAxisX = rotateAxisX; rotateAxisX = null; firePropertyChange(SpatialConstants.rotateAxisX, oldRotateAxisX, rotateAxisX); return true; @@ -220,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); } @@ -234,7 +234,7 @@ */ public boolean unsetRotateAxisY() { if (isSetRotateAxisY()) { - double oldRotateAxisY = rotateAxisY; + Double oldRotateAxisY = rotateAxisY; rotateAxisY = null; firePropertyChange(SpatialConstants.rotateAxisY, oldRotateAxisY, rotateAxisY); return true; @@ -272,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); } @@ -286,7 +286,7 @@ */ public boolean unsetRotateAxisZ() { if (isSetRotateAxisZ()) { - double oldRotateAxisZ = rotateAxisZ; + Double oldRotateAxisZ = rotateAxisZ; rotateAxisZ = null; firePropertyChange(SpatialConstants.rotateAxisZ, oldRotateAxisZ, rotateAxisZ); return true; @@ -324,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); } @@ -338,7 +338,7 @@ */ public boolean unsetRotateAngleInRadians() { if (isSetRotateAngleInRadians()) { - double oldRotateAngleInRadians = rotateAngleInRadians; + Double oldRotateAngleInRadians = rotateAngleInRadians; rotateAngleInRadians = null; firePropertyChange(SpatialConstants.rotateAngleInRadians, oldRotateAngleInRadians, rotateAngleInRadians); return true; @@ -370,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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -160,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); } @@ -174,7 +174,7 @@ */ public boolean unsetScaleX() { if (isSetScaleX()) { - double oldScaleX = scaleX; + Double oldScaleX = scaleX; scaleX = null; firePropertyChange(SpatialConstants.scaleX, oldScaleX, scaleX); return true; @@ -212,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); } @@ -226,7 +226,7 @@ */ public boolean unsetScaleY() { if (isSetScaleY()) { - double oldScaleY = scaleY; + Double oldScaleY = scaleY; scaleY = null; firePropertyChange(SpatialConstants.scaleY, oldScaleY, scaleY); return true; @@ -264,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); } @@ -278,7 +278,7 @@ */ public boolean unsetScaleZ() { if (isSetScaleZ()) { - double oldScaleZ = scaleZ; + Double oldScaleZ = scaleZ; scaleZ = null; firePropertyChange(SpatialConstants.scaleZ, oldScaleZ, scaleZ); return true; @@ -308,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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -158,7 +158,7 @@ * @param translateX */ public void setTranslateX(double translateX) { - double oldTranslateX = this.translateX; + Double oldTranslateX = this.translateX; this.translateX = translateX; firePropertyChange(SpatialConstants.translateX, oldTranslateX, this.translateX); } @@ -172,7 +172,7 @@ */ public boolean unsetTranslateX() { if (isSetTranslateX()) { - double oldTranslateX = translateX; + Double oldTranslateX = translateX; translateX = null; firePropertyChange(SpatialConstants.translateX, oldTranslateX, translateX); return true; @@ -210,7 +210,7 @@ * @param translateY */ public void setTranslateY(double translateY) { - double oldTranslateY = this.translateY; + Double oldTranslateY = this.translateY; this.translateY = translateY; firePropertyChange(SpatialConstants.translateY, oldTranslateY, this.translateY); } @@ -224,7 +224,7 @@ */ public boolean unsetTranslateY() { if (isSetTranslateY()) { - double oldTranslateY = translateY; + Double oldTranslateY = translateY; translateY = null; firePropertyChange(SpatialConstants.translateY, oldTranslateY, translateY); return true; @@ -262,7 +262,7 @@ * @param translateZ */ public void setTranslateZ(double translateZ) { - double oldTranslateZ = this.translateZ; + Double oldTranslateZ = this.translateZ; this.translateZ = translateZ; firePropertyChange(SpatialConstants.translateZ, oldTranslateZ, this.translateZ); } @@ -276,7 +276,7 @@ */ public boolean unsetTranslateZ() { if (isSetTranslateZ()) { - double oldTranslateZ = translateZ; + Double oldTranslateZ = translateZ; translateZ = null; firePropertyChange(SpatialConstants.translateZ, oldTranslateZ, translateZ); return true; @@ -306,16 +306,13 @@ public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetTranslateX()) { - attributes.remove("translateX"); - attributes.put(SpatialConstants.shortLabel + ":translateX", String.valueOf(getTranslateX())); + attributes.put(SpatialConstants.shortLabel + ":translateX", translateX.toString()); } if (isSetTranslateY()) { - attributes.remove("translateY"); - attributes.put(SpatialConstants.shortLabel + ":translateY", String.valueOf(getTranslateY())); + attributes.put(SpatialConstants.shortLabel + ":translateY", translateY.toString()); } if (isSetTranslateZ()) { - attributes.remove("translateZ"); - attributes.put(SpatialConstants.shortLabel + ":translateZ", String.valueOf(getTranslateZ())); + attributes.put(SpatialConstants.shortLabel + ":translateZ", translateZ.toString()); } return attributes; } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -23,7 +23,6 @@ import java.util.Map; -import org.sbml.jsbml.Compartment; import org.sbml.jsbml.Model; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.util.StringTools; @@ -215,7 +214,7 @@ */ public boolean unsetUnitSize() { if (isSetUnitSize()) { - double oldUnitSize = unitSize; + Double oldUnitSize = unitSize; unitSize = null; firePropertyChange(SpatialConstants.unitSize, oldUnitSize, unitSize); return true; Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -32,7 +32,6 @@ import org.sbml.jsbml.ListOf; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.util.ResourceManager; -import org.sbml.jsbml.util.TreeNodeChangeEvent; import org.sbml.jsbml.util.filters.NameFilter; /** Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -144,7 +144,7 @@ * @param isActive */ public void setIsActive(boolean isActive) { - boolean oldIsActive = this.isActive; + Boolean oldIsActive = this.isActive; this.isActive = isActive; firePropertyChange(SpatialConstants.isActive, oldIsActive, this.isActive); } @@ -157,7 +157,7 @@ */ public boolean unsetIsActive() { if (isSetIsActive()) { - boolean oldIsActive = isActive; + Boolean oldIsActive = isActive; isActive = null; firePropertyChange(SpatialConstants.isActive, oldIsActive, isActive); return true; Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -31,7 +31,6 @@ import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.util.ResourceManager; import org.sbml.jsbml.util.StringTools; -import org.sbml.jsbml.util.TreeNodeChangeEvent; /** * @author Alex Thomas @@ -198,12 +197,7 @@ * @param coord1 */ public void setCoord1(double coord1) { - Double oldCoord1; - if (isSetCoord1()) { - oldCoord1 = this.coord1; - } else { - oldCoord1 = null; - } + Double oldCoord1 = this.coord1; this.coord1 = coord1; firePropertyChange(SpatialConstants.coord1, oldCoord1, this.coord1); } @@ -217,7 +211,7 @@ */ public boolean unsetCoord1() { if (isSetCoord1()) { - double oldCoord1 = coord1; + Double oldCoord1 = coord1; coord1 = null; firePropertyChange(SpatialConstants.coord1, oldCoord1, coord1); return true; @@ -253,12 +247,7 @@ * @param coord2 */ public void setCoord2(double coord2) { - Double oldCoord2; - if (isSetCoord2()) { - oldCoord2 = this.coord2; - } else { - oldCoord2 = null; - } + Double oldCoord2 = this.coord2; this.coord2 = coord2; firePropertyChange(SpatialConstants.coord2, oldCoord2, this.coord2); } @@ -272,7 +261,7 @@ */ public boolean unsetCoord2() { if (isSetCoord2()) { - double oldCoord2 = coord2; + Double oldCoord2 = coord2; coord2 = null; firePropertyChange(SpatialConstants.coord2, oldCoord2, coord2); return true; @@ -309,12 +298,7 @@ * @param coord3 */ public void setCoord3(double coord3) { - Double oldCoord3; - if (isSetCoord3()) { - oldCoord3 = coord1; - } else { - oldCoord3 = null; - } + Double oldCoord3 = coord1; this.coord3 = coord3; firePropertyChange(SpatialConstants.coord3, oldCoord3, this.coord3); } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -153,7 +153,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); } @@ -167,7 +167,7 @@ */ public boolean unsetOrdinal() { if (isSetOrdinal()) { - int oldOrdinal = ordinal; + Integer oldOrdinal = ordinal; ordinal = null; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, ordinal); return true; @@ -246,11 +246,9 @@ public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetOrdinal()) { - attributes.remove("ordinal"); - attributes.put(SpatialConstants.shortLabel + ":ordinal", String.valueOf(getOrdinal())); + attributes.put(SpatialConstants.shortLabel + ":ordinal", ordinal.toString()); } if (isSetGeometryDefinition()) { - attributes.remove("geometryDefinition"); attributes.put(SpatialConstants.shortLabel + ":geometryDefinition", getGeometryDefinition()); } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java 2015-04-22 08:36:22 UTC (rev 2205) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java 2015-04-22 09:57:59 UTC (rev 2206) @@ -298,11 +298,9 @@ public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetSpId()) { - attributes.remove("spatialRef"); attributes.put(SpatialConstants.shortLabel + ":spatialRef", getSpId()); } if (isSetSpeciesReference()) { - attributes.remove("variable"); attributes.put(SpatialConstants.shortLabel + ":variable", String.valueOf(getSpeciesReference())); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-22 08:36:29
|
Revision: 2205 http://sourceforge.net/p/jsbml/code/2205 Author: niko-rodrigue Date: 2015-04-22 08:36:22 +0000 (Wed, 22 Apr 2015) Log Message: ----------- Corrected SBMLError so that the message from Exceptions extending it is displayed + fixed AnalyticVolume to prevent NullPointerException when the ordinal is not defined Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/AbstractSBase.java trunk/core/src/org/sbml/jsbml/SBMLError.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java Modified: trunk/core/src/org/sbml/jsbml/AbstractSBase.java =================================================================== --- trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2015-04-22 08:09:38 UTC (rev 2204) +++ trunk/core/src/org/sbml/jsbml/AbstractSBase.java 2015-04-22 08:36:22 UTC (rev 2205) @@ -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: trunk/core/src/org/sbml/jsbml/SBMLError.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLError.java 2015-04-22 08:09:38 UTC (rev 2204) +++ trunk/core/src/org/sbml/jsbml/SBMLError.java 2015-04-22 08:36:22 UTC (rev 2205) @@ -131,6 +131,8 @@ */ public SBMLError(String message) { super(message); + this.message = new Message(); + this.message.setMessage(message); } /** Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-22 08:09:38 UTC (rev 2204) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-22 08:36:22 UTC (rev 2205) @@ -306,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); } @@ -319,7 +319,7 @@ */ public boolean unsetOrdinal() { if (isSetOrdinal()) { - int oldOrdinal = ordinal; + Integer oldOrdinal = ordinal; ordinal = null; firePropertyChange(SpatialConstants.ordinal, oldOrdinal, ordinal); return true; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-22 08:09:46
|
Revision: 2204 http://sourceforge.net/p/jsbml/code/2204 Author: pdp10 Date: 2015-04-22 08:09:38 +0000 (Wed, 22 Apr 2015) Log Message: ----------- update for spatial package v0.90 Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/MixedGeometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Geometry.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -37,7 +37,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -112,25 +113,28 @@ * @param sb */ public Geometry(Geometry sb) { - super(sb); - if (sb.isSetCoordinateSystem()) { - setCoordinateSystem(sb.getCoordinateSystem()); - } + super(sb); + if (sb.isSetListOfCoordinateComponents()) { + setListOfCoordinateComponents(sb.getListOfCoordinateComponents().clone()); + } + if (sb.isSetListOfDomainTypes()) { + setListOfDomainTypes(sb.getListOfDomainTypes().clone()); + } + if (sb.isSetListOfDomains()) { + setListOfDomains(sb.getListOfDomains().clone()); + } if (sb.isSetListOfAdjacentDomains()) { setListOfAdjacentDomains(sb.getListOfAdjacentDomains().clone()); } - if (sb.isSetListOfDomains()) { - setListOfDomains(sb.getListOfDomains().clone()); - } - if (sb.isSetListOfDomainTypes()) { - setListOfDomainTypes(sb.getListOfDomainTypes().clone()); - } if (sb.isSetListOfGeometryDefinitions()) { setListOfGeometryDefinitions(sb.getListOfGeometryDefinitions().clone()); } if (sb.isSetListOfSampledFields()) { setListOfSampledFields(sb.getListOfSampledFields().clone()); } + if (sb.isSetCoordinateSystem()) { + setCoordinateSystem(sb.getCoordinateSystem()); + } } /** @@ -196,7 +200,6 @@ if (equal && isSetListOfSampledFields()) { equal &= gm.getListOfSampledFields() == getListOfSampledFields(); } - } return equal; } @@ -529,7 +532,7 @@ * Creates a new GeometryDefinition element and adds it to the ListOfGeometryDefinitions list * @return */ - public SampledFieldGeometry createSampledFieldGeometryn() { + public SampledFieldGeometry createSampledFieldGeometry() { return createSampledFieldGeometry(null); } @@ -1237,16 +1240,6 @@ attributes.remove("coordinateSystem"); attributes.put(SpatialConstants.shortLabel + ':' + SpatialConstants.coordinateSystem, coordinateSystem.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()); - } - //TODO: Not sure why sboTerm and metaId are written here...? - return attributes; } @@ -1260,6 +1253,24 @@ if (isSetCoordinateSystem()) { hashCode += prime * coordinateSystem.hashCode(); } + if (isSetListOfAdjacentDomains()) { + hashCode += prime * listOfAdjacentDomains.hashCode(); + } + if (isSetListOfCoordinateComponents()) { + hashCode += prime * listOfCoordinateComponents.hashCode(); + } + if (isSetListOfDomains()) { + hashCode += prime * listOfDomains.hashCode(); + } + if (isSetListOfDomainTypes()) { + hashCode += prime * listOfDomainTypes.hashCode(); + } + if (isSetListOfGeometryDefinitions()) { + hashCode += prime * listOfGeometryDefinitions.hashCode(); + } + if (isSetListOfSampledFields()) { + hashCode += prime * listOfSampledFields.hashCode(); + } return hashCode; } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/GeometryDefinition.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -170,7 +170,7 @@ */ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1559; int hashCode = super.hashCode(); if (isSetIsActive()) { hashCode += prime * getIsActive().hashCode(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ImageData.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -34,7 +34,8 @@ * @author Alex Thomas * @author Andreas Dräger * @since 1.0 - * @version $Rev$ + * @version $Rev$ + * @deprecated */ public class ImageData extends AbstractSBase { @@ -46,11 +47,11 @@ /** * */ - private Integer samplesLength; + private Integer samplesLength; // TODO: is this field really required?? /** * */ - private Integer samples[]; + private Integer[] samples; /** * @@ -71,11 +72,11 @@ public ImageData(ImageData im) { super(im); if (im.isSetSamples()) { - samples = im.getSamples().clone(); + setSamples(im.getSamples().clone()); samplesLength = samples.length; } if (im.isSetDataType()) { - dataType = new String(im.getDataType()); + setDataType(im.getDataType()); } } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/InteriorPoint.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -35,7 +35,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -341,7 +342,7 @@ */ @Override public int hashCode() { - final int prime = 509;//Change this prime number + final int prime = 1627; int hashCode = super.hashCode(); if (isSetCoord1()) { hashCode += prime * getCoord1(); @@ -360,25 +361,14 @@ public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); if (isSetCoord1()) { - attributes.remove("coord1"); attributes.put(SpatialConstants.shortLabel + ":coord1", String.valueOf(getCoord1())); } if (isSetCoord2()) { - attributes.remove("coord2"); attributes.put(SpatialConstants.shortLabel + ":coord2", String.valueOf(getCoord2())); } if (isSetCoord3()) { - attributes.remove("coord3"); attributes.put(SpatialConstants.shortLabel + ":coord3", String.valueOf(getCoord3())); } - 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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/MixedGeometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/MixedGeometry.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/MixedGeometry.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -121,6 +121,19 @@ return equal; } + @Override + public int hashCode() { + final int prime = 1543; + int hashCode = super.hashCode(); + if (isSetListOfGeometryDefinitions()) { + hashCode += prime * getListOfGeometryDefinitions().hashCode(); + } + if (isSetListOfOrdinalMappings()) { + hashCode += prime * getListOfOrdinalMappings().hashCode(); + } + return hashCode; + } + /** * Returns {@code true}, if listOfGeometryDefinitions contains at least one element. * Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/OrdinalMapping.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -67,7 +67,7 @@ super(om); if (om.isSetGeometryDefinition()) { - setGeometryDefinition(new String(om.getGeometryDefinition())); + setGeometryDefinition(om.getGeometryDefinition()); } if (om.isSetOrdinal()) { setOrdinal(om.getOrdinal()); @@ -228,7 +228,7 @@ */ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 2039; int hashCode = super.hashCode(); if (isSetOrdinal()) { hashCode += prime * getOrdinal(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java 2015-04-21 15:40:05 UTC (rev 2203) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java 2015-04-22 08:09:38 UTC (rev 2204) @@ -87,10 +87,10 @@ public ParameterType(ParameterType ref) { super(ref); if (ref.isSetSpId()) { - spId = new String(ref.getSpId()); + setSpId(ref.getSpId()); } if (ref.isSetSpeciesReference()) { - speciesRef = new String(ref.getSpeciesReference()); + setSpeciesReference(ref.getSpeciesReference()); } } @@ -280,7 +280,7 @@ */ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1901; int hashCode = super.hashCode(); if (isSetSpId()) { hashCode += prime * getSpId().hashCode(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-21 15:40:07
|
Revision: 2203 http://sourceforge.net/p/jsbml/code/2203 Author: pdp10 Date: 2015-04-21 15:40:05 +0000 (Tue, 21 Apr 2015) Log Message: ----------- update for package spatial v0.90 Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DiffusionCoefficient.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Domain.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DomainType.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGHomogeneousTransformation.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGObject.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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()); } - } @@ -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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPrimitive.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGPseudoPrimitive.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGRotation.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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 @@ -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(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGScale.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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()); } } @@ -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(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGSetOperator.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -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: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTransformation.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -29,6 +29,7 @@ /** * @author Alex-Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGTranslation.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -29,6 +29,7 @@ /** * @author Alex-Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 20, 2014 @@ -66,13 +67,13 @@ public CSGTranslation(CSGTranslation csgt) { super(csgt); if (csgt.isSetTranslateX()) { - translateX = new Double(csgt.getTranslateX()); + setTranslateX(csgt.getTranslateX()); } if (csgt.isSetTranslateY()) { - translateY = new Double(csgt.getTranslateY()); + setTranslateY(csgt.getTranslateY()); } if (csgt.isSetTranslateZ()) { - translateZ = new Double(csgt.getTranslateZ()); + setTranslateZ(csgt.getTranslateZ()); } } @@ -286,7 +287,7 @@ @Override public int hashCode() { - final int prime = 313;//Change this prime number + final int prime = 1693; int hashCode = super.hashCode(); if (isSetTranslateX()) { hashCode += prime * getTranslateX(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DiffusionCoefficient.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DiffusionCoefficient.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DiffusionCoefficient.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -92,15 +92,15 @@ super(diffCoeff); if (diffCoeff.isSetDiffusionKind()) { - diffusionKind = diffCoeff.getDiffusionKind(); + setDiffusionKind(diffCoeff.getDiffusionKind()); } if (diffCoeff.isSetCoordinateReference1()) { - coordinateReference1 = diffCoeff.getCoordinateReference1(); + setCoordinateReference1(diffCoeff.getCoordinateReference1()); } if (diffCoeff.isSetCoordinateReference2()) { - coordinateReference2 = diffCoeff.getCoordinateReference2(); + setCoordinateReference2(diffCoeff.getCoordinateReference2()); } } @@ -314,7 +314,7 @@ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1531; int hashCode = super.hashCode(); if (isSetDiffusionKind()) { Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Domain.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Domain.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/Domain.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -96,7 +96,7 @@ setListOfInteriorPoints(dm.getListOfInteriorPoints().clone()); } if (dm.isSetDomainType()) { - domainType = new String(dm.getDomainType()); + setDomainType(dm.getDomainType()); } } @@ -359,11 +359,14 @@ */ @Override public int hashCode() { - final int prime = 1531;//Change this prime number + final int prime = 1571; int hashCode = super.hashCode(); if (isSetDomainType()) { hashCode += prime * getDomainType().hashCode(); } + if (isSetListOfInteriorPoints()) { + hashCode += prime * getListOfInteriorPoints().hashCode(); + } return hashCode; } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DomainType.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DomainType.java 2015-04-21 15:04:20 UTC (rev 2202) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/DomainType.java 2015-04-21 15:40:05 UTC (rev 2203) @@ -62,7 +62,7 @@ public DomainType(DomainType sb) { super(sb); if (sb.isSetSpatialDimensions()) { - spatialDimensions = Integer.valueOf(sb.getSpatialDimensions()); + setSpatialDimensions(sb.getSpatialDimensions()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2015-04-21 15:04:28
|
Revision: 2202 http://sourceforge.net/p/jsbml/code/2202 Author: andreas-draeger Date: 2015-04-21 15:04:20 +0000 (Tue, 21 Apr 2015) Log Message: ----------- Added a createTrigger method that can be used for SBML with Level < 3. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/Event.java Modified: trunk/core/src/org/sbml/jsbml/Event.java =================================================================== --- trunk/core/src/org/sbml/jsbml/Event.java 2015-04-21 14:49:22 UTC (rev 2201) +++ trunk/core/src/org/sbml/jsbml/Event.java 2015-04-21 15:04:20 UTC (rev 2202) @@ -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) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 14:49:24
|
Revision: 2201 http://sourceforge.net/p/jsbml/code/2201 Author: niko-rodrigue Date: 2015-04-21 14:49:22 +0000 (Tue, 21 Apr 2015) Log Message: ----------- corrected compilation error on FormulaParser.jj Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj Removed Paths: ------------- branches/astnode2-merging-alternate/jsbml.log Property Changed: ---------------- branches/astnode2-merging-alternate/ Index: branches/astnode2-merging-alternate =================================================================== --- branches/astnode2-merging-alternate 2015-04-21 14:25:17 UTC (rev 2200) +++ branches/astnode2-merging-alternate 2015-04-21 14:49:22 UTC (rev 2201) Property changes on: branches/astnode2-merging-alternate ___________________________________________________________________ Modified: svn:ignore ## -3,3 +3,4 ## dist build bin +jsbml.log Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java 2015-04-21 14:25:17 UTC (rev 2200) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java 2015-04-21 14:49:22 UTC (rev 2201) @@ -286,6 +286,7 @@ ASTNode node = null; Token t; Type type = null; + String s; leftChild = TermLvl2(); label_3: while (true) { @@ -320,7 +321,7 @@ case BOOLEAN_LOGIC: t = jj_consume_token(BOOLEAN_LOGIC); rightChild = TermLvl2(); - type = Type.getTypeFor(t.image); + s = t.image; if (s.equalsIgnoreCase("or") || s.equals("||")) { @@ -724,11 +725,6 @@ finally { jj_save(2, xla); } } - private boolean jj_3R_26() { - if (jj_scan_token(EXPNUMBER)) return true; - return false; - } - private boolean jj_3R_12() { Token xsp; xsp = jj_scanpos; @@ -872,13 +868,13 @@ return false; } - private boolean jj_3R_34() { - if (jj_scan_token(FACTORIAL)) return true; + private boolean jj_3R_32() { + if (jj_scan_token(STRING)) return true; return false; } - private boolean jj_3R_32() { - if (jj_scan_token(STRING)) return true; + private boolean jj_3R_34() { + if (jj_scan_token(FACTORIAL)) return true; return false; } @@ -894,17 +890,17 @@ return false; } - private boolean jj_3R_33() { - if (jj_scan_token(POWER)) return true; - return false; - } - private boolean jj_3_3() { if (jj_scan_token(LEFT_BRACES)) return true; if (jj_3R_10()) return true; return false; } + private boolean jj_3R_33() { + if (jj_scan_token(POWER)) return true; + return false; + } + private boolean jj_3R_20() { Token xsp; xsp = jj_scanpos; @@ -920,6 +916,12 @@ return false; } + private boolean jj_3R_30() { + if (jj_scan_token(NOT)) return true; + if (jj_3R_10()) return true; + return false; + } + private boolean jj_3R_13() { if (jj_3R_19()) return true; Token xsp; @@ -930,12 +932,6 @@ return false; } - private boolean jj_3R_30() { - if (jj_scan_token(NOT)) return true; - if (jj_3R_10()) return true; - return false; - } - private boolean jj_3R_27() { if (jj_scan_token(OPEN_PAR)) return true; if (jj_3R_10()) return true; @@ -957,14 +953,19 @@ return false; } + private boolean jj_3R_29() { + if (jj_scan_token(MINUS)) return true; + if (jj_3R_19()) return true; + return false; + } + private boolean jj_3R_22() { if (jj_scan_token(DIVIDE)) return true; return false; } - private boolean jj_3R_29() { - if (jj_scan_token(MINUS)) return true; - if (jj_3R_19()) return true; + private boolean jj_3R_26() { + if (jj_scan_token(EXPNUMBER)) return true; return false; } Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj 2015-04-21 14:25:17 UTC (rev 2200) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj 2015-04-21 14:49:22 UTC (rev 2201) @@ -453,6 +453,7 @@ ASTNode node = null; Token t; Type type = null; + String s; } { leftChild = TermLvl2() @@ -473,7 +474,7 @@ } | t = < BOOLEAN_LOGIC > rightChild = TermLvl2() { - type = Type.getTypeFor(t.image); + s = t.image; if (s.equalsIgnoreCase("or") || s.equals("||")) { Deleted: branches/astnode2-merging-alternate/jsbml.log =================================================================== --- branches/astnode2-merging-alternate/jsbml.log 2015-04-21 14:25:17 UTC (rev 2200) +++ branches/astnode2-merging-alternate/jsbml.log 2015-04-21 14:49:22 UTC (rev 2201) @@ -1,6337 +0,0 @@ -[19:13:05,391 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[19:13:05,399 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[19:13:05,400 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[19:13:05,400 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[19:13:05,400 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:13:05,401 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:13:05,401 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:13:05,411 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:13:05,416 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:13:05,426 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[19:13:05,431 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:13:05,437 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:13:05,437 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[19:13:05,473 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:13:05,484 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:13:05,484 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[19:13:05,490 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:13:05,495 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:13:05,688 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[19:13:05,689 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[19:13:05,689 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[19:13:05,690 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[19:13:05,800 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[19:13:06,027 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:13:06,100 WARN Model:1120] - Could not create Product because no reactions have been defined yet. -[19:13:06,106 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:13:06,123 WARN Model:1012] - Could not create LocalParameter for KineticLaw because no reactions have been defined yet. -[19:13:06,130 WARN Model:1176] - Could not create Reactant because no reactions have been defined yet. -[19:13:06,270 WARN AbstractSBase:1635] - Trying to register curve 'curve', which is already registered under speciesReferenceGlyph 'speciesReferenceGlyph [id=glyph, reference=null]'. -[19:13:06,984 ERROR Model:3950] - An element of type objective with the id "O1" is already present in this model "model". The new element will not be added to the model. -[19:13:06,984 ERROR SBMLDocument:444] - An element with the metaid "FB1" is already present in the SBML document. The new element will not get added to it. -[19:13:06,984 ERROR SBMLDocument:444] - An element with the metaid "S2" is already present in the SBML document. The new element will not get added to it. -[19:13:07,016 ERROR Model:648] - A Port with the id "S3" is already present in this model model. The new element will not be added to the model. -[19:13:07,020 ERROR Model:648] - A Port with the id "S3" is already present in this model modelDef2. The new element will not be added to the model. -[19:13:07,021 ERROR Model:3950] - An element of type species with the id "S3" is already present in this model "modelDef2". The new element will not be added to the model. -[19:13:07,032 ERROR IdentifierException:75] - An element with the metaid "S1" is already present in the SBML document. The element replacedBy will not be annotated with it. -[19:13:07,052 WARN AbstractSBase:1639] - SBaseRef 'SBaseRef [portRef=S1, idRef=null, unitRef=null, metaIdRef=null]' is associated to the different parent 'c'. Please remove it there before adding it to this 'port' or add a clone of it to this element. -[19:13:07,058 ERROR ArraysSBasePlugin:702] - A Dimension with the id "AD1" is already present in this species identified by id[S1]. The new element will not be added to the model. -[19:13:07,058 ERROR ArraysSBasePlugin:702] - A Dimension with the id "AD2" is already present in this species identified by id[S1]. The new element will not be added to the model. -[19:13:07,058 ERROR IdentifierException:62] - An element with the id "AD2" is already present in the SBML model. The identifier of dimension will not be set to this value. -[19:13:07,058 WARN ArraysSBasePlugin:769] - A Dimension with the id "AD1" is not present in this model identified by id[model]. Nothing to be done. -[19:13:07,069 ERROR Model:3950] - An element of type group with the id "G1" is already present in this model "model". The new element will not be added to the model. -[19:13:07,070 ERROR IdentifierException:62] - An element with the id "G1" is already present in the SBML model. The identifier of group will not be set to this value. -[19:13:07,070 ERROR Model:3950] - An element of type member with the id "GM1" is already present in this model "model". The new element will not be added to the model. -[19:13:07,070 ERROR Model:3950] - An element of type memberConstraint with the id "GMC1" is already present in this model "model". The new element will not be added to the model. -[19:13:07,071 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:13:07,071 ERROR Model:3950] - An element of type group with the id "G1" is already present in this model "model". The new element will not be added to the model. -[19:13:07,177 ERROR ArraysSBasePlugin:702] - A Dimension with the id "dim" is already present in this species identified by id[]. The new element will not be added to the model. -[19:27:18,304 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[19:27:18,334 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[19:27:18,334 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[19:27:18,348 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[19:27:18,348 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:27:18,348 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:27:18,348 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:27:18,358 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:27:18,364 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:27:18,375 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[19:27:18,380 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:27:18,393 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:27:18,394 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[19:27:18,420 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:27:18,430 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:27:18,430 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[19:27:18,436 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:27:18,441 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:27:18,680 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[19:27:18,681 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[19:27:18,681 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[19:27:18,682 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[19:27:18,794 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[19:27:19,041 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:27:19,109 WARN Model:1120] - Could not create Product because no reactions have been defined yet. -[19:27:19,115 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:27:19,126 WARN Model:1012] - Could not create LocalParameter for KineticLaw because no reactions have been defined yet. -[19:27:19,132 WARN Model:1176] - Could not create Reactant because no reactions have been defined yet. -[19:27:19,528 WARN AbstractSBase:1635] - Trying to register curve 'curve', which is already registered under speciesReferenceGlyph 'speciesReferenceGlyph [id=glyph, reference=null]'. -[19:27:24,129 WARN XMLNodeReader:262] - The type of String '' on the element sbml (SBMLDocument) is unknown! Some data might be lost. -[19:27:24,131 WARN XMLNodeReader:262] - The type of String '' on the element model (Model) is unknown! Some data might be lost. -[19:27:24,131 WARN XMLNodeReader:262] - The type of String '' on the element sbml (SBMLDocument) is unknown! Some data might be lost. -[19:27:24,156 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:27:24,156 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:27:24,157 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:27:24,157 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:27:24,180 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:27:24,181 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:27:24,181 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:27:24,182 WARN XMLNodeReader:262] - The type of String 'annotation' on the element reaction (Reaction) is unknown! Some data might be lost. -[19:27:24,182 WARN XMLNodeReader:262] - The type of String 'annotation' on the element speciesReference (SpeciesReference) is unknown! Some data might be lost. -[19:27:24,182 WARN SBMLCoreParser:650] - The element listOfProducts is not recognized -[19:27:24,183 WARN SBMLCoreParser:653] - The element speciesReference is not recognized -[19:27:24,183 WARN SBMLCoreParser:209] - Could not recognize the attribute "constant" on the element speciesReference. Please check the specification for SBML. -[19:27:24,242 WARN SBMLCoreParser:209] - Could not recognize the attribute "species" on the element speciesReference. Please check the specification for SBML. -[19:27:24,242 WARN SBMLCoreParser:209] - Could not recognize the attribute "stoichiometry" on the element speciesReference. Please check the specification for SBML. -[19:27:24,243 WARN XMLNodeReader:262] - The type of String 'annotation' on the element model (Model) is unknown! Some data might be lost. -[19:27:24,318 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:27:24,318 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:27:24,319 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:27:24,319 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:27:24,475 WARN XMLNodeReader:262] - The type of String '' on the element compartment (Compartment) is unknown! Some data might be lost. -[19:27:24,478 WARN XMLNodeReader:262] - The type of String '' on the element event (Event) is unknown! Some data might be lost. -[19:27:24,504 WARN XMLNodeReader:262] - The type of String '' on the element compartment (Compartment) is unknown! Some data might be lost. -[19:27:24,506 WARN XMLNodeReader:262] - The type of String '' on the element event (Event) is unknown! Some data might be lost. -[19:29:53,772 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[19:29:53,810 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[19:29:53,811 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[19:29:53,811 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[19:29:53,811 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:29:53,811 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:29:53,812 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:29:53,821 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:29:53,826 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:29:53,836 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[19:29:53,841 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:29:53,846 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:29:53,846 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[19:29:53,883 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:29:53,893 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:29:53,893 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[19:29:53,899 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:29:53,906 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:29:54,376 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[19:29:54,376 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[19:29:54,377 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[19:29:54,377 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[19:29:54,511 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[19:29:54,763 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:29:54,834 WARN Model:1120] - Could not create Product because no reactions have been defined yet. -[19:29:54,840 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:29:54,851 WARN Model:1012] - Could not create LocalParameter for KineticLaw because no reactions have been defined yet. -[19:29:54,856 WARN Model:1176] - Could not create Reactant because no reactions have been defined yet. -[19:29:55,516 WARN AbstractSBase:1635] - Trying to register curve 'curve', which is already registered under speciesReferenceGlyph 'speciesReferenceGlyph [id=glyph, reference=null]'. -[19:29:58,428 WARN XMLNodeReader:262] - The type of String '' on the element sbml (SBMLDocument) is unknown! Some data might be lost. -[19:29:58,430 WARN XMLNodeReader:262] - The type of String '' on the element model (Model) is unknown! Some data might be lost. -[19:29:58,431 WARN XMLNodeReader:262] - The type of String '' on the element sbml (SBMLDocument) is unknown! Some data might be lost. -[19:29:58,462 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:29:58,463 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:29:58,463 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:29:58,464 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:29:58,488 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:29:58,488 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:29:58,488 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:29:58,489 WARN XMLNodeReader:262] - The type of String 'annotation' on the element reaction (Reaction) is unknown! Some data might be lost. -[19:29:58,489 WARN XMLNodeReader:262] - The type of String 'annotation' on the element speciesReference (SpeciesReference) is unknown! Some data might be lost. -[19:29:58,490 WARN SBMLCoreParser:650] - The element listOfProducts is not recognized -[19:29:58,490 WARN SBMLCoreParser:653] - The element speciesReference is not recognized -[19:29:58,490 WARN SBMLCoreParser:209] - Could not recognize the attribute "constant" on the element speciesReference. Please check the specification for SBML. -[19:29:58,530 WARN SBMLCoreParser:209] - Could not recognize the attribute "species" on the element speciesReference. Please check the specification for SBML. -[19:29:58,531 WARN SBMLCoreParser:209] - Could not recognize the attribute "stoichiometry" on the element speciesReference. Please check the specification for SBML. -[19:29:58,531 WARN XMLNodeReader:262] - The type of String 'annotation' on the element model (Model) is unknown! Some data might be lost. -[19:29:58,630 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:29:58,630 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:29:58,630 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:29:58,631 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:29:58,831 WARN XMLNodeReader:262] - The type of String '' on the element compartment (Compartment) is unknown! Some data might be lost. -[19:29:58,833 WARN XMLNodeReader:262] - The type of String '' on the element event (Event) is unknown! Some data might be lost. -[19:29:58,854 WARN XMLNodeReader:262] - The type of String '' on the element compartment (Compartment) is unknown! Some data might be lost. -[19:29:58,856 WARN XMLNodeReader:262] - The type of String '' on the element event (Event) is unknown! Some data might be lost. -[19:32:25,321 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[19:32:25,354 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[19:32:25,354 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[19:32:25,355 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[19:32:25,355 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:32:25,355 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:32:25,355 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:32:25,365 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:32:25,371 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:32:25,382 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[19:32:25,387 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:32:25,400 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:32:25,400 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[19:32:25,432 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:32:25,443 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:32:25,443 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[19:32:25,449 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:32:25,455 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:32:25,708 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[19:32:25,709 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[19:32:25,709 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[19:32:25,709 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[19:32:25,821 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[19:32:26,061 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:32:26,129 WARN Model:1120] - Could not create Product because no reactions have been defined yet. -[19:32:26,134 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:32:26,145 WARN Model:1012] - Could not create LocalParameter for KineticLaw because no reactions have been defined yet. -[19:32:26,151 WARN Model:1176] - Could not create Reactant because no reactions have been defined yet. -[19:32:26,985 WARN AbstractSBase:1635] - Trying to register curve 'curve', which is already registered under speciesReferenceGlyph 'speciesReferenceGlyph [id=glyph, reference=null]'. -[19:32:29,887 WARN XMLNodeReader:262] - The type of String '' on the element sbml (SBMLDocument) is unknown! Some data might be lost. -[19:32:29,888 WARN XMLNodeReader:262] - The type of String '' on the element model (Model) is unknown! Some data might be lost. -[19:32:29,889 WARN XMLNodeReader:262] - The type of String '' on the element sbml (SBMLDocument) is unknown! Some data might be lost. -[19:32:29,912 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:32:29,913 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:32:29,914 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:32:29,914 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:32:29,937 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:32:29,938 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:32:29,938 WARN XMLNodeReader:262] - The type of String 'annotation' on the element species (Species) is unknown! Some data might be lost. -[19:32:29,939 WARN XMLNodeReader:262] - The type of String 'annotation' on the element reaction (Reaction) is unknown! Some data might be lost. -[19:32:29,939 WARN XMLNodeReader:262] - The type of String 'annotation' on the element speciesReference (SpeciesReference) is unknown! Some data might be lost. -[19:32:29,940 WARN SBMLCoreParser:650] - The element listOfProducts is not recognized -[19:32:29,940 WARN SBMLCoreParser:653] - The element speciesReference is not recognized -[19:32:29,940 WARN SBMLCoreParser:209] - Could not recognize the attribute "constant" on the element speciesReference. Please check the specification for SBML. -[19:32:29,988 WARN SBMLCoreParser:209] - Could not recognize the attribute "species" on the element speciesReference. Please check the specification for SBML. -[19:32:29,988 WARN SBMLCoreParser:209] - Could not recognize the attribute "stoichiometry" on the element speciesReference. Please check the specification for SBML. -[19:32:29,988 WARN XMLNodeReader:262] - The type of String 'annotation' on the element model (Model) is unknown! Some data might be lost. -[19:32:30,106 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:32:30,107 WARN XMLNodeReader:262] - The type of String '' on the element parameter (Parameter) is unknown! Some data might be lost. -[19:32:30,107 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:32:30,108 WARN XMLNodeReader:262] - The type of String '' on the element assignmentRule (AssignmentRule) is unknown! Some data might be lost. -[19:32:30,365 WARN XMLNodeReader:262] - The type of String '' on the element compartment (Compartment) is unknown! Some data might be lost. -[19:32:30,369 WARN XMLNodeReader:262] - The type of String '' on the element event (Event) is unknown! Some data might be lost. -[19:32:30,390 WARN XMLNodeReader:262] - The type of String '' on the element compartment (Compartment) is unknown! Some data might be lost. -[19:32:30,392 WARN XMLNodeReader:262] - The type of String '' on the element event (Event) is unknown! Some data might be lost. -[19:34:39,977 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[19:34:40,050 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[19:34:40,050 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[19:34:40,050 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[19:34:40,051 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:34:40,082 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:34:40,082 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:34:40,093 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:34:40,098 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:34:40,110 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[19:34:40,116 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:34:40,122 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:34:40,122 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[19:34:40,243 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:34:40,253 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:34:40,253 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[19:34:40,259 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:34:40,264 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:34:40,760 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[19:34:40,761 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[19:34:40,761 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[19:34:40,761 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[19:34:40,863 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[19:34:41,114 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:34:41,182 WARN Model:1120] - Could not create Product because no reactions have been defined yet. -[19:34:41,188 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:34:41,213 WARN Model:1012] - Could not create LocalParameter for KineticLaw because no reactions have been defined yet. -[19:34:41,218 WARN Model:1176] - Could not create Reactant because no reactions have been defined yet. -[19:34:41,576 WARN AbstractSBase:1635] - Trying to register curve 'curve', which is already registered under speciesReferenceGlyph 'speciesReferenceGlyph [id=glyph, reference=null]'. -[19:34:47,963 ERROR Model:3950] - An element of type objective with the id "O1" is already present in this model "model". The new element will not be added to the model. -[19:34:47,963 ERROR SBMLDocument:444] - An element with the metaid "FB1" is already present in the SBML document. The new element will not get added to it. -[19:34:47,964 ERROR SBMLDocument:444] - An element with the metaid "S2" is already present in the SBML document. The new element will not get added to it. -[19:34:48,395 ERROR Model:648] - A Port with the id "S3" is already present in this model model. The new element will not be added to the model. -[19:34:48,483 ERROR Model:648] - A Port with the id "S3" is already present in this model modelDef2. The new element will not be added to the model. -[19:34:48,483 ERROR Model:3950] - An element of type species with the id "S3" is already present in this model "modelDef2". The new element will not be added to the model. -[19:34:48,541 ERROR IdentifierException:75] - An element with the metaid "S1" is already present in the SBML document. The element replacedBy will not be annotated with it. -[19:34:48,661 WARN AbstractSBase:1639] - SBaseRef 'SBaseRef [portRef=S1, idRef=null, unitRef=null, metaIdRef=null]' is associated to the different parent 'c'. Please remove it there before adding it to this 'port' or add a clone of it to this element. -[19:34:48,666 ERROR ArraysSBasePlugin:702] - A Dimension with the id "AD1" is already present in this species identified by id[S1]. The new element will not be added to the model. -[19:34:48,666 ERROR ArraysSBasePlugin:702] - A Dimension with the id "AD2" is already present in this species identified by id[S1]. The new element will not be added to the model. -[19:34:48,666 ERROR IdentifierException:62] - An element with the id "AD2" is already present in the SBML model. The identifier of dimension will not be set to this value. -[19:34:48,667 WARN ArraysSBasePlugin:769] - A Dimension with the id "AD1" is not present in this model identified by id[model]. Nothing to be done. -[19:34:48,962 ERROR Model:3950] - An element of type group with the id "G1" is already present in this model "model". The new element will not be added to the model. -[19:34:48,962 ERROR IdentifierException:62] - An element with the id "G1" is already present in the SBML model. The identifier of group will not be set to this value. -[19:34:48,962 ERROR Model:3950] - An element of type member with the id "GM1" is already present in this model "model". The new element will not be added to the model. -[19:34:48,962 ERROR Model:3950] - An element of type memberConstraint with the id "GMC1" is already present in this model "model". The new element will not be added to the model. -[19:34:48,963 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:34:48,963 ERROR Model:3950] - An element of type group with the id "G1" is already present in this model "model". The new element will not be added to the model. -[19:34:49,732 ERROR ArraysSBasePlugin:702] - A Dimension with the id "dim" is already present in this species identified by id[]. The new element will not be added to the model. -[19:37:45,822 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[19:37:45,840 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[19:37:45,840 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[19:37:45,841 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[19:37:45,841 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:37:45,841 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[19:37:45,841 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:37:45,851 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[19:37:45,856 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:37:45,867 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[19:37:45,873 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:37:45,878 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[19:37:45,878 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[19:37:45,913 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:37:45,922 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[19:37:45,923 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[19:37:45,929 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:37:45,934 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:37:46,117 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[19:37:46,118 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[19:37:46,119 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[19:37:46,119 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[19:37:46,235 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[19:37:46,468 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:37:46,543 WARN Model:1120] - Could not create Product because no reactions have been defined yet. -[19:37:46,549 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[19:37:46,568 WARN Model:1012] - Could not create LocalParameter for KineticLaw because no reactions have been defined yet. -[19:37:46,574 WARN Model:1176] - Could not create Reactant because no reactions have been defined yet. -[19:37:46,775 WARN AbstractSBase:1635] - Trying to register curve 'curve', which is already registered under speciesReferenceGlyph 'speciesReferenceGlyph [id=glyph, reference=null]'. -[19:37:49,031 ERROR Model:3950] - An element of type objective with the id "O1" is already present in this model "model". The new element will not be added to the model. -[19:37:49,032 ERROR SBMLDocument:444] - An element with the metaid "FB1" is already present in the SBML document. The new element will not get added to it. -[19:37:49,032 ERROR SBMLDocument:444] - An element with the metaid "S2" is already present in the SBML document. The new element will not get added to it. -[19:37:49,198 ERROR Model:648] - A Port with the id "S3" is already present in this model model. The new element will not be added to the model. -[19:37:49,256 ERROR Model:648] - A Port with the id "S3" is already present in this model modelDef2. The new element will not be added to the model. -[19:37:49,257 ERROR Model:3950] - An element of type species with the id "S3" is already present in this model "modelDef2". The new element will not be added to the model. -[19:37:49,314 ERROR IdentifierException:75] - An element with the metaid "S1" is already present in the SBML document. The element replacedBy will not be annotated with it. -[19:37:49,385 WARN AbstractSBase:1639] - SBaseRef 'SBaseRef [portRef=S1, idRef=null, unitRef=null, metaIdRef=null]' is associated to the different parent 'c'. Please remove it there before adding it to this 'port' or add a clone of it to this element. -[19:37:49,389 ERROR ArraysSBasePlugin:702] - A Dimension with the id "AD1" is already present in this species identified by id[S1]. The new element will not be added to the model. -[19:37:49,389 ERROR ArraysSBasePlugin:702] - A Dimension with the id "AD2" is already present in this species identified by id[S1]. The new element will not be added to the model. -[19:37:49,390 ERROR IdentifierException:62] - An element with the id "AD2" is already present in the SBML model. The identifier of dimension will not be set to this value. -[19:37:49,390 WARN ArraysSBasePlugin:769] - A Dimension with the id "AD1" is not present in this model identified by id[model]. Nothing to be done. -[19:37:49,510 ERROR Model:3950] - An element of type group with the id "G1" is already present in this model "model". The new element will not be added to the model. -[19:37:49,511 ERROR IdentifierException:62] - An element with the id "G1" is already present in the SBML model. The identifier of group will not be set to this value. -[19:37:49,511 ERROR Model:3950] - An element of type member with the id "GM1" is already present in this model "model". The new element will not be added to the model. -[19:37:49,511 ERROR Model:3950] - An element of type memberConstraint with the id "GMC1" is already present in this model "model". The new element will not be added to the model. -[19:37:49,512 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[19:37:49,512 ERROR Model:3950] - An element of type group with the id "G1" is already present in this model "model". The new element will not be added to the model. -[19:37:50,018 ERROR ArraysSBasePlugin:702] - A Dimension with the id "dim" is already present in this species identified by id[]. The new element will not be added to the model. -[13:34:45,465 WARN ASTNode:4210] - Could not compile ASTNode to formula: cannot write unknown syntax tree nodes to a formula String -[13:34:45,720 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:45,727 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:45,844 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:45,861 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:47,213 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:49,671 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:49,678 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:49,741 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:49,744 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:51,906 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:51,908 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:51,969 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:51,988 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:52,885 ERROR SBMLDocument:444] - An element with the metaid "c0" is already present in the SBML document. The new element will not get added to it. -[13:34:52,893 ERROR Model:3950] - An element of type model with the id "model" is already present in this model "model". The new element will not be added to the model. -[13:34:52,899 ERROR Model:3950] - An element of type reaction with the id "R1" is already present in this model "model". The new element will not be added to the model. -[13:34:52,900 ERROR Model:3950] - An element of type speciesReference with the id "SP1" is already present in this model "model". The new element will not be added to the model. -[13:34:52,901 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[13:34:52,902 ERROR SBMLDocument:444] - An element with the metaid "SP1" is already present in the SBML document. The new element will not get added to it. -[13:34:52,902 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[13:34:52,916 ERROR SBMLDocument:444] - An element with the metaid "LP1" is already present in the SBML document. The new element will not get added to it. -[13:34:52,921 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[13:34:52,947 WARN AbstractSBase:1639] - Species 'S3' is associated to the different parent 'listOfSpecies'. Please remove it there before adding it to this 'model' or add a clone of it to this element. -[13:34:52,953 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[13:34:52,964 ERROR KineticLaw:753] - A local parameter with the id 'LP1' is already present in the listOfParameters. The new element will not be added to the list. -[13:34:52,966 ERROR KineticLaw:884] - The list of local parameters will not be set as some ids are duplicated. -[13:34:52,988 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[13:34:53,003 WARN Model:1647] - Some of the reactions containing the local parameter LP1 have no id defined! -[13:34:53,005 WARN Model:1647] - Some of the reactions containing the local parameter LP1_2 have no id defined! -[13:34:53,015 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[13:34:53,028 ERROR Model:3950] - An element of type species with the id "S1" is already present in this model "model". The new element will not be added to the model. -[13:34:53,512 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,513 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,535 WARN ASTNode:4210] - Could not compile ASTNode to formula: cannot write unknown syntax tree nodes to a formula String -[13:34:53,540 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,541 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,542 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,543 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,543 WARN MathMLXMLStreamCompiler:319] - !!!!! I don't know what to do with the node of type UNKNOWN ASTUnknown [] -[13:34:53,558 WARN ASTNode:4210] - Could not compile ASTNode to formula: cannot write unknown syntax tree nodes to a formula String -[13:34:53,563 WARN ASTNode:4210] - Could not compile ASTNode to formula: cannot write unknown syntax tree nodes to a formula String -[13:34:53,622 ERROR KineticLaw:753] - A local parameter with the id 'lp1' is already present in the listOfParameters. The new element will not be added to the list. -[13:34:53,652 ERROR Model:3950] - An element of type compartment with the id "c1" is already present in this model "myModel". The new element will not be added to the model. -[13:34:53,654 ERROR IdentifierException:62] - An element with the id "c1" is already present in the SBML model. The identifier of compartment will not be set to this value. -[13:34:53,656 WARN AbstractSBase:1635] - Trying to register compartment 'c1', which is already registered under listOfCompartments 'listOfCompartments'. -[13:34:53,741 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:53,749 WARN MathMLStaxParser:221] - processCharactersOf : !!!!!!!!! I don't know what to do with that : csymbol !!!!!!!!!! -[13:34:54,629 WARN Model:966] - Could not create KineticLaw because no reactions have been defined yet. -[13:34:55,239 WARN AbstractSBase:1639] - Trigger 'trigger' is associated to the different parent 'event'. Please remove it there before adding it to this 'event' or add a clone of it to this element. -[13:34:55,344 WARN ASTNode:4210] - Could not compile ASTNode to formula: cannot write unknown syntax tree nodes to a formula String -[13:34:55,349 WARN AbstractMathContainer:237] - Could not create infix formula from syntax tree. -org.sbml.jsbml.SBMLException: cannot write unknown syntax tree nodes to a formula String - at org.sbml.jsbml.util.compilers.FormulaCompiler.unknownValue(FormulaCompiler.java:1080) - at org.sbml.jsbml.ASTNode.compile(ASTNode.java:1970) - at org.sbml.jsbml.util.compilers.FormulaCompiler.checkBrackets(FormulaCompiler.java:445) - at org.sbml.jsbml.util.compilers.FormulaCompiler.plus(FormulaCompiler.java:930) - at org.sbml.jsbml.ASTNode.compile(ASTNode.java:1680) - at org.sbml.jsbml.ASTNode.toFormula(ASTNode.java:4140) - at org.sbml.jsb... [truncated message content] |
From: <nik...@us...> - 2015-04-21 14:25:19
|
Revision: 2200 http://sourceforge.net/p/jsbml/code/2200 Author: niko-rodrigue Date: 2015-04-21 14:25:17 +0000 (Tue, 21 Apr 2015) Log Message: ----------- corrected AnalyticVolume writeXMLAttributes. No need to write metaid and SBOTerm as they are in the sbml core namespace and written in AbstractSBase Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-21 14:21:45 UTC (rev 2199) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-21 14:25:17 UTC (rev 2200) @@ -415,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; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 14:21:47
|
Revision: 2199 http://sourceforge.net/p/jsbml/code/2199 Author: niko-rodrigue Date: 2015-04-21 14:21:45 +0000 (Tue, 21 Apr 2015) Log Message: ----------- corrected AnalyticVolume copy constructor to use setter Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-21 13:54:32 UTC (rev 2198) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-21 14:21:45 UTC (rev 2199) @@ -103,16 +103,16 @@ 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()) { - domainType = node.getDomainType(); + setDomainType(node.getDomainType()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-21 13:54:40
|
Revision: 2198 http://sourceforge.net/p/jsbml/code/2198 Author: pdp10 Date: 2015-04-21 13:54:32 +0000 (Tue, 21 Apr 2015) Log Message: ----------- Corrected compilation errors Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGeometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java trunk/extensions/spatial/test/org/sbml/jsbml/ext/spatial/SpatialTest.java Added Paths: ----------- trunk/src/ Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -105,9 +105,7 @@ } @Override - public AbstractSpatialNamedSBase clone() { - return new AbstractSpatialNamedSBase(this); - } + public abstract AbstractSpatialNamedSBase clone(); /** * Initializes the default values using the namespace. Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -67,9 +67,7 @@ } @Override - public AbstractSpatialSBasePlugin clone() { - return new AbstractSpatialSBasePlugin(this); - } + public abstract AbstractSpatialSBasePlugin clone(); /** * Initializes the default values using the namespace. Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -295,39 +295,6 @@ } return hashCode; } - - @Override - public Map<String, String> writeXMLAttributes() { - Map<String, String> attributes = super.writeXMLAttributes(); - if (isSetListOfAnalyticVolumes()) { - attributes.put(SpatialConstants.shortLabel + ":listOfAnalyticVolumes", getListOfAnalyticVolumes().toString()); - } - return attributes; - } - - @Override - public boolean readAttribute(String attributeName, String prefix, String value) { - boolean isAttributeRead = (super.readAttribute(attributeName, prefix, value)) - && (SpatialConstants.shortLabel == prefix); - if (!isAttributeRead) { - isAttributeRead = true; - if (attributeName.equals(SpatialConstants.listOfAnalyticVolumes)) { - try { - setListOfAnalyticVolumes(listOfAnalyticVolumes.valueOf(value)); - } catch (Exception e) { - MessageFormat.format( - SpatialConstants.bundle.getString("COULD_NOT_READ"), value, - SpatialConstants.listOfAnalyticVolumes); - } - } - else { - isAttributeRead = false; - } - } - return isAttributeRead; - } - - } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGeometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGeometry.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CSGeometry.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -90,17 +90,29 @@ } + /* (non-Javadoc) + * @see java.lang.Object#equals(java.lang.Object) + */ @Override - public boolean equals(Object object) { - boolean equal = super.equals(object); - if (equal) { - CSGeometry csg = (CSGeometry) object; - equal &= csg.isSetListOfCSGObjects() == isSetListOfCSGObjects(); - if (equal && isSetListOfCSGObjects()) { - equal &= csg.getListOfCSGObjects().equals(getListOfCSGObjects()); + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (!super.equals(obj)) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + CSGeometry other = (CSGeometry) obj; + if (listOfCSGObjects == null) { + if (other.listOfCSGObjects != null) { + return false; } + } else if (!listOfCSGObjects.equals(other.listOfCSGObjects)) { + return false; } - return equal; + return true; } @@ -258,17 +270,29 @@ return csgo; } - /** - * TODO: optionally, create additional create methods with more - * variables, for instance "bar" variable + /* (non-Javadoc) + * @see java.lang.Object#hashCode() */ - // public CSGObject createCSGObject(String id, int bar) { - // CSGObject csgo = createCSGObject(id); - // csgo.setBar(bar); - // return csgo; - // } - /** - * + @Override + public int hashCode() { + final int prime = 1301; + int result = super.hashCode(); + result = prime * result + + ((listOfCSGObjects == null) ? 0 : listOfCSGObjects.hashCode()); + return result; + } + + + /* (non-Javadoc) + * @see java.lang.Object#toString() */ - + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("CS [spatialId="); + builder.append(spatialId); + builder.append("]"); + return builder.toString(); + } + } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -225,21 +225,12 @@ /** * - * @return get compartment instance of {@link Compartment} class - */ - public Compartment getCompartmentInstance() { - Model m = getModel(); - return m != null ? m.getCompartment(getCompartment()) : null; - } - - /** - * * @return the domainType instance of the {@link DomainType} class */ public DomainType getDomainTypeInstance() { Model m = getModel(); if (m!=null) { - SpatialModelPlugin sm = (SpatialModelPlugin) m.getExtension(getCompartmentInstance().getElementName()); + SpatialModelPlugin sm = (SpatialModelPlugin) m.getExtension(packageName); sm.getGeometry().getListOfDomainTypes().get(getDomainType()); } return null; Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -454,10 +454,10 @@ hashCode += prime * getUnits().hashCode(); } if (isSetBoundaryMaximum()) { - hashCode += prime * getBoundaryMaximum()().hashCode(); + hashCode += prime * getBoundaryMaximum().hashCode(); } if (isSetBoundaryMinimum()) { - hashCode += prime * getBoundaryMinimum()().hashCode(); + hashCode += prime * getBoundaryMinimum().hashCode(); } return hashCode; } @@ -509,14 +509,6 @@ attributes.remove("unit"); attributes.put(SpatialConstants.shortLabel+":unit", getUnits()); } - if (isSetBoundaryMaximum()()) { - attributes.remove("boundaryMaximum"); - attributes.put(SpatialConstants.shortLabel+":boundaryMaximum", getBoundaryMaximum()()); - } - if (isSetBoundaryMinimum()()) { - attributes.remove("boundaryMinimum"); - attributes.put(SpatialConstants.shortLabel+":boundaryMinimum", getBoundaryMinimum()()); - } return attributes; } @@ -547,22 +539,6 @@ SpatialConstants.unit); } } - else if (attributeName.equals(SpatialConstants.boundaryMaximum)) { - try { - setBoundaryMaximum(value); - } catch (Exception e) { - MessageFormat.format(bundle.getString("COULD_NOT_READ"), value, - SpatialConstants.boundaryMaximum); - } - } - else if (attributeName.equals(SpatialConstants.boundaryMinimum)) { - try { - setBoundaryMinimum(value); - } catch (Exception e) { - MessageFormat.format(bundle.getString("COULD_NOT_READ"), value, - SpatialConstants.boundaryMinimum); - } - } else { isAttributeRead = false; } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -22,7 +22,6 @@ package org.sbml.jsbml.ext.spatial; import java.text.MessageFormat; -import java.util.Map; import org.sbml.jsbml.Compartment; import org.sbml.jsbml.ListOf; @@ -202,33 +201,6 @@ } @Override - public Map<String, String> writeXMLAttributes() { - Map<String, String> attributes = super.writeXMLAttributes(); - if (isSetCompartmentMapping()) { - attributes.remove("compartmentMapping"); - attributes.put(SpatialConstants.shortLabel + ":compartmentMapping", - getCompartmentMapping()); - } - return attributes; - } - - @Override - public boolean readAttribute(String attributeName, String prefix, String value) { - boolean isAttributeRead = (super.readAttribute(attributeName, prefix, value)) - && (SpatialConstants.shortLabel == prefix); - if (!isAttributeRead) { - isAttributeRead = true; - if (attributeName.equals(SpatialConstants.compartmentMapping)) { - setCompartmentMapping(value); - } - else { - isAttributeRead = false; - } - } - return isAttributeRead; - } - - @Override public int hashCode() { final int prime = 1259; int hashCode = super.hashCode(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -355,10 +355,6 @@ /** * */ - public static final String listOfAnalyticVolumes = "listOfAnalyticVolumes"; - /** - * - */ public static final String coordinateComponent = "coordinateComponent"; /** * Modified: trunk/extensions/spatial/test/org/sbml/jsbml/ext/spatial/SpatialTest.java =================================================================== --- trunk/extensions/spatial/test/org/sbml/jsbml/ext/spatial/SpatialTest.java 2015-04-21 13:25:49 UTC (rev 2197) +++ trunk/extensions/spatial/test/org/sbml/jsbml/ext/spatial/SpatialTest.java 2015-04-21 13:54:32 UTC (rev 2198) @@ -84,7 +84,6 @@ CompartmentMapping spatialCompMap = new CompartmentMapping(); spatialComp.setCompartmentMapping(spatialCompMap); - spatialCompMap.setCompartment("comp1"); spatialCompMap.setDomainType("DomainType1"); SBMLWriter.write(doc, System.out, ' ', (short) 2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-21 13:25:57
|
Revision: 2197 http://sourceforge.net/p/jsbml/code/2197 Author: pdp10 Date: 2015-04-21 13:25:49 +0000 (Tue, 21 Apr 2015) Log Message: ----------- update for 0.90 spatial specs Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateReference.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialNamedSBase.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -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,11 @@ this.spatialId = spatialId; } + @Override + public AbstractSpatialNamedSBase clone() { + return new AbstractSpatialNamedSBase(this); + } + /** * Initializes the default values using the namespace. */ Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AbstractSpatialSBasePlugin.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -31,6 +31,7 @@ /** * * @author Alex Thomas + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date Jan 22, 2014 @@ -65,6 +66,11 @@ initDefaults(); } + @Override + public AbstractSpatialSBasePlugin clone() { + return new AbstractSpatialSBasePlugin(this); + } + /** * Initializes the default values using the namespace. */ @@ -139,5 +145,10 @@ SBMLDocument doc = getSBMLDocument(); return doc != null ? doc.getModel() : null; } + + @Override + public String toString() { + return super.toString(); + } } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdvectionCoefficient.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -39,14 +39,13 @@ /** * Generated serial version identifier. */ - private static final long serialVersionUID = 8982184068116596444L; - + private static final long serialVersionUID = 8982184068116596444L; + /** * */ private CoordinateKind coordinate; - /** * */ Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticGeometry.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -24,6 +24,7 @@ import java.text.MessageFormat; import java.util.Collection; import java.util.List; +import java.util.Map; import javax.swing.tree.TreeNode; @@ -33,7 +34,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -283,5 +285,49 @@ } 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; + } + + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetListOfAnalyticVolumes()) { + attributes.put(SpatialConstants.shortLabel + ":listOfAnalyticVolumes", getListOfAnalyticVolumes().toString()); + } + return attributes; + } + + + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = (super.readAttribute(attributeName, prefix, value)) + && (SpatialConstants.shortLabel == prefix); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(SpatialConstants.listOfAnalyticVolumes)) { + try { + setListOfAnalyticVolumes(listOfAnalyticVolumes.valueOf(value)); + } catch (Exception e) { + MessageFormat.format( + SpatialConstants.bundle.getString("COULD_NOT_READ"), value, + SpatialConstants.listOfAnalyticVolumes); + } + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + + } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AnalyticVolume.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -35,7 +35,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -110,6 +111,9 @@ if (node.isSetFunctionType()) { functionType = node.getFunctionType(); } + if (node.isSetDomainType()) { + domainType = node.getDomainType(); + } } /** @@ -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(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateComponent.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -37,7 +37,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -451,7 +452,13 @@ } if (isSetUnits()) { hashCode += prime * getUnits().hashCode(); - } + } + if (isSetBoundaryMaximum()) { + hashCode += prime * getBoundaryMaximum()().hashCode(); + } + if (isSetBoundaryMinimum()) { + hashCode += prime * getBoundaryMinimum()().hashCode(); + } return hashCode; } @@ -502,6 +509,14 @@ attributes.remove("unit"); attributes.put(SpatialConstants.shortLabel+":unit", getUnits()); } + if (isSetBoundaryMaximum()()) { + attributes.remove("boundaryMaximum"); + attributes.put(SpatialConstants.shortLabel+":boundaryMaximum", getBoundaryMaximum()()); + } + if (isSetBoundaryMinimum()()) { + attributes.remove("boundaryMinimum"); + attributes.put(SpatialConstants.shortLabel+":boundaryMinimum", getBoundaryMinimum()()); + } return attributes; } @@ -532,6 +547,22 @@ SpatialConstants.unit); } } + else if (attributeName.equals(SpatialConstants.boundaryMaximum)) { + try { + setBoundaryMaximum(value); + } catch (Exception e) { + MessageFormat.format(bundle.getString("COULD_NOT_READ"), value, + SpatialConstants.boundaryMaximum); + } + } + else if (attributeName.equals(SpatialConstants.boundaryMinimum)) { + try { + setBoundaryMinimum(value); + } catch (Exception e) { + MessageFormat.format(bundle.getString("COULD_NOT_READ"), value, + SpatialConstants.boundaryMinimum); + } + } else { isAttributeRead = false; } Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateReference.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateReference.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CoordinateReference.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -32,6 +32,7 @@ /** * @author Alex Thomas * @author Andreas Dräger + * @author Piero Dalle Pezze * @version $Rev$ * @since 1.0 * @date 09.09.2011 @@ -121,7 +122,7 @@ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1373;//Changed, it was 983 int hashCode = super.hashCode(); if (isSetCoordinate()) { hashCode += prime * getCoordinate().hashCode(); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/ParameterType.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -60,7 +60,7 @@ /** * Refers to species object that the parameter is associated with */ - private String speciesRef; + private String speciesRef; // TODO Check whether this is the correct name. /** * Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-21 13:15:20 UTC (rev 2196) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialConstants.java 2015-04-21 13:25:49 UTC (rev 2197) @@ -352,10 +352,13 @@ * */ public static final String listOfGeometryDefinitions = "listOfGeometryDefinitions"; - /** * */ + public static final String listOfAnalyticVolumes = "listOfAnalyticVolumes"; + /** + * + */ public static final String coordinateComponent = "coordinateComponent"; /** * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 13:15:22
|
Revision: 2196 http://sourceforge.net/p/jsbml/code/2196 Author: niko-rodrigue Date: 2015-04-21 13:15:20 +0000 (Tue, 21 Apr 2015) Log Message: ----------- corrected FormulaParserLL3.jj so that we have the same behavior as before + removed the files related to merging problems Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserLL3.jj Removed Paths: ------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.mine branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.r2129 branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.r2142 branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj.mine branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj.r2129 branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj.r2142 branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java.mine branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java.r2129 branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java.r2142 Deleted: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.mine =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.mine 2015-04-21 13:07:56 UTC (rev 2195) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.mine 2015-04-21 13:15:20 UTC (rev 2196) @@ -1,1213 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. FormulaParser.java */ -/* - * $Id: FormulaParser.java 2142 2015-03-16 15:34:34Z niko-rodrigue $ - * $URL: svn://svn.code.sf.net/p/jsbml/code/trunk/core/src/org/sbml/jsbml/text/parser/FormulaParser.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-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.text.parser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.InvalidPropertiesFormatException; -import java.util.Properties; -import org.sbml.jsbml.ASTNode; -import org.sbml.jsbml.ASTNode.Type; -import org.sbml.jsbml.resources.Resource; - -/** - * Class used to parse infix mathematical formula and returns a representation of it as an Abstract Syntax Tree (AST). - * <p> - * Support almost the same syntax as defined in <a href="http://sbml.org/Software/libSBML/docs/java-api/org/sbml/libsbml/libsbml.html#parseFormula(java.lang.String)"> - * the LibSBML C-inspired infix notation taken from SBML Level 1 parser</a>. - * - * @author Alexander Dörr - * @author Nicolas Rodriguez - * @since 0.8 - * @version $Rev: 2142 $ - */ -public class FormulaParser implements IFormulaParser, FormulaParserConstants { - public static Properties stringToType = new Properties(); - - static - { - String path = "cfg/ASTNodeTokens.xml"; - try - { - stringToType.loadFromXML(Resource.class.getResourceAsStream(path)); - } - catch (InvalidPropertiesFormatException e) - { - throw new RuntimeException("Invalid configuration file entries in file " + Resource.class.getResource(path), e); - } - catch (IOException e) - { - throw new RuntimeException("Could not read configuration file " + Resource.class.getResource(path), e); - } - } - - private void checkSize(ArrayList < ASTNode > arguments, int i) throws ParseException - { - if (arguments.size() > i) - { - throw new ParseException(); - } - } - - private Integer getInteger(ASTNode node) - { - if (node.isUMinus()) - { - if (node.getChild(0).isInteger()) - { - return - node.getChild(0).getInteger(); - } - else - { - return null; - } - } - else - { - if (node.isInteger()) - { - return node.getInteger(); - } - else - { - return null; - } - } - } - - /** - * Returns a piecewise {@link ASTNode} representing the modulo operation between the left and right child given. - * - * <p/> The formula produced for 'a % b' or modulo(a, b) is 'piecewise(floor(a/b), gt(a/b, 0), ceil(a/b))' - * - * @param leftChild - * @param rightChild - * @return a piecewise {@link ASTNode} representing the modulo operation between the left and right child given. - * @see http://sbml.org/Documents/FAQ#Why_can.27t_I_use_the_.3Crem.3E_operator_in_SBML_MathML.3F - */ - private ASTNode createModulo(ASTNode leftChild, ASTNode rightChild) - { - ASTNode node = new ASTNode(ASTNode.Type.FUNCTION_PIECEWISE); - - ASTNode floorNode = new ASTNode(ASTNode.Type.FUNCTION_FLOOR); - ASTNode aDividedByB = new ASTNode(ASTNode.Type.DIVIDE); - aDividedByB.addChild(leftChild); - aDividedByB.addChild(rightChild); - - floorNode.addChild(aDividedByB); - node.addChild(floorNode); - - ASTNode greaterThan = new ASTNode(ASTNode.Type.RELATIONAL_GT); - greaterThan.addChild(aDividedByB.clone()); - greaterThan.addChild(new ASTNode(0)); - - node.addChild(greaterThan); - - ASTNode ceilNode = new ASTNode(ASTNode.Type.FUNCTION_CEILING); - ceilNode.addChild(aDividedByB.clone()); - - node.addChild(ceilNode); - - return node; - } - - final public Token string() throws ParseException { - Token t; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LOG: - t = jj_consume_token(LOG); - break; - case STRING: - t = jj_consume_token(STRING); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return t;} - throw new Error("Missing return statement in function"); - } - - final public ASTNode parse() throws ParseException { - ASTNode node = null; - node = Expression(); - {if (true) return node;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode Expression() throws ParseException { - ASTNode value = null; - value = TermLvl1(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 0: - jj_consume_token(0); - break; - case EOL: - jj_consume_token(EOL); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return value;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode TermLvl3() throws ParseException { - ASTNode rightChild; - ASTNode leftChild; - ASTNode node = null; - leftChild = Primary(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case POWER: - case FACTORIAL: - ; - break; - default: - jj_la1[2] = jj_gen; - break label_1; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case POWER: - jj_consume_token(POWER); - rightChild = Primary(); - node = new ASTNode(Type.POWER); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case FACTORIAL: - jj_consume_token(FACTORIAL); - node = new ASTNode(Type.FUNCTION_FACTORIAL); - node.addChild(leftChild); - leftChild = node; - break; - default: - jj_la1[3] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return leftChild;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode TermLvl2() throws ParseException { - ASTNode rightChild; - ASTNode leftChild; - ASTNode node = null; - Token t; - Type type = null; - leftChild = TermLvl3(); - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - case DIVIDE: - case MODULO: - case COMPARISON: - ; - break; - default: - jj_la1[4] = jj_gen; - break label_2; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - jj_consume_token(TIMES); - rightChild = TermLvl3(); - node = new ASTNode('*'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case DIVIDE: - jj_consume_token(DIVIDE); - rightChild = TermLvl3(); - Integer left, right; - left = getInteger(leftChild); - right = getInteger(rightChild); - if (left != null && right != null) - { - node = new ASTNode(Type.RATIONAL); - node.setValue(left, right); - leftChild = node; - } - else - { - node = new ASTNode('/'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - } - break; - case MODULO: - jj_consume_token(MODULO); - rightChild = TermLvl3(); - node = createModulo(leftChild, rightChild); - leftChild = node; - break; - case COMPARISON: - t = jj_consume_token(COMPARISON); - rightChild = TermLvl3(); - type = Type.getTypeFor(t.image); - node = new ASTNode(type); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return leftChild;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode TermLvl1() throws ParseException { - ASTNode rightChild = null; - ASTNode leftChild; - ASTNode node = null; - Token t; - Type type = null; - leftChild = TermLvl2(); - label_3: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - case MINUS: - case BOOLEAN_LOGIC: - ; - break; - default: - jj_la1[6] = jj_gen; - break label_3; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - rightChild = TermLvl2(); - node = new ASTNode('+'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case MINUS: - jj_consume_token(MINUS); - rightChild = TermLvl2(); - node = new ASTNode('-'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case BOOLEAN_LOGIC: - t = jj_consume_token(BOOLEAN_LOGIC); - rightChild = TermLvl2(); - type = Type.getTypeFor(t.image); - node = new ASTNode(type); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return leftChild;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode Primary() throws ParseException, NumberFormatException { - Token t; - double d; - int i; - ASTNode node = null; - ASTNode vector = new ASTNode(); - ASTNode child, furtherChild; - String s; - String vals [ ]; - ArrayList < ASTNode > arguments = new ArrayList < ASTNode > (); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER: - t = jj_consume_token(INTEGER); - i = Integer.parseInt(t.image); - node = new ASTNode(Type.INTEGER); - node.setValue(i); - {if (true) return node;} - break; - case NUMBER: - t = jj_consume_token(NUMBER); - d = Double.parseDouble(t.image); - node = new ASTNode(Type.REAL); - node.setValue(d); - {if (true) return node;} - break; - case EXPNUMBER: - t = jj_consume_token(EXPNUMBER); - s = t.image; - vals = s.toLowerCase().split("e"); - if (vals [ 1 ].startsWith("+")) - { - i = Integer.parseInt(vals [ 1 ].substring(1)); - } - else - { - i = Integer.parseInt(vals [ 1 ]); - } - node = new ASTNode(Type.REAL_E); - node.setValue(Double.parseDouble(vals [ 0 ]), i); - {if (true) return node;} - break; - default: - jj_la1[12] = jj_gen; - if (jj_2_1(2)) { - t = string(); - jj_consume_token(OPEN_PAR); - child = TermLvl1(); - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SLPITTER: - ; - break; - default: - jj_la1[8] = jj_gen; - break label_4; - } - jj_consume_token(SLPITTER); - furtherChild = TermLvl1(); - arguments.add(furtherChild); - } - jj_consume_token(CLOSE_PAR); - s = t.image; - Type type = null; - - if (stringToType.containsKey(s.toLowerCase())) - { - type = ASTNode.Type.valueOf(stringToType.getProperty(s.toLowerCase()).toUpperCase()); - } - if (s.equalsIgnoreCase("abs")) - { - type = Type.FUNCTION_ABS; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("factorial")) - { - checkSize(arguments, 1); - type = Type.FUNCTION_FACTORIAL; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("eq")) - { - checkSize(arguments, 1); - type = Type.VECTOR; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("pow")) - { - checkSize(arguments, 1); - type = Type.FUNCTION_POWER; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("sqr")) - { - checkSize(arguments, 0); - type = Type.FUNCTION_EXP; - node = new ASTNode(type); - node.addChild(child); - node.addChild(new ASTNode(2)); - } - else if (s.equalsIgnoreCase("sqrt")) - { - checkSize(arguments, 0); - type = Type.FUNCTION_ROOT; - node = new ASTNode(type); - node.addChild(new ASTNode(2)); - node.addChild(child); - } - else if (s.equalsIgnoreCase("not")) - { - checkSize(arguments, 0); - type = Type.LOGICAL_NOT; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("ln")) - { - checkSize(arguments, 0); - type = Type.FUNCTION_LN; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("lt")) - { - checkSize(arguments, 0); - type = Type.RELATIONAL_LT; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("lambda")) - { - type = Type.LAMBDA; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("piecewise")) - { - type = Type.FUNCTION_PIECEWISE; - node = new ASTNode(type); - node.addChild(child); - } - else if (s.equalsIgnoreCase("selector")) - { - type = Type.FUNCTION_SELECTOR; - node = new ASTNode(type); - node.addChild(child); - } - else - { - node = new ASTNode(Type.FUNCTION); - node.addChild(child); - } - - if (type == null) - { - node = new ASTNode(); - node.setName(s); - } - for (ASTNode argument : arguments) - { - node.addChild(argument); - } - {if (true) return node;} - } else if (jj_2_2(4)) { - t = jj_consume_token(STRING); - ASTNode selector = new ASTNode(); - selector.setType(ASTNode.Type.FUNCTION_SELECTOR); - selector.addChild(new ASTNode(t.image)); - label_5: - while (true) { - jj_consume_token(LEFT_BRACKET); - node = TermLvl1(); - selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[9] = jj_gen; - break label_5; - } - } - {if (true) return selector;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case OPEN_PAR: - jj_consume_token(OPEN_PAR); - node = TermLvl1(); - jj_consume_token(CLOSE_PAR); - {if (true) return node;} - break; - default: - jj_la1[13] = jj_gen; - if (jj_2_3(2)) { - jj_consume_token(LEFT_BRACES); - node = TermLvl1(); - ASTNode selector = new ASTNode(); - boolean isSelector = false; - selector.setType(ASTNode.Type.FUNCTION_SELECTOR); - vector.setType(ASTNode.Type.VECTOR); - vector.addChild(node); - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SLPITTER: - ; - break; - default: - jj_la1[10] = jj_gen; - break label_6; - } - jj_consume_token(SLPITTER); - node = TermLvl1(); - vector.addChild(node); - } - jj_consume_token(RIGHT_BRACES); - selector.addChild(vector); - label_7: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[11] = jj_gen; - break label_7; - } - jj_consume_token(LEFT_BRACKET); - node = TermLvl1(); - isSelector = true; - selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - } - {if (true) return isSelector ? selector : vector;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACES: - jj_consume_token(LEFT_BRACES); - vector.setType(ASTNode.Type.VECTOR); - jj_consume_token(RIGHT_BRACES); - {if (true) return vector;} - break; - case MINUS: - jj_consume_token(MINUS); - node = Primary(); - ASTNode uiMinus = new ASTNode('-'); - uiMinus.addChild(node); - {if (true) return uiMinus;} - break; - case NOT: - jj_consume_token(NOT); - node = TermLvl1(); - ASTNode not = new ASTNode(Type.LOGICAL_NOT); - not.addChild(node); - {if (true) return not;} - break; - case LOG: - jj_consume_token(LOG); - child = Primary(); - node = new ASTNode(Type.FUNCTION_LN); - node.addChild(child); - {if (true) return node;} - break; - case STRING: - t = jj_consume_token(STRING); - s = t.image; - if (s.equalsIgnoreCase("true")) - { - node = new ASTNode(Type.CONSTANT_TRUE); - } - else if (s.equalsIgnoreCase("false")) - { - node = new ASTNode(Type.CONSTANT_FALSE); - } - else if (s.equalsIgnoreCase("pi")) - { - node = new ASTNode(Type.CONSTANT_PI); - } - else if (s.equalsIgnoreCase("avogadro")) - { - node = new ASTNode(Type.NAME_AVOGADRO); - } - else if (s.equalsIgnoreCase("time")) - { - node = new ASTNode(Type.NAME_TIME); - } - else if (s.equalsIgnoreCase("exponentiale")) - { - node = new ASTNode(Type.CONSTANT_E); - } - else if (s.equalsIgnoreCase("-infinity")) - { - node = new ASTNode(Double.NEGATIVE_INFINITY); - } - else if (s.equalsIgnoreCase("infinity")) - { - node = new ASTNode(Double.POSITIVE_INFINITY); - } - else - { - node = new ASTNode(s); - } - {if (true) return node;} - break; - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } - } - throw new Error("Missing return statement in function"); - } - - private boolean jj_2_1(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_1(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(0, xla); } - } - - private boolean jj_2_2(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_2(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(1, xla); } - } - - private boolean jj_2_3(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_3(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(2, xla); } - } - - private boolean jj_3R_13() { - if (jj_3R_18()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_19()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_8() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(27)) { - jj_scanpos = xsp; - if (jj_scan_token(28)) return true; - } - return false; - } - - private boolean jj_3R_12() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_15()) { - jj_scanpos = xsp; - if (jj_3R_16()) { - jj_scanpos = xsp; - if (jj_3R_17()) return true; - } - } - return false; - } - - private boolean jj_3R_15() { - if (jj_scan_token(PLUS)) return true; - return false; - } - - private boolean jj_3R_25() { - if (jj_scan_token(NUMBER)) return true; - return false; - } - - private boolean jj_3R_28() { - if (jj_scan_token(LEFT_BRACES)) return true; - if (jj_scan_token(RIGHT_BRACES)) return true; - return false; - } - - private boolean jj_3R_21() { - if (jj_scan_token(DIVIDE)) return true; - return false; - } - - private boolean jj_3_2() { - if (jj_scan_token(STRING)) return true; - Token xsp; - if (jj_3R_9()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_9()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_10() { - if (jj_3R_11()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_12()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_24() { - if (jj_scan_token(INTEGER)) return true; - return false; - } - - private boolean jj_3R_18() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_24()) { - jj_scanpos = xsp; - if (jj_3R_25()) { - jj_scanpos = xsp; - if (jj_3R_26()) { - jj_scanpos = xsp; - if (jj_3_1()) { - jj_scanpos = xsp; - if (jj_3_2()) { - jj_scanpos = xsp; - if (jj_3R_27()) { - jj_scanpos = xsp; - if (jj_3_3()) { - jj_scanpos = xsp; - if (jj_3R_28()) { - jj_scanpos = xsp; - if (jj_3R_29()) { - jj_scanpos = xsp; - if (jj_3R_30()) { - jj_scanpos = xsp; - if (jj_3R_31()) { - jj_scanpos = xsp; - if (jj_3R_32()) return true; - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_9() { - if (jj_scan_token(LEFT_BRACKET)) return true; - if (jj_3R_10()) return true; - if (jj_scan_token(RIGHT_BRACKET)) return true; - return false; - } - - private boolean jj_3R_14() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_20()) { - jj_scanpos = xsp; - if (jj_3R_21()) { - jj_scanpos = xsp; - if (jj_3R_22()) { - jj_scanpos = xsp; - if (jj_3R_23()) return true; - } - } - } - return false; - } - - private boolean jj_3R_20() { - if (jj_scan_token(TIMES)) return true; - return false; - } - - private boolean jj_3R_11() { - if (jj_3R_13()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_14()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_32() { - if (jj_scan_token(STRING)) return true; - return false; - } - - private boolean jj_3R_23() { - if (jj_scan_token(COMPARISON)) return true; - return false; - } - - private boolean jj_3_1() { - if (jj_3R_8()) return true; - if (jj_scan_token(OPEN_PAR)) return true; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(LOG)) return true; - if (jj_3R_18()) return true; - return false; - } - - private boolean jj_3_3() { - if (jj_scan_token(LEFT_BRACES)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_22() { - if (jj_scan_token(MODULO)) return true; - return false; - } - - private boolean jj_3R_34() { - if (jj_scan_token(FACTORIAL)) return true; - return false; - } - - private boolean jj_3R_17() { - if (jj_scan_token(BOOLEAN_LOGIC)) return true; - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(NOT)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_27() { - if (jj_scan_token(OPEN_PAR)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_scan_token(POWER)) return true; - return false; - } - - private boolean jj_3R_19() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_33()) { - jj_scanpos = xsp; - if (jj_3R_34()) return true; - } - return false; - } - - private boolean jj_3R_29() { - if (jj_scan_token(MINUS)) return true; - if (jj_3R_18()) return true; - return false; - } - - private boolean jj_3R_16() { - if (jj_scan_token(MINUS)) return true; - return false; - } - - private boolean jj_3R_26() { - if (jj_scan_token(EXPNUMBER)) return true; - return false; - } - - /** Generated Token Manager. */ - public FormulaParserTokenManager token_source; - SimpleCharStream jj_input_stream; - /** Current token. */ - public Token token; - /** Next token. */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[15]; - static private int[] jj_la1_0; - static { - jj_la1_init_0(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x18000000,0x80000001,0x4200,0x4200,0x203800,0x203800,0x400500,0x400500,0x80,0x80000,0x80,0x80000,0x68,0x8000,0x1c020400,}; - } - final private JJCalls[] jj_2_rtns = new JJCalls[3]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** Constructor with InputStream. */ - public FormulaParser(java.io.InputStream stream) { - this(stream, null); - } - /** Constructor with InputStream and supplied encoding */ - public FormulaParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new FormulaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream, String encoding) { - try { jj_input_stream.ReInit(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor. */ - public FormulaParser(java.io.Reader stream) { - jj_input_stream = new SimpleCharStream(stream, 1, 1); - token_source = new FormulaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.Reader stream) { - jj_input_stream.ReInit(stream, 1, 1); - token_source.ReInit(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Constructor with generated Token Manager. */ - public FormulaParser(FormulaParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(FormulaParserTokenManager tm) { - token_source = tm; - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - private Token jj_consume_token(int kind) throws ParseException { - Token oldToken; - if ((oldToken = token).next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - if (token.kind == kind) { - jj_gen++; - if (++jj_gc > 100) { - jj_gc = 0; - for (int i = 0; i < jj_2_rtns.length; i++) { - JJCalls c = jj_2_rtns[i]; - while (c != null) { - if (c.gen < jj_gen) c.first = null; - c = c.next; - } - } - } - return token; - } - token = oldToken; - jj_kind = kind; - throw generateParseException(); - } - - static private final class LookaheadSuccess extends java.lang.Error { } - final private LookaheadSuccess jj_ls = new LookaheadSuccess(); - private boolean jj_scan_token(int kind) { - if (jj_scanpos == jj_lastpos) { - jj_la--; - if (jj_scanpos.next == null) { - jj_lastpos = jj_scanpos = jj_scanpos.next = token_source.getNextToken(); - } else { - jj_lastpos = jj_scanpos = jj_scanpos.next; - } - } else { - jj_scanpos = jj_scanpos.next; - } - if (jj_rescan) { - int i = 0; Token tok = token; - while (tok != null && tok != jj_scanpos) { i++; tok = tok.next; } - if (tok != null) jj_add_error_token(kind, i); - } - if (jj_scanpos.kind != kind) return true; - if (jj_la == 0 && jj_scanpos == jj_lastpos) throw jj_ls; - return false; - } - - -/** Get the next Token. */ - final public Token getNextToken() { - if (token.next != null) token = token.next; - else token = token.next = token_source.getNextToken(); - jj_ntk = -1; - jj_gen++; - return token; - } - -/** Get the specific Token. */ - final public Token getToken(int index) { - Token t = token; - for (int i = 0; i < index; i++) { - if (t.next != null) t = t.next; - else t = t.next = token_source.getNextToken(); - } - return t; - } - - private int jj_ntk() { - if ((jj_nt=token.next) == null) - return (jj_ntk = (token.next=token_source.getNextToken()).kind); - else - return (jj_ntk = jj_nt.kind); - } - - private java.util.List<int[]> jj_expentries = new java.util.ArrayList<int[]>(); - private int[] jj_expentry; - private int jj_kind = -1; - private int[] jj_lasttokens = new int[100]; - private int jj_endpos; - - private void jj_add_error_token(int kind, int pos) { - if (pos >= 100) return; - if (pos == jj_endpos + 1) { - jj_lasttokens[jj_endpos++] = kind; - } else if (jj_endpos != 0) { - jj_expentry = new int[jj_endpos]; - for (int i = 0; i < jj_endpos; i++) { - jj_expentry[i] = jj_lasttokens[i]; - } - jj_entries_loop: for (java.util.Iterator<?> it = jj_expentries.iterator(); it.hasNext();) { - int[] oldentry = (int[])(it.next()); - if (oldentry.length == jj_expentry.length) { - for (int i = 0; i < jj_expentry.length; i++) { - if (oldentry[i] != jj_expentry[i]) { - continue jj_entries_loop; - } - } - jj_expentries.add(jj_expentry); - break jj_entries_loop; - } - } - if (pos != 0) jj_lasttokens[(jj_endpos = pos) - 1] = kind; - } - } - - /** Generate ParseException. */ - public ParseException generateParseException() { - jj_expentries.clear(); - boolean[] la1tokens = new boolean[32]; - if (jj_kind >= 0) { - la1tokens[jj_kind] = true; - jj_kind = -1; - } - for (int i = 0; i < 15; i++) { - if (jj_la1[i] == jj_gen) { - for (int j = 0; j < 32; j++) { - if ((jj_la1_0[i] & (1<<j)) != 0) { - la1tokens[j] = true; - } - } - } - } - for (int i = 0; i < 32; i++) { - if (la1tokens[i]) { - jj_expentry = new int[1]; - jj_expentry[0] = i; - jj_expentries.add(jj_expentry); - } - } - jj_endpos = 0; - jj_rescan_token(); - jj_add_error_token(0, 0); - int[][] exptokseq = new int[jj_expentries.size()][]; - for (int i = 0; i < jj_expentries.size(); i++) { - exptokseq[i] = jj_expentries.get(i); - } - return new ParseException(token, exptokseq, tokenImage); - } - - /** Enable tracing. */ - final public void enable_tracing() { - } - - /** Disable tracing. */ - final public void disable_tracing() { - } - - private void jj_rescan_token() { - jj_rescan = true; - for (int i = 0; i < 3; i++) { - try { - JJCalls p = jj_2_rtns[i]; - do { - if (p.gen > jj_gen) { - jj_la = p.arg; jj_lastpos = jj_scanpos = p.first; - switch (i) { - case 0: jj_3_1(); break; - case 1: jj_3_2(); break; - case 2: jj_3_3(); break; - } - } - p = p.next; - } while (p != null); - } catch(LookaheadSuccess ls) { } - } - jj_rescan = false; - } - - private void jj_save(int index, int xla) { - JJCalls p = jj_2_rtns[index]; - while (p.gen > jj_gen) { - if (p.next == null) { p = p.next = new JJCalls(); break; } - p = p.next; - } - p.gen = jj_gen + xla - jj_la; p.first = token; p.arg = xla; - } - - static final class JJCalls { - int gen; - Token first; - int arg; - JJCalls next; - } - -} Deleted: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.r2129 =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.r2129 2015-04-21 13:07:56 UTC (rev 2195) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java.r2129 2015-04-21 13:15:20 UTC (rev 2196) @@ -1,1154 +0,0 @@ -/* Generated By:JavaCC: Do not edit this line. FormulaParser.java */ -/* - * $Id: FormulaParser.java 2142 2015-03-16 15:34:34Z niko-rodrigue $ - * $URL: svn://svn.code.sf.net/p/jsbml/code/trunk/core/src/org/sbml/jsbml/text/parser/FormulaParser.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-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.text.parser; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.InvalidPropertiesFormatException; -import java.util.Properties; -import org.sbml.jsbml.ASTNode; -import org.sbml.jsbml.ASTNode.Type; -import org.sbml.jsbml.resources.Resource; - -/** - * Class used to parse infix mathematical formula and returns a representation of it as an Abstract Syntax Tree (AST). - * <p> - * Support almost the same syntax as defined in <a href="http://sbml.org/Software/libSBML/docs/java-api/org/sbml/libsbml/libsbml.html#parseFormula(java.lang.String)"> - * the LibSBML C-inspired infix notation taken from SBML Level 1 parser</a>. - * - * @author Alexander Dörr - * @author Nicolas Rodriguez - * @since 0.8 - * @version $Rev: 2142 $ - */ -public class FormulaParser implements IFormulaParser, FormulaParserConstants { - public static Properties stringToType = new Properties(); - - static - { - String path = "cfg/ASTNodeTokens.xml"; - try - { - stringToType.loadFromXML(Resource.class.getResourceAsStream(path)); - } - catch (InvalidPropertiesFormatException e) - { - throw new RuntimeException("Invalid configuration file entries in file " + Resource.class.getResource(path), e); - } - catch (IOException e) - { - throw new RuntimeException("Could not read configuration file " + Resource.class.getResource(path), e); - } - } - - private void checkSize(ArrayList < ASTNode > arguments, int i) throws ParseException - { - if (arguments.size() > i) - { - throw new ParseException(); - } - } - - private Integer getInteger(ASTNode node) - { - if (node.isUMinus()) - { - if (node.getChild(0).isInteger()) - { - return - node.getChild(0).getInteger(); - } - else - { - return null; - } - } - else - { - if (node.isInteger()) - { - return node.getInteger(); - } - else - { - return null; - } - } - } - - final public Token string() throws ParseException { - Token t; - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LOG: - t = jj_consume_token(LOG); - break; - case STRING: - t = jj_consume_token(STRING); - break; - default: - jj_la1[0] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return t;} - throw new Error("Missing return statement in function"); - } - - final public ASTNode parse() throws ParseException { - ASTNode node = null; - node = Expression(); - {if (true) return node;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode Expression() throws ParseException { - ASTNode value = null; - value = TermLvl1(); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case 0: - jj_consume_token(0); - break; - case EOL: - jj_consume_token(EOL); - break; - default: - jj_la1[1] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - {if (true) return value;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode TermLvl3() throws ParseException { - ASTNode rightChild; - ASTNode leftChild; - ASTNode node = null; - leftChild = Primary(); - label_1: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case POWER: - case FACTORIAL: - ; - break; - default: - jj_la1[2] = jj_gen; - break label_1; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case POWER: - jj_consume_token(POWER); - rightChild = Primary(); - node = new ASTNode(Type.POWER); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case FACTORIAL: - jj_consume_token(FACTORIAL); - node = new ASTNode(Type.FUNCTION_FACTORIAL); - node.addChild(leftChild); - leftChild = node; - break; - default: - jj_la1[3] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return leftChild;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode TermLvl2() throws ParseException { - ASTNode rightChild; - ASTNode leftChild; - ASTNode node = null; - leftChild = TermLvl3(); - label_2: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - case DIVIDE: - ; - break; - default: - jj_la1[4] = jj_gen; - break label_2; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case TIMES: - jj_consume_token(TIMES); - rightChild = TermLvl3(); - node = new ASTNode('*'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case DIVIDE: - jj_consume_token(DIVIDE); - rightChild = TermLvl3(); - Integer left, right; - left = getInteger(leftChild); - right = getInteger(rightChild); - if (left != null && right != null) - { - node = new ASTNode(); - node.setValue(left, right); - leftChild = node; - } - else - { - node = new ASTNode('/'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - } - break; - default: - jj_la1[5] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return leftChild;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode TermLvl1() throws ParseException { - ASTNode rightChild = null; - ASTNode leftChild; - ASTNode node = null; - Token t; - String s; - Type type = null; - leftChild = TermLvl2(); - label_3: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - case MINUS: - case COMPARISON: - case BOOLEAN_LOGIC: - ; - break; - default: - jj_la1[6] = jj_gen; - break label_3; - } - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case PLUS: - jj_consume_token(PLUS); - rightChild = TermLvl2(); - node = new ASTNode('+'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case MINUS: - jj_consume_token(MINUS); - rightChild = TermLvl2(); - node = new ASTNode('-'); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case BOOLEAN_LOGIC: - t = jj_consume_token(BOOLEAN_LOGIC); - rightChild = TermLvl2(); - s = t.image; - if (s.equalsIgnoreCase("or")) - { - type = ASTNode.Type.LOGICAL_OR; - } - else if (s.equalsIgnoreCase("and")) - { - type = ASTNode.Type.LOGICAL_AND; - } - else if (s.equalsIgnoreCase("xor")) - { - type = ASTNode.Type.LOGICAL_XOR; - } - node = new ASTNode(type); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - case COMPARISON: - t = jj_consume_token(COMPARISON); - rightChild = TermLvl2(); - s = t.image; - if (s.equalsIgnoreCase("<")) - { - type = ASTNode.Type.RELATIONAL_LT; - } - else if (s.equalsIgnoreCase(">")) - { - type = ASTNode.Type.RELATIONAL_GT; - } - else if (s.equalsIgnoreCase("==")) - { - type = ASTNode.Type.RELATIONAL_EQ; - } - else if (s.equalsIgnoreCase("!=")) - { - type = ASTNode.Type.RELATIONAL_NEQ; - } - else if (s.equalsIgnoreCase(">=")) - { - type = ASTNode.Type.RELATIONAL_GEQ; - } - else if (s.equalsIgnoreCase("<=")) - { - type = ASTNode.Type.RELATIONAL_LEQ; - } - node = new ASTNode(type); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; - default: - jj_la1[7] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - {if (true) return leftChild;} - throw new Error("Missing return statement in function"); - } - - final private ASTNode Primary() throws ParseException, NumberFormatException { - Token t; - double d; - int i; - ASTNode node = new ASTNode(); - ASTNode vector = new ASTNode(); - ASTNode child, furtherChild; - String s; - String vals [ ]; - ArrayList < ASTNode > arguments = new ArrayList < ASTNode > (); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case INTEGER: - t = jj_consume_token(INTEGER); - i = Integer.parseInt(t.image); - node.setValue(i); - {if (true) return node;} - break; - case NUMBER: - t = jj_consume_token(NUMBER); - d = Double.parseDouble(t.image); - node.setValue(d); - {if (true) return node;} - break; - case EXPNUMBER: - t = jj_consume_token(EXPNUMBER); - s = t.image; - vals = s.toLowerCase().split("e"); - if (vals [ 1 ].startsWith("+")) - { - i = Integer.parseInt(vals [ 1 ].substring(1)); - } - else - { - i = Integer.parseInt(vals [ 1 ]); - } - node.setValue(Double.parseDouble(vals [ 0 ]), i); - {if (true) return node;} - break; - default: - jj_la1[12] = jj_gen; - if (jj_2_1(2)) { - t = string(); - jj_consume_token(OPEN_PAR); - child = TermLvl1(); - label_4: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SLPITTER: - ; - break; - default: - jj_la1[8] = jj_gen; - break label_4; - } - jj_consume_token(SLPITTER); - furtherChild = TermLvl1(); - arguments.add(furtherChild); - } - jj_consume_token(CLOSE_PAR); - s = t.image; - Type type = null; - - if (stringToType.containsKey(s.toLowerCase())) - { - type = ASTNode.Type.valueOf(stringToType.getProperty(s.toLowerCase()).toUpperCase()); - } - - if (s.equalsIgnoreCase("pow")) - { - checkSize(arguments, 1); - node.addChild(child); - } - else if (s.equalsIgnoreCase("sqr")) - { - checkSize(arguments, 0); - node.addChild(child); - node.addChild(new ASTNode(2)); - } - else if (s.equalsIgnoreCase("sqrt")) - { - checkSize(arguments, 0); - node.addChild(new ASTNode(2)); - node.addChild(child); - } - else if (s.equalsIgnoreCase("not")) - { - checkSize(arguments, 0); - node.addChild(child); - type = Type.LOGICAL_NOT; - } - else if (s.equalsIgnoreCase("ln")) - { - checkSize(arguments, 0); - node.addChild(child); - type = Type.FUNCTION_LN; - } - else if (s.equalsIgnoreCase("lambda")) - { - node.addChild(child); - type = Type.LAMBDA; - } - else if (s.equalsIgnoreCase("piecewise")) - { - node.addChild(child); - type = Type.FUNCTION_PIECEWISE; - } - else - { - node.addChild(child); - } - - if (type != null) - { - node.setType(type); - } - else - { - node.setName(s); - } - for (ASTNode argument : arguments) - { - node.addChild(argument); - } - {if (true) return node;} - } else if (jj_2_2(4)) { - t = jj_consume_token(STRING); - ASTNode selector = new ASTNode(); - selector.setType(ASTNode.Type.FUNCTION_SELECTOR); - selector.addChild(new ASTNode(t.image)); - label_5: - while (true) { - jj_consume_token(LEFT_BRACKET); - node = TermLvl1(); - selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[9] = jj_gen; - break label_5; - } - } - {if (true) return selector;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case OPEN_PAR: - jj_consume_token(OPEN_PAR); - node = TermLvl1(); - jj_consume_token(CLOSE_PAR); - {if (true) return node;} - break; - default: - jj_la1[13] = jj_gen; - if (jj_2_3(2)) { - jj_consume_token(LEFT_BRACES); - node = TermLvl1(); - ASTNode selector = new ASTNode(); - boolean isSelector = false; - selector.setType(ASTNode.Type.FUNCTION_SELECTOR); - vector.setType(ASTNode.Type.VECTOR); - vector.addChild(node); - label_6: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case SLPITTER: - ; - break; - default: - jj_la1[10] = jj_gen; - break label_6; - } - jj_consume_token(SLPITTER); - node = TermLvl1(); - vector.addChild(node); - } - jj_consume_token(RIGHT_BRACES); - selector.addChild(vector); - label_7: - while (true) { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACKET: - ; - break; - default: - jj_la1[11] = jj_gen; - break label_7; - } - jj_consume_token(LEFT_BRACKET); - node = TermLvl1(); - isSelector = true; - selector.addChild(node); - jj_consume_token(RIGHT_BRACKET); - } - {if (true) return isSelector ? selector : vector;} - } else { - switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { - case LEFT_BRACES: - jj_consume_token(LEFT_BRACES); - vector.setType(ASTNode.Type.VECTOR); - jj_consume_token(RIGHT_BRACES); - {if (true) return vector;} - break; - case MINUS: - jj_consume_token(MINUS); - node = Primary(); - ASTNode uiMinus = new ASTNode('-'); - uiMinus.addChild(node); - {if (true) return uiMinus;} - break; - case NOT: - jj_consume_token(NOT); - node = TermLvl1(); - ASTNode not = new ASTNode(Type.LOGICAL_NOT); - not.addChild(node); - {if (true) return not;} - break; - case LOG: - jj_consume_token(LOG); - child = Primary(); - node = new ASTNode(Type.FUNCTION_LN); - node.addChild(child); - {if (true) return node;} - break; - case STRING: - t = jj_consume_token(STRING); - s = t.image; - if (s.equalsIgnoreCase("true")) - { - node = new ASTNode(Type.CONSTANT_TRUE); - } - else if (s.equalsIgnoreCase("false")) - { - node = new ASTNode(Type.CONSTANT_FALSE); - } - else if (s.equalsIgnoreCase("pi")) - { - node = new ASTNode(Type.CONSTANT_PI); - } - else if (s.equalsIgnoreCase("avogadro")) - { - node = new ASTNode(Type.NAME_AVOGADRO); - } - else if (s.equalsIgnoreCase("time")) - { - node = new ASTNode(Type.NAME_TIME); - } - else if (s.equalsIgnoreCase("exponentiale")) - { - node = new ASTNode(Type.CONSTANT_E); - } - else if (s.equalsIgnoreCase("-infinity")) - { - node = new ASTNode(Double.NEGATIVE_INFINITY); - } - else if (s.equalsIgnoreCase("infinity")) - { - node = new ASTNode(Double.POSITIVE_INFINITY); - } - else - { - node = new ASTNode(s); - } - {if (true) return node;} - break; - default: - jj_la1[14] = jj_gen; - jj_consume_token(-1); - throw new ParseException(); - } - } - } - } - } - throw new Error("Missing return statement in function"); - } - - private boolean jj_2_1(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_1(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(0, xla); } - } - - private boolean jj_2_2(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_2(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(1, xla); } - } - - private boolean jj_2_3(int xla) { - jj_la = xla; jj_lastpos = jj_scanpos = token; - try { return !jj_3_3(); } - catch(LookaheadSuccess ls) { return true; } - finally { jj_save(2, xla); } - } - - private boolean jj_3R_29() { - if (jj_scan_token(NOT)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_17() { - if (jj_scan_token(BOOLEAN_LOGIC)) return true; - return false; - } - - private boolean jj_3R_26() { - if (jj_scan_token(OPEN_PAR)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_22() { - if (jj_scan_token(DIVIDE)) return true; - return false; - } - - private boolean jj_3R_28() { - if (jj_scan_token(MINUS)) return true; - if (jj_3R_19()) return true; - return false; - } - - private boolean jj_3R_16() { - if (jj_scan_token(MINUS)) return true; - return false; - } - - private boolean jj_3R_14() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_21()) { - jj_scanpos = xsp; - if (jj_3R_22()) return true; - } - return false; - } - - private boolean jj_3R_21() { - if (jj_scan_token(TIMES)) return true; - return false; - } - - private boolean jj_3R_25() { - if (jj_scan_token(EXPNUMBER)) return true; - return false; - } - - private boolean jj_3R_12() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_15()) { - jj_scanpos = xsp; - if (jj_3R_16()) { - jj_scanpos = xsp; - if (jj_3R_17()) { - jj_scanpos = xsp; - if (jj_3R_18()) return true; - } - } - } - return false; - } - - private boolean jj_3R_15() { - if (jj_scan_token(PLUS)) return true; - return false; - } - - private boolean jj_3R_27() { - if (jj_scan_token(LEFT_BRACES)) return true; - if (jj_scan_token(RIGHT_BRACES)) return true; - return false; - } - - private boolean jj_3R_11() { - if (jj_3R_13()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_14()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3_2() { - if (jj_scan_token(STRING)) return true; - Token xsp; - if (jj_3R_9()) return true; - while (true) { - xsp = jj_scanpos; - if (jj_3R_9()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_10() { - if (jj_3R_11()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_12()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_24() { - if (jj_scan_token(NUMBER)) return true; - return false; - } - - private boolean jj_3R_9() { - if (jj_scan_token(LEFT_BRACKET)) return true; - if (jj_3R_10()) return true; - if (jj_scan_token(RIGHT_BRACKET)) return true; - return false; - } - - private boolean jj_3R_23() { - if (jj_scan_token(INTEGER)) return true; - return false; - } - - private boolean jj_3R_19() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_23()) { - jj_scanpos = xsp; - if (jj_3R_24()) { - jj_scanpos = xsp; - if (jj_3R_25()) { - jj_scanpos = xsp; - if (jj_3_1()) { - jj_scanpos = xsp; - if (jj_3_2()) { - jj_scanpos = xsp; - if (jj_3R_26()) { - jj_scanpos = xsp; - if (jj_3_3()) { - jj_scanpos = xsp; - if (jj_3R_27()) { - jj_scanpos = xsp; - if (jj_3R_28()) { - jj_scanpos = xsp; - if (jj_3R_29()) { - jj_scanpos = xsp; - if (jj_3R_30()) { - jj_scanpos = xsp; - if (jj_3R_31()) return true; - } - } - } - } - } - } - } - } - } - } - } - return false; - } - - private boolean jj_3R_18() { - if (jj_scan_token(COMPARISON)) return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_scan_token(FACTORIAL)) return true; - return false; - } - - private boolean jj_3R_31() { - if (jj_scan_token(STRING)) return true; - return false; - } - - private boolean jj_3R_32() { - if (jj_scan_token(POWER)) return true; - return false; - } - - private boolean jj_3R_20() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_32()) { - jj_scanpos = xsp; - if (jj_3R_33()) return true; - } - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(LOG)) return true; - if (jj_3R_19()) return true; - return false; - } - - private boolean jj_3_3() { - if (jj_scan_token(LEFT_BRACES)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_13() { - if (jj_3R_19()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_20()) { jj_scanpos = xsp; break; } - } - return false; - } - - private boolean jj_3R_8() { - Token xsp; - xsp = jj_scanpos; - if (jj_scan_token(26)) { - jj_scanpos = xsp; - if (jj_scan_token(27)) return true; - } - return false; - } - - private boolean jj_3_1() { - if (jj_3R_8()) return true; - if (jj_scan_token(OPEN_PAR)) return true; - return false; - } - - /** Generated Token Manager. */ - public FormulaParserTokenManager token_source; - SimpleCharStream jj_input_stream; - /** Current token. */ - public Token token; - /** Next token. */ - public Token jj_nt; - private int jj_ntk; - private Token jj_scanpos, jj_lastpos; - private int jj_la; - private int jj_gen; - final private int[] jj_la1 = new int[15]; - static private int[] jj_la1_0; - static { - jj_la1_init_0(); - } - private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0xc000000,0x40000001,0x2200,0x2200,0x1800,0x1800,0x300500,0x300500,0x80,0x40000,0x80,0x40000,0x68,0x4000,0xe010400,}; - } - final private JJCalls[] jj_2_rtns = new JJCalls[3]; - private boolean jj_rescan = false; - private int jj_gc = 0; - - /** Constructor with InputStream. */ - public FormulaParser(java.io.InputStream stream) { - this(stream, null); - } - /** Constructor with InputStream and supplied encoding */ - public FormulaParser(java.io.InputStream stream, String encoding) { - try { jj_input_stream = new SimpleCharStream(stream, encoding, 1, 1); } catch(java.io.UnsupportedEncodingException e) { throw new RuntimeException(e); } - token_source = new FormulaParserTokenManager(jj_input_stream); - token = new Token(); - jj_ntk = -1; - jj_gen = 0; - for (int i = 0; i < 15; i++) jj_la1[i] = -1; - for (int i = 0; i < jj_2_rtns.length; i++) jj_2_rtns[i] = new JJCalls(); - } - - /** Reinitialise. */ - public void ReInit(java.io.InputStream stream) { - ReInit(stream, null); - } - /** Reinitialise. ... [truncated message content] |
From: <and...@us...> - 2015-04-21 13:07:58
|
Revision: 2195 http://sourceforge.net/p/jsbml/code/2195 Author: andreas-draeger Date: 2015-04-21 13:07:56 +0000 (Tue, 21 Apr 2015) Log Message: ----------- Implemented a new method to filter validation errors by severity. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java Modified: trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java 2015-04-21 13:00:30 UTC (rev 2194) +++ trunk/core/src/org/sbml/jsbml/SBMLErrorLog.java 2015-04-21 13:07:56 UTC (rev 2195) @@ -23,6 +23,7 @@ import java.io.File; import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import org.sbml.jsbml.util.Option; @@ -170,39 +171,45 @@ * @see #getNumErrors() */ public int getNumFailsWithSeverity(SBMLError.SEVERITY severity) { + return getErrorsBySeverity(severity).size(); + } - int nbWithSeverity = 0; - + /** + * + * @param severity + * @return + */ + public List<SBMLError> getErrorsBySeverity(SBMLError.SEVERITY severity) { + List<SBMLError> listOfErrors = new LinkedList<SBMLError>(); for (SBMLError error : validationErrors) { switch(severity) { case INFO: { if (error.isInfo()) { - nbWithSeverity++; + listOfErrors.add(error); } break; } case WARNING: { if (error.isWarning()) { - nbWithSeverity++; + listOfErrors.add(error); } break; } case ERROR: { if (error.isError()) { - nbWithSeverity++; + listOfErrors.add(error); } break; } case FATAL: { if (error.isFatal()) { - nbWithSeverity++; + listOfErrors.add(error); } break; } } } - - return nbWithSeverity; + return listOfErrors; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <pd...@us...> - 2015-04-21 13:00:39
|
Revision: 2194 http://sourceforge.net/p/jsbml/code/2194 Author: pdp10 Date: 2015-04-21 13:00:30 +0000 (Tue, 21 Apr 2015) Log Message: ----------- Removed the String compartment from CompartmentMapping, as this class is now a field of SpatialCompartmentPluging in the package spatial, version 0.90. Modified Paths: -------------- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java 2015-04-21 12:59:30 UTC (rev 2193) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/CompartmentMapping.java 2015-04-21 13:00:30 UTC (rev 2194) @@ -30,7 +30,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -44,11 +45,6 @@ /** * */ - private String compartment; - - /** - * - */ private String domainType; /** @@ -70,9 +66,6 @@ public CompartmentMapping(CompartmentMapping cm) { super(cm); - if (cm.isSetCompartment()) { - compartment = new String(cm.getCompartment()); - } if (cm.isSetDomainType()) { domainType = new String(cm.getDomainType()); } @@ -117,10 +110,6 @@ if (equal) { CompartmentMapping cm = (CompartmentMapping) object; - equal &= cm.isSetCompartment() == isSetCompartment(); - if (equal && isSetCompartment()) { - equal &= cm.getCompartment().equals(getCompartment()); - } equal &= cm.isSetDomainType() == isSetDomainType(); if (equal && isSetDomainType()) { equal &= cm.getDomainType().equals(getDomainType()); @@ -133,56 +122,8 @@ return equal; } - /** - * Returns the value of compartment - * - * @return the value of compartment - */ - public String getCompartment() { - if (isSetCompartment()) { - return compartment; - } - // This is necessary if we cannot return null here. - throw new PropertyUndefinedError(SpatialConstants.compartment, this); - } /** - * Returns whether compartment is set - * - * @return whether compartment is set - */ - public boolean isSetCompartment() { - return compartment != null; - } - - - /** - * Sets the value of compartment - * @param compartment - */ - public void setCompartment(String compartment) { - String oldCompartment = this.compartment; - this.compartment = compartment; - firePropertyChange(SpatialConstants.compartment, oldCompartment, this.compartment); - } - - /** - * Unsets the variable compartment - * - * @return {@code true}, if compartment was set before, - * otherwise {@code false} - */ - public boolean unsetCompartment() { - if (isSetCompartment()) { - String oldCompartment = compartment; - compartment = null; - firePropertyChange(SpatialConstants.compartment, oldCompartment, compartment); - return true; - } - return false; - } - - /** * Returns the value of domainType * * @return the value of domainType @@ -307,11 +248,8 @@ @Override public int hashCode() { - final int prime = 983;//Change this prime number + final int prime = 1319;//Changed, it was 983 int hashCode = super.hashCode(); - if (isSetCompartment()) { - hashCode += prime * getCompartment().hashCode(); - } if (isSetDomainType()) { hashCode += prime * getDomainType().hashCode(); } @@ -325,10 +263,6 @@ @Override public Map<String, String> writeXMLAttributes() { Map<String, String> attributes = super.writeXMLAttributes(); - if (isSetCompartment()) { - attributes.remove("compartment"); - attributes.put(SpatialConstants.shortLabel + ":compartment", getCompartment()); - } if (isSetDomainType()) { attributes.remove("domainType"); attributes.put(SpatialConstants.shortLabel + ":domainType", @@ -349,10 +283,7 @@ && (SpatialConstants.shortLabel == prefix); if (!isAttributeRead) { isAttributeRead = true; - if (attributeName.equals(SpatialConstants.compartment)) { - setCompartment(value); - } - else if (attributeName.equals(SpatialConstants.domainType)) { + if (attributeName.equals(SpatialConstants.domainType)) { setDomainType(value); } else if (attributeName.equals(SpatialConstants.unitSize)) { @@ -372,9 +303,7 @@ @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("CompartmentMapping [compartment="); - builder.append(compartment); - builder.append(", domainType="); + builder.append("CompartmentMapping [domainType="); builder.append(domainType); builder.append(", unitSize="); builder.append(unitSize); Modified: trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java =================================================================== --- trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java 2015-04-21 12:59:30 UTC (rev 2193) +++ trunk/extensions/spatial/src/org/sbml/jsbml/ext/spatial/SpatialCompartmentPlugin.java 2015-04-21 13:00:30 UTC (rev 2194) @@ -22,6 +22,7 @@ package org.sbml.jsbml.ext.spatial; import java.text.MessageFormat; +import java.util.Map; import org.sbml.jsbml.Compartment; import org.sbml.jsbml.ListOf; @@ -29,7 +30,8 @@ /** * @author Alex Thomas - * @author Andreas Dräger + * @author Andreas Dräger + * @author Piero Dalle Pezze * @since 1.0 * @version $Rev$ */ @@ -198,5 +200,54 @@ throw new IndexOutOfBoundsException(MessageFormat.format( "Index {0,number,integer} >= {1,number,integer}", index,pos)); } + + @Override + public Map<String, String> writeXMLAttributes() { + Map<String, String> attributes = super.writeXMLAttributes(); + if (isSetCompartmentMapping()) { + attributes.remove("compartmentMapping"); + attributes.put(SpatialConstants.shortLabel + ":compartmentMapping", + getCompartmentMapping()); + } + return attributes; + } + + @Override + public boolean readAttribute(String attributeName, String prefix, String value) { + boolean isAttributeRead = (super.readAttribute(attributeName, prefix, value)) + && (SpatialConstants.shortLabel == prefix); + if (!isAttributeRead) { + isAttributeRead = true; + if (attributeName.equals(SpatialConstants.compartmentMapping)) { + setCompartmentMapping(value); + } + else { + isAttributeRead = false; + } + } + return isAttributeRead; + } + + @Override + public int hashCode() { + final int prime = 1259; + int hashCode = super.hashCode(); + if (isSetCompartmentMapping()) { + hashCode += prime * getCompartmentMapping().hashCode(); + } + return hashCode; + } + + /* (non-Javadoc) + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder builder = new StringBuilder(); + builder.append("SpatialCompartmentPlugin [compartmentMapping="); + builder.append(compartmentMapping); + builder.append("]"); + return builder.toString(); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 12:59:33
|
Revision: 2193 http://sourceforge.net/p/jsbml/code/2193 Author: niko-rodrigue Date: 2015-04-21 12:59:30 +0000 (Tue, 21 Apr 2015) Log Message: ----------- corrected FormulaParser.jj so that we have the same behavior as before Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java 2015-04-21 12:25:38 UTC (rev 2192) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.java 2015-04-21 12:59:30 UTC (rev 2193) @@ -229,7 +229,6 @@ case TIMES: case DIVIDE: case MODULO: - case COMPARISON: ; break; default: @@ -271,15 +270,6 @@ node = createModulo(leftChild, rightChild); leftChild = node; break; - case COMPARISON: - t = jj_consume_token(COMPARISON); - rightChild = TermLvl3(); - type = Type.getTypeFor(t.image); - node = new ASTNode(type); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - break; default: jj_la1[5] = jj_gen; jj_consume_token(-1); @@ -302,6 +292,7 @@ switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case PLUS: case MINUS: + case COMPARISON: case BOOLEAN_LOGIC: ; break; @@ -330,11 +321,57 @@ t = jj_consume_token(BOOLEAN_LOGIC); rightChild = TermLvl2(); type = Type.getTypeFor(t.image); + + if (s.equalsIgnoreCase("or") || s.equals("||")) + { + type = ASTNode.Type.LOGICAL_OR; + } + else if (s.equalsIgnoreCase("and") || s.equals("&&")) + { + type = ASTNode.Type.LOGICAL_AND; + } + else if (s.equalsIgnoreCase("xor")) + { + type = ASTNode.Type.LOGICAL_XOR; + } node = new ASTNode(type); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; break; + case COMPARISON: + t = jj_consume_token(COMPARISON); + rightChild = TermLvl2(); + s = t.image; + if (s.equalsIgnoreCase("<")) + { + type = ASTNode.Type.RELATIONAL_LT; + } + else if (s.equalsIgnoreCase(">")) + { + type = ASTNode.Type.RELATIONAL_GT; + } + else if (s.equalsIgnoreCase("==")) + { + type = ASTNode.Type.RELATIONAL_EQ; + } + else if (s.equalsIgnoreCase("!=")) + { + type = ASTNode.Type.RELATIONAL_NEQ; + } + else if (s.equalsIgnoreCase(">=")) + { + type = ASTNode.Type.RELATIONAL_GEQ; + } + else if (s.equalsIgnoreCase("<=")) + { + type = ASTNode.Type.RELATIONAL_LEQ; + } + node = new ASTNode(type); + node.addChild(leftChild); + node.addChild(rightChild); + leftChild = node; + break; default: jj_la1[7] = jj_gen; jj_consume_token(-1); @@ -687,14 +724,68 @@ finally { jj_save(2, xla); } } + private boolean jj_3R_26() { + if (jj_scan_token(EXPNUMBER)) return true; + return false; + } + + private boolean jj_3R_12() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_15()) { + jj_scanpos = xsp; + if (jj_3R_16()) { + jj_scanpos = xsp; + if (jj_3R_17()) { + jj_scanpos = xsp; + if (jj_3R_18()) return true; + } + } + } + return false; + } + + private boolean jj_3R_15() { + if (jj_scan_token(PLUS)) return true; + return false; + } + + private boolean jj_3R_14() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_21()) { + jj_scanpos = xsp; + if (jj_3R_22()) { + jj_scanpos = xsp; + if (jj_3R_23()) return true; + } + } + return false; + } + + private boolean jj_3R_21() { + if (jj_scan_token(TIMES)) return true; + return false; + } + + private boolean jj_3R_25() { + if (jj_scan_token(NUMBER)) return true; + return false; + } + private boolean jj_3R_28() { if (jj_scan_token(LEFT_BRACES)) return true; if (jj_scan_token(RIGHT_BRACES)) return true; return false; } - private boolean jj_3R_21() { - if (jj_scan_token(DIVIDE)) return true; + private boolean jj_3R_10() { + if (jj_3R_11()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_12()) { jj_scanpos = xsp; break; } + } return false; } @@ -709,12 +800,12 @@ return false; } - private boolean jj_3R_10() { - if (jj_3R_11()) return true; + private boolean jj_3R_11() { + if (jj_3R_13()) return true; Token xsp; while (true) { xsp = jj_scanpos; - if (jj_3R_12()) { jj_scanpos = xsp; break; } + if (jj_3R_14()) { jj_scanpos = xsp; break; } } return false; } @@ -724,7 +815,7 @@ return false; } - private boolean jj_3R_18() { + private boolean jj_3R_19() { Token xsp; xsp = jj_scanpos; if (jj_3R_24()) { @@ -764,41 +855,25 @@ return false; } - private boolean jj_3R_14() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_20()) { - jj_scanpos = xsp; - if (jj_3R_21()) { - jj_scanpos = xsp; - if (jj_3R_22()) { - jj_scanpos = xsp; - if (jj_3R_23()) return true; - } - } - } + private boolean jj_3R_9() { + if (jj_scan_token(LEFT_BRACKET)) return true; + if (jj_3R_10()) return true; + if (jj_scan_token(RIGHT_BRACKET)) return true; return false; } - private boolean jj_3R_20() { - if (jj_scan_token(TIMES)) return true; + private boolean jj_3R_18() { + if (jj_scan_token(COMPARISON)) return true; return false; } - private boolean jj_3R_9() { - if (jj_scan_token(LEFT_BRACKET)) return true; - if (jj_3R_10()) return true; - if (jj_scan_token(RIGHT_BRACKET)) return true; + private boolean jj_3R_23() { + if (jj_scan_token(MODULO)) return true; return false; } - private boolean jj_3R_11() { - if (jj_3R_13()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_14()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_34() { + if (jj_scan_token(FACTORIAL)) return true; return false; } @@ -807,11 +882,6 @@ return false; } - private boolean jj_3R_23() { - if (jj_scan_token(COMPARISON)) return true; - return false; - } - private boolean jj_3_1() { if (jj_3R_8()) return true; if (jj_scan_token(OPEN_PAR)) return true; @@ -820,49 +890,22 @@ private boolean jj_3R_31() { if (jj_scan_token(LOG)) return true; - if (jj_3R_18()) return true; + if (jj_3R_19()) return true; return false; } - private boolean jj_3_3() { - if (jj_scan_token(LEFT_BRACES)) return true; - if (jj_3R_10()) return true; + private boolean jj_3R_33() { + if (jj_scan_token(POWER)) return true; return false; } - private boolean jj_3R_22() { - if (jj_scan_token(MODULO)) return true; - return false; - } - - private boolean jj_3R_34() { - if (jj_scan_token(FACTORIAL)) return true; - return false; - } - - private boolean jj_3R_17() { - if (jj_scan_token(BOOLEAN_LOGIC)) return true; - return false; - } - - private boolean jj_3R_30() { - if (jj_scan_token(NOT)) return true; + private boolean jj_3_3() { + if (jj_scan_token(LEFT_BRACES)) return true; if (jj_3R_10()) return true; return false; } - private boolean jj_3R_27() { - if (jj_scan_token(OPEN_PAR)) return true; - if (jj_3R_10()) return true; - return false; - } - - private boolean jj_3R_33() { - if (jj_scan_token(POWER)) return true; - return false; - } - - private boolean jj_3R_19() { + private boolean jj_3R_20() { Token xsp; xsp = jj_scanpos; if (jj_3R_33()) { @@ -872,29 +915,30 @@ return false; } - private boolean jj_3R_29() { - if (jj_scan_token(MINUS)) return true; - if (jj_3R_18()) return true; + private boolean jj_3R_17() { + if (jj_scan_token(BOOLEAN_LOGIC)) return true; return false; } - private boolean jj_3R_16() { - if (jj_scan_token(MINUS)) return true; + private boolean jj_3R_13() { + if (jj_3R_19()) return true; + Token xsp; + while (true) { + xsp = jj_scanpos; + if (jj_3R_20()) { jj_scanpos = xsp; break; } + } return false; } - private boolean jj_3R_26() { - if (jj_scan_token(EXPNUMBER)) return true; + private boolean jj_3R_30() { + if (jj_scan_token(NOT)) return true; + if (jj_3R_10()) return true; return false; } - private boolean jj_3R_13() { - if (jj_3R_18()) return true; - Token xsp; - while (true) { - xsp = jj_scanpos; - if (jj_3R_19()) { jj_scanpos = xsp; break; } - } + private boolean jj_3R_27() { + if (jj_scan_token(OPEN_PAR)) return true; + if (jj_3R_10()) return true; return false; } @@ -908,26 +952,19 @@ return false; } - private boolean jj_3R_12() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_15()) { - jj_scanpos = xsp; - if (jj_3R_16()) { - jj_scanpos = xsp; - if (jj_3R_17()) return true; - } - } + private boolean jj_3R_16() { + if (jj_scan_token(MINUS)) return true; return false; } - private boolean jj_3R_15() { - if (jj_scan_token(PLUS)) return true; + private boolean jj_3R_22() { + if (jj_scan_token(DIVIDE)) return true; return false; } - private boolean jj_3R_25() { - if (jj_scan_token(NUMBER)) return true; + private boolean jj_3R_29() { + if (jj_scan_token(MINUS)) return true; + if (jj_3R_19()) return true; return false; } @@ -948,7 +985,7 @@ jj_la1_init_0(); } private static void jj_la1_init_0() { - jj_la1_0 = new int[] {0x18000000,0x80000001,0x4200,0x4200,0x203800,0x203800,0x400500,0x400500,0x80,0x80000,0x80,0x80000,0x68,0x8000,0x1c020400,}; + jj_la1_0 = new int[] {0x18000000,0x80000001,0x4200,0x4200,0x3800,0x3800,0x600500,0x600500,0x80,0x80000,0x80,0x80000,0x68,0x8000,0x1c020400,}; } final private JJCalls[] jj_2_rtns = new JJCalls[3]; private boolean jj_rescan = false; Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj 2015-04-21 12:25:38 UTC (rev 2192) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParser.jj 2015-04-21 12:59:30 UTC (rev 2193) @@ -274,6 +274,7 @@ < AND : "And" | "AND" + | "and" | "&&" > } @@ -282,6 +283,7 @@ < OR : "OR" | "Or" + | "or" | "||" > } @@ -438,14 +440,6 @@ node = createModulo(leftChild, rightChild); leftChild = node; } - | t = < COMPARISON > rightChild = TermLvl3() - { - type = Type.getTypeFor(t.image); - node = new ASTNode(type); - node.addChild(leftChild); - node.addChild(rightChild); - leftChild = node; - } )* { return leftChild; @@ -480,11 +474,56 @@ | t = < BOOLEAN_LOGIC > rightChild = TermLvl2() { type = Type.getTypeFor(t.image); + + if (s.equalsIgnoreCase("or") || s.equals("||")) + { + type = ASTNode.Type.LOGICAL_OR; + } + else if (s.equalsIgnoreCase("and") || s.equals("&&")) + { + type = ASTNode.Type.LOGICAL_AND; + } + else if (s.equalsIgnoreCase("xor")) + { + type = ASTNode.Type.LOGICAL_XOR; + } node = new ASTNode(type); node.addChild(leftChild); node.addChild(rightChild); leftChild = node; } + | t = < COMPARISON > rightChild = TermLvl2() + { + s = t.image; + if (s.equalsIgnoreCase("<")) + { + type = ASTNode.Type.RELATIONAL_LT; + } + else if (s.equalsIgnoreCase(">")) + { + type = ASTNode.Type.RELATIONAL_GT; + } + else if (s.equalsIgnoreCase("==")) + { + type = ASTNode.Type.RELATIONAL_EQ; + } + else if (s.equalsIgnoreCase("!=")) + { + type = ASTNode.Type.RELATIONAL_NEQ; + } + else if (s.equalsIgnoreCase(">=")) + { + type = ASTNode.Type.RELATIONAL_GEQ; + } + else if (s.equalsIgnoreCase("<=")) + { + type = ASTNode.Type.RELATIONAL_LEQ; + } + node = new ASTNode(type); + node.addChild(leftChild); + node.addChild(rightChild); + leftChild = node; + } )* { return leftChild; Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java 2015-04-21 12:25:38 UTC (rev 2192) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/text/parser/FormulaParserTokenManager.java 2015-04-21 12:59:30 UTC (rev 2193) @@ -45,7 +45,7 @@ if ((active0 & 0x8000000L) != 0L) { jjmatchedKind = 28; - return 65; + return 69; } if ((active0 & 0x4000L) != 0L) return 11; @@ -57,7 +57,7 @@ { jjmatchedKind = 28; jjmatchedPos = 1; - return 65; + return 69; } return -1; default : @@ -139,7 +139,7 @@ { case 103: if ((active0 & 0x8000000L) != 0L) - return jjStartNfaWithStates_0(2, 27, 65); + return jjStartNfaWithStates_0(2, 27, 69); break; default : break; @@ -157,7 +157,7 @@ private int jjMoveNfa_0(int startState, int curPos) { int startsAt = 0; - jjnewStateCnt = 65; + jjnewStateCnt = 69; int i = 1; jjstateSet[0] = startState; int kind = 0x7fffffff; @@ -172,18 +172,12 @@ { switch(jjstateSet[--i]) { - case 7: - if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(0, 2); - else if (curChar == 46) - jjCheckNAdd(8); - break; case 0: if ((0x3ff000000000000L & l) != 0L) { if (kind > 3) kind = 3; - jjCheckNAddStates(3, 8); + jjCheckNAddStates(0, 5); } else if ((0x2400L & l) != 0L) { @@ -196,7 +190,7 @@ kind = 21; } else if (curChar == 38) - jjAddStates(9, 10); + jjAddStates(6, 7); else if (curChar == 46) jjCheckNAddTwoStates(34, 8); else if (curChar == 33) @@ -220,7 +214,13 @@ else if (curChar == 60) jjCheckNAdd(11); break; - case 65: + case 7: + if ((0x3ff000000000000L & l) != 0L) + jjCheckNAddStates(8, 10); + else if (curChar == 46) + jjCheckNAdd(8); + break; + case 69: case 20: if ((0x3ff000000000000L & l) == 0L) break; @@ -230,7 +230,7 @@ break; case 1: if ((0x3ff000000000000L & l) != 0L) - jjCheckNAddStates(0, 2); + jjCheckNAddStates(8, 10); break; case 2: if (curChar == 46) @@ -296,7 +296,7 @@ break; if (kind > 3) kind = 3; - jjCheckNAddStates(3, 8); + jjCheckNAddStates(0, 5); break; case 29: if ((0x3ff000000000000L & l) == 0L) @@ -336,7 +336,7 @@ break; case 35: if (curChar == 38) - jjAddStates(9, 10); + jjAddStates(6, 7); break; case 36: if (curChar == 38 && kind > 22) @@ -384,12 +384,16 @@ jjAddStates(21, 24); else if (curChar == 120) jjAddStates(25, 26); + else if (curChar == 111) + jjCheckNAddTwoStates(47, 48); + else if (curChar == 97) + jjAddStates(27, 28); else if (curChar == 78) - jjAddStates(27, 28); + jjAddStates(29, 30); else if (curChar == 110) jjstateSet[jjnewStateCnt++] = 17; break; - case 65: + case 69: if ((0x7fffffe87fffffeL & l) != 0L) { if (kind > 28) @@ -405,7 +409,7 @@ break; case 4: if ((0x2000000020L & l) != 0L) - jjAddStates(29, 30); + jjAddStates(31, 32); break; case 16: if (curChar == 116 && kind > 26) @@ -444,7 +448,7 @@ break; case 24: if (curChar == 78) - jjAddStates(27, 28); + jjAddStates(29, 30); break; case 25: if (curChar == 84 && kind > 26) @@ -455,106 +459,116 @@ jjstateSet[jjnewStateCnt++] = 25; break; case 38: + if (curChar == 97) + jjAddStates(27, 28); + break; + case 39: + if (curChar == 100 && kind > 22) + kind = 22; + break; + case 40: + case 65: + if (curChar == 110) + jjCheckNAdd(39); + break; + case 41: + if (curChar == 100 && kind > 23) + kind = 23; + break; + case 42: + case 66: + if (curChar == 110) + jjCheckNAdd(41); + break; + case 43: if (curChar == 124) jjAddStates(11, 12); break; - case 39: + case 44: if (curChar == 124 && kind > 22) kind = 22; break; - case 40: + case 45: if (curChar == 124 && kind > 24) kind = 24; break; - case 41: - if (curChar == 120) - jjAddStates(25, 26); + case 46: + if (curChar == 111) + jjCheckNAddTwoStates(47, 48); break; - case 42: + case 47: if (curChar == 114 && kind > 22) kind = 22; break; - case 43: - case 47: + case 48: + if (curChar == 114 && kind > 24) + kind = 24; + break; + case 49: + if (curChar == 120) + jjAddStates(25, 26); + break; + case 50: + case 54: if (curChar == 111) - jjCheckNAdd(42); + jjCheckNAdd(47); break; - case 44: + case 51: if (curChar == 114 && kind > 25) kind = 25; break; - case 45: case 52: + case 59: if (curChar == 111) - jjCheckNAdd(44); + jjCheckNAdd(51); break; - case 46: + case 53: if (curChar == 88) jjAddStates(21, 24); break; - case 48: + case 55: if (curChar == 82 && kind > 22) kind = 22; break; - case 49: + case 56: if (curChar == 79) - jjCheckNAdd(48); + jjCheckNAdd(55); break; - case 50: + case 57: if (curChar == 82 && kind > 25) kind = 25; break; - case 51: + case 58: if (curChar == 79) - jjstateSet[jjnewStateCnt++] = 50; + jjstateSet[jjnewStateCnt++] = 57; break; - case 53: + case 60: if (curChar == 79) jjCheckNAddStates(17, 20); break; - case 54: + case 61: if (curChar == 82 && kind > 24) kind = 24; break; - case 55: - if (curChar == 114 && kind > 24) - kind = 24; - break; - case 56: + case 62: if (curChar == 65) jjAddStates(13, 16); break; - case 57: + case 63: if (curChar == 68 && kind > 22) kind = 22; break; - case 58: + case 64: if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 57; + jjstateSet[jjnewStateCnt++] = 63; break; - case 59: - if (curChar == 100 && kind > 22) - kind = 22; - break; - case 60: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 59; - break; - case 61: - if (curChar == 100 && kind > 23) - kind = 23; - break; - case 62: - if (curChar == 110) - jjstateSet[jjnewStateCnt++] = 61; - break; - case 63: + case 67: if (curChar == 68 && kind > 23) kind = 23; break; - case 64: + case 68: if (curChar == 78) - jjstateSet[jjnewStateCnt++] = 63; + jjstateSet[jjnewStateCnt++] = 67; break; default : break; } @@ -579,15 +593,16 @@ kind = 0x7fffffff; } ++curPos; - if ((i = jjnewStateCnt) == (startsAt = 65 - (jjnewStateCnt = startsAt))) + if ((i = jjnewStateCnt) == (startsAt = 69 - (jjnewStateCnt = startsAt))) return curPos; try { curChar = input_stream.readChar(); } catch(java.io.IOException e) { return curPos; } } } static final int[] jjnextStates = { - 1, 2, 4, 29, 30, 31, 1, 2, 4, 36, 37, 39, 40, 58, 60, 62, - 64, 42, 48, 54, 55, 47, 49, 51, 52, 43, 45, 26, 27, 5, 6, + 29, 30, 31, 1, 2, 4, 36, 37, 1, 2, 4, 44, 45, 64, 65, 66, + 68, 47, 55, 61, 48, 54, 56, 58, 59, 50, 52, 40, 42, 26, 27, 5, + 6, }; /** Token literal values. */ @@ -607,8 +622,8 @@ 0x6L, }; protected SimpleCharStream input_stream; -private final int[] jjrounds = new int[65]; -private final int[] jjstateSet = new int[130]; +private final int[] jjrounds = new int[69]; +private final int[] jjstateSet = new int[138]; protected char curChar; /** Constructor. */ public FormulaParserTokenManager(SimpleCharStream stream){ @@ -635,7 +650,7 @@ { int i; jjround = 0x80000001; - for (i = 65; i-- > 0;) + for (i = 69; i-- > 0;) jjrounds[i] = 0x80000000; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 12:25:50
|
Revision: 2192 http://sourceforge.net/p/jsbml/code/2192 Author: niko-rodrigue Date: 2015-04-21 12:25:38 +0000 (Tue, 21 Apr 2015) Log Message: ----------- corrected the ASTNode.getReal and ASTNode.isReal method to return correct values for Exponetial and Rational numbers as well, should work with any numbers, I think Modified Paths: -------------- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java 2015-04-21 12:21:07 UTC (rev 2191) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/ASTNode.java 2015-04-21 12:25:38 UTC (rev 2192) @@ -1548,9 +1548,8 @@ * @param exponent */ public ASTNode(double mantissa, int exponent) { - astnode2 = new ASTCnExponentialNode(); - ((ASTCnExponentialNode) astnode2).setMantissa(mantissa); - ((ASTCnExponentialNode) astnode2).setExponent(exponent); + this(ASTNode.Type.REAL_E); + setValue(mantissa, exponent); } /** @@ -2800,7 +2799,22 @@ * if this node is not of type real. */ public double getReal() { - return isReal() ? ((ASTCnRealNode) astnode2).getReal() : Double.NaN; + if (isReal()) { // TODO - return the value for any AStNumber ? + // TODO - modify ASTCnNumberNode to return double for the getNumber() method + if (astnode2 instanceof ASTCnRealNode) { + return ((ASTCnRealNode) astnode2).getNumber(); + } + else if (astnode2 instanceof ASTCnExponentialNode) { + ASTCnExponentialNode ast = (ASTCnExponentialNode) astnode2; + return Double.valueOf(ast.getMantissa() + "e" + ast.getExponent()); + } + else if (astnode2 instanceof ASTCnRationalNode) { + ASTCnRationalNode ast = (ASTCnRationalNode) astnode2; + return Double.valueOf(ast.getNumerator() + "/" + ast.getDenominator()); + } + } + + return Double.NaN; } /** @@ -3164,7 +3178,8 @@ */ public boolean isReal() { return astnode2 instanceof ASTCnRealNode - || astnode2 instanceof ASTCnRationalNode; + || astnode2 instanceof ASTCnRationalNode + || astnode2 instanceof ASTCnExponentialNode; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <and...@us...> - 2015-04-21 12:21:14
|
Revision: 2191 http://sourceforge.net/p/jsbml/code/2191 Author: andreas-draeger Date: 2015-04-21 12:21:07 +0000 (Tue, 21 Apr 2015) Log Message: ----------- There is now a new (deprecated) method to create a StoichiometryMath object on SpeciesReference. Modified Paths: -------------- trunk/core/src/org/sbml/jsbml/SpeciesReference.java Modified: trunk/core/src/org/sbml/jsbml/SpeciesReference.java =================================================================== --- trunk/core/src/org/sbml/jsbml/SpeciesReference.java 2015-04-21 11:55:22 UTC (rev 2190) +++ trunk/core/src/org/sbml/jsbml/SpeciesReference.java 2015-04-21 12:21:07 UTC (rev 2191) @@ -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 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 11:55:25
|
Revision: 2190 http://sourceforge.net/p/jsbml/code/2190 Author: niko-rodrigue Date: 2015-04-21 11:55:22 +0000 (Tue, 21 Apr 2015) Log Message: ----------- added some svn:ignore properties to avoid some common files that we don't want in the repository Property Changed: ---------------- branches/astnode2-merging-alternate/ branches/astnode2-merging-alternate/core/ branches/astnode2-merging-alternate/core/dist/ Index: branches/astnode2-merging-alternate =================================================================== --- branches/astnode2-merging-alternate 2015-04-21 11:48:11 UTC (rev 2189) +++ branches/astnode2-merging-alternate 2015-04-21 11:55:22 UTC (rev 2190) Property changes on: branches/astnode2-merging-alternate ___________________________________________________________________ Added: svn:ignore ## -0,0 +1,5 ## +.classpath +.project +dist +build +bin Index: branches/astnode2-merging-alternate/core =================================================================== --- branches/astnode2-merging-alternate/core 2015-04-21 11:48:11 UTC (rev 2189) +++ branches/astnode2-merging-alternate/core 2015-04-21 11:55:22 UTC (rev 2190) Property changes on: branches/astnode2-merging-alternate/core ___________________________________________________________________ Added: svn:ignore ## -0,0 +1 ## +build Index: branches/astnode2-merging-alternate/core/dist =================================================================== --- branches/astnode2-merging-alternate/core/dist 2015-04-21 11:48:11 UTC (rev 2189) +++ branches/astnode2-merging-alternate/core/dist 2015-04-21 11:55:22 UTC (rev 2190) Property changes on: branches/astnode2-merging-alternate/core/dist ___________________________________________________________________ Added: svn:ignore ## -0,0 +1 ## +* This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <nik...@us...> - 2015-04-21 11:48:14
|
Revision: 2189 http://sourceforge.net/p/jsbml/code/2189 Author: niko-rodrigue Date: 2015-04-21 11:48:11 +0000 (Tue, 21 Apr 2015) Log Message: ----------- cleaned a bit by removing the bin folder + added some cast to be able to compile the code + moved one test file from core to the base dir as it was using the arrays package Modified Paths: -------------- branches/astnode2-merging-alternate/core/build.xml branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/compiler/UnitsCompiler.java branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdjacentDomains.java Added Paths: ----------- branches/astnode2-merging-alternate/test/org/sbml/jsbml/math/ branches/astnode2-merging-alternate/test/org/sbml/jsbml/math/test/ branches/astnode2-merging-alternate/test/org/sbml/jsbml/math/test/RecursionTest.java Removed Paths: ------------- branches/astnode2-merging-alternate/bin/ branches/astnode2-merging-alternate/core/dist/jsbml-1.1-a1/ branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/RecursionTest.java Modified: branches/astnode2-merging-alternate/core/build.xml =================================================================== --- branches/astnode2-merging-alternate/core/build.xml 2015-04-20 14:08:25 UTC (rev 2188) +++ branches/astnode2-merging-alternate/core/build.xml 2015-04-21 11:48:11 UTC (rev 2189) @@ -167,8 +167,7 @@ <copy todir="${build.src}" overwrite="yes"> <fileset dir="${src.dir}" - excludes="**/.svn*, **/*.class, **/*~, **/*.tgz, **/*.zip org/sbml/jsbml/math/**"> - <!-- TODO remove org/sbml/jsbml/math from the filters when the package is ready --> + excludes="**/.svn*, **/*.class, **/*~, **/*.tgz, **/*.zip"> </fileset> </copy> Modified: branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/compiler/UnitsCompiler.java =================================================================== --- branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/compiler/UnitsCompiler.java 2015-04-20 14:08:25 UTC (rev 2188) +++ branches/astnode2-merging-alternate/core/src/org/sbml/jsbml/math/compiler/UnitsCompiler.java 2015-04-21 11:48:11 UTC (rev 2189) @@ -122,7 +122,7 @@ */ @Override public <T> ASTNode2Value<Boolean> and(List<ASTNode2> values) throws SBMLException { - ASTNode2Value<Boolean> value = dimensionless(); + ASTNode2Value<Boolean> value = (ASTNode2Value<Boolean>) dimensionless(); boolean val = true; for (ASTNode2 v : values) { val &= v.compile(this).toBoolean(); @@ -647,7 +647,7 @@ */ @Override public <T> ASTNode2Value<Double> getConstantE() { - ASTNode2Value<Double> v = dimensionless(); + ASTNode2Value<Double> v = (ASTNode2Value<Double>) dimensionless(); v.setValue(Math.E); return v; } @@ -657,7 +657,7 @@ */ @Override public <T> ASTNode2Value<Boolean> getConstantFalse() { - ASTNode2Value<Boolean> v = dimensionless(); + ASTNode2Value<Boolean> v = (ASTNode2Value<Boolean>) dimensionless(); v.setValue(false); return v; } @@ -667,7 +667,7 @@ */ @Override public <T> ASTNode2Value<Double> getConstantPi() { - ASTNode2Value<Double> v = dimensionless(); + ASTNode2Value<Double> v = (ASTNode2Value<Double>) dimensionless(); v.setValue(Math.PI); return v; } @@ -677,7 +677,7 @@ */ @Override public <T> ASTNode2Value<Boolean> getConstantTrue() { - ASTNode2Value<Boolean> v = dimensionless(); + ASTNode2Value<Boolean> v = (ASTNode2Value<Boolean>) dimensionless(); v.setValue(true); return v; } @@ -796,7 +796,7 @@ @Override // TODO: Specify generic type T i.e. ASTNode2Value<?> public <T> ASTNode2Value<?> lt(ASTNode2 left, ASTNode2 right) throws SBMLException { - ASTNode2Value<?> v = dimensionless(), leftvalue, rightvalue; + ASTNode2Value<?> v = (ASTNode2Value<?>) dimensionless(), leftvalue, rightvalue; leftvalue = left.compile(this); rightvalue = right.compile(this); unifyUnits(leftvalue, rightvalue); @@ -851,7 +851,7 @@ @Override // TODO: Specify type T i.e. ASTNode2Value<Boolean> public ASTNode2Value<?> neq(ASTNode2 left, ASTNode2 right) throws SBMLException { - ASTNode2Value<?> v = dimensionless(), leftvalue, rightvalue; + ASTNode2Value<?> v = (ASTNode2Value<?>) dimensionless(), leftvalue, rightvalue; leftvalue = left.compile(this); rightvalue = right.compile(this); unifyUnits(leftvalue, rightvalue); @@ -864,7 +864,7 @@ */ @Override public <T> ASTNode2Value<Boolean> not(ASTNode2 value) throws SBMLException { - ASTNode2Value<Boolean> v = dimensionless(); + ASTNode2Value<Boolean> v = (ASTNode2Value<Boolean>) dimensionless(); v.setValue(!value.compile(this).toBoolean()); return v; } @@ -874,7 +874,7 @@ */ @Override public <T> ASTNode2Value<Boolean> or(List<ASTNode2> values) throws SBMLException { - ASTNode2Value<Boolean> v = dimensionless(); + ASTNode2Value<Boolean> v = (ASTNode2Value<Boolean>) dimensionless(); v.setValue(false); for (ASTNode2 value : values) { if (value.compile(this).toBoolean()) { @@ -1326,7 +1326,7 @@ */ @Override public <T> ASTNode2Value<Boolean> xor(List<ASTNode2> values) throws SBMLException { - ASTNode2Value<Boolean> value = dimensionless(); + ASTNode2Value<Boolean> value = (ASTNode2Value<Boolean>) dimensionless(); boolean v = false; for (int i = 0; i < values.size(); i++) { if (values.get(i).compile(this).toBoolean()) { Deleted: branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/RecursionTest.java =================================================================== --- branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/RecursionTest.java 2015-04-20 14:08:25 UTC (rev 2188) +++ branches/astnode2-merging-alternate/core/test/org/sbml/jsbml/math/test/RecursionTest.java 2015-04-21 11:48:11 UTC (rev 2189) @@ -1,119 +0,0 @@ -/* - * $Id: RecursionTest.java 2088 2014-11-16 06:56:46Z kofiav $ - * $URL: svn://svn.code.sf.net/p/jsbml/code/trunk/core/test/org/sbml/jsbml/math/test/RecursionTest.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-2014 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.math.test; - -import javax.swing.JOptionPane; -import javax.swing.JScrollPane; -import javax.swing.JTree; - -import org.sbml.jsbml.ASTNode; -import org.sbml.jsbml.AssignmentRule; -import org.sbml.jsbml.Model; -import org.sbml.jsbml.Parameter; -import org.sbml.jsbml.SBMLDocument; -import org.sbml.jsbml.ext.arrays.ArraysConstants; -import org.sbml.jsbml.ext.arrays.ArraysSBasePlugin; -import org.sbml.jsbml.ext.arrays.Dimension; -import org.sbml.jsbml.ext.arrays.Index; -import org.sbml.jsbml.text.parser.ParseException; - -/** - * - * @author Andreas Dräger - * @version $Rev: 2088 $ - * @since 1.0 - * @date 16.10.2014 - */ -public class RecursionTest { - - /** - * @param args - * @throws ParseException - */ - public static void main(String[] args) throws ParseException { -// ASTNode ast = ASTNode.parseFormula("3 * 1/1"); -// System.out.println(ast.getType()); -// JOptionPane.showMessageDialog(null, new JScrollPane(new JTree(ast))); -// System.out.println(ast.toFormula()); - - SBMLDocument doc = new SBMLDocument(3,1); - Model model = doc.createModel(); - - Parameter n = new Parameter("n"); - n.setValue(10); - model.addParameter(n); - - Parameter X = new Parameter("X"); - - model.addParameter(X); - ArraysSBasePlugin arraysSBasePluginX = new ArraysSBasePlugin(X); - - X.addExtension(ArraysConstants.shortLabel, arraysSBasePluginX); - - Dimension dimX = new Dimension("i"); - dimX.setSize(n.getId()); - dimX.setArrayDimension(0); - - arraysSBasePluginX.addDimension(dimX); - - Parameter Y = new Parameter("Y"); - - model.addParameter(Y); - ArraysSBasePlugin arraysSBasePluginY = new ArraysSBasePlugin(Y); - - Y.addExtension(ArraysConstants.shortLabel, arraysSBasePluginY); - Dimension dimY = new Dimension("i"); - dimY.setSize(n.getId()); - dimY.setArrayDimension(0); - - arraysSBasePluginY.addDimension(dimY); - - AssignmentRule rule = new AssignmentRule(); - model.addRule(rule); - rule.setMetaId("rule"); - - ArraysSBasePlugin arraysSBasePluginRule = new ArraysSBasePlugin(rule); - rule.addExtension(ArraysConstants.shortLabel, arraysSBasePluginRule); - - Dimension dimRule = new Dimension("i"); - dimRule.setSize(n.getId()); - dimRule.setArrayDimension(0); - arraysSBasePluginRule.addDimension(dimRule); - - Index indexRule = new Index(); - indexRule.setArrayDimension(0); - indexRule.setReferencedAttribute("variable"); - ASTNode indexMath = new ASTNode(); - - indexMath = ASTNode.diff(new ASTNode(9), new ASTNode("i")); - indexRule.setMath(indexMath); - arraysSBasePluginRule.addIndex(indexRule); - - rule.setVariable("Y"); - ASTNode ruleMath = ASTNode.parseFormula("selector(X, i)"); - - rule.setMath(ruleMath); - - JOptionPane.showMessageDialog(null, new JScrollPane(new JTree(indexMath))); - - } - -} Modified: branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdjacentDomains.java =================================================================== --- branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdjacentDomains.java 2015-04-20 14:08:25 UTC (rev 2188) +++ branches/astnode2-merging-alternate/extensions/spatial/src/org/sbml/jsbml/ext/spatial/AdjacentDomains.java 2015-04-21 11:48:11 UTC (rev 2189) @@ -25,6 +25,7 @@ import java.util.Map; import java.util.ResourceBundle; +import org.sbml.jsbml.ListOf; import org.sbml.jsbml.PropertyUndefinedError; import org.sbml.jsbml.util.ResourceManager; @@ -303,5 +304,5 @@ builder.append("]"); return builder.toString(); } - + } Added: branches/astnode2-merging-alternate/test/org/sbml/jsbml/math/test/RecursionTest.java =================================================================== --- branches/astnode2-merging-alternate/test/org/sbml/jsbml/math/test/RecursionTest.java (rev 0) +++ branches/astnode2-merging-alternate/test/org/sbml/jsbml/math/test/RecursionTest.java 2015-04-21 11:48:11 UTC (rev 2189) @@ -0,0 +1,119 @@ +/* + * $Id: RecursionTest.java 2088 2014-11-16 06:56:46Z kofiav $ + * $URL: svn://svn.code.sf.net/p/jsbml/code/trunk/core/test/org/sbml/jsbml/math/test/RecursionTest.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-2014 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.math.test; + +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTree; + +import org.sbml.jsbml.ASTNode; +import org.sbml.jsbml.AssignmentRule; +import org.sbml.jsbml.Model; +import org.sbml.jsbml.Parameter; +import org.sbml.jsbml.SBMLDocument; +import org.sbml.jsbml.ext.arrays.ArraysConstants; +import org.sbml.jsbml.ext.arrays.ArraysSBasePlugin; +import org.sbml.jsbml.ext.arrays.Dimension; +import org.sbml.jsbml.ext.arrays.Index; +import org.sbml.jsbml.text.parser.ParseException; + +/** + * + * @author Andreas Dräger + * @version $Rev: 2088 $ + * @since 1.0 + * @date 16.10.2014 + */ +public class RecursionTest { + + /** + * @param args + * @throws ParseException + */ + public static void main(String[] args) throws ParseException { +// ASTNode ast = ASTNode.parseFormula("3 * 1/1"); +// System.out.println(ast.getType()); +// JOptionPane.showMessageDialog(null, new JScrollPane(new JTree(ast))); +// System.out.println(ast.toFormula()); + + SBMLDocument doc = new SBMLDocument(3,1); + Model model = doc.createModel(); + + Parameter n = new Parameter("n"); + n.setValue(10); + model.addParameter(n); + + Parameter X = new Parameter("X"); + + model.addParameter(X); + ArraysSBasePlugin arraysSBasePluginX = new ArraysSBasePlugin(X); + + X.addExtension(ArraysConstants.shortLabel, arraysSBasePluginX); + + Dimension dimX = new Dimension("i"); + dimX.setSize(n.getId()); + dimX.setArrayDimension(0); + + arraysSBasePluginX.addDimension(dimX); + + Parameter Y = new Parameter("Y"); + + model.addParameter(Y); + ArraysSBasePlugin arraysSBasePluginY = new ArraysSBasePlugin(Y); + + Y.addExtension(ArraysConstants.shortLabel, arraysSBasePluginY); + Dimension dimY = new Dimension("i"); + dimY.setSize(n.getId()); + dimY.setArrayDimension(0); + + arraysSBasePluginY.addDimension(dimY); + + AssignmentRule rule = new AssignmentRule(); + model.addRule(rule); + rule.setMetaId("rule"); + + ArraysSBasePlugin arraysSBasePluginRule = new ArraysSBasePlugin(rule); + rule.addExtension(ArraysConstants.shortLabel, arraysSBasePluginRule); + + Dimension dimRule = new Dimension("i"); + dimRule.setSize(n.getId()); + dimRule.setArrayDimension(0); + arraysSBasePluginRule.addDimension(dimRule); + + Index indexRule = new Index(); + indexRule.setArrayDimension(0); + indexRule.setReferencedAttribute("variable"); + ASTNode indexMath = new ASTNode(); + + indexMath = ASTNode.diff(new ASTNode(9), new ASTNode("i")); + indexRule.setMath(indexMath); + arraysSBasePluginRule.addIndex(indexRule); + + rule.setVariable("Y"); + ASTNode ruleMath = ASTNode.parseFormula("selector(X, i)"); + + rule.setMath(ruleMath); + + JOptionPane.showMessageDialog(null, new JScrollPane(new JTree(indexMath))); + + } + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |