Skip to content

Commit

Permalink
updates to the 1.2 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
niko-rodrigue committed Dec 14, 2016
1 parent 1d7ea16 commit dfdf0bb
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 35 deletions.
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@


===========================================================================
Version 1.2 (12-12-2016)
Version 1.2 (14-12-2016)
===========================================================================

* New Features:
Expand All @@ -20,6 +20,8 @@ Version 1.2 (12-12-2016)

- Returning the correct namespace for core elements when calling getNamespace() or getURI() (instead of 'null' previously).

- Updated the XML attribute name of Samplefield.interpolation. Changed it from 'interpolation' to 'interplationType'. The change should be transparent for the user as the API is unchanged and when reading a file, we are reading both attribute names.


* Miscellaneous updates:

Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ JSBML

<img align="right" src="doc/common/logo/jsbml_logo_200px.png"> JSBML is a community-driven project to create a free, open-source, pure Java library for reading, writing, and manipulating SBML files and data streams. It is an alternative to the mixed Java/native code-based interface provided in libSBML.

[![License](http://img.shields.io/:license-LGPL-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) [![Stable version](https://img.shields.io/badge/Stable_version-1.2-brightgreen.svg)](http://shields.io)
[![License](http://img.shields.io/:license-LGPL-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) [![Stable version](https://img.shields.io/badge/Stable_version-1.1-brightgreen.svg)](http://shields.io)

----
*Authors*: [Andreas Dräger](http://sbrg.ucsd.edu/researchers/draeger/),
Expand Down Expand Up @@ -68,7 +68,6 @@ Article citations are **critical** for us to be able to continue support for JSB

Please also indicate the specific version of JSBML you use, to improve other people's ability to reproduce your results. You can use the Zenodo DOIs we provide for this purpose:

* JSBML release 1.2 &rArr; [10.5281/zenodo.200544](http://doi.org/10.5281/zenodo.200544)
* JSBML release 1.1 &rArr; [10.5281/zenodo.55323](http://dx.doi.org/10.5281/zenodo.55323)
* JSBML release 1.0 &rArr; [10.5281/zenodo.55635](http://dx.doi.org/10.5281/zenodo.55635)
* JSBML release 0.8 &rArr; [10.5281/zenodo.55636](http://dx.doi.org/10.5281/zenodo.55636)
Expand Down
14 changes: 7 additions & 7 deletions doc/announcements/jsbml-1.2-release-announcement.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
# JSBML-1.2


We are pleased to announce the release of JSBML-1.2, which is now available for download from [github below](#downloads) and from [sourceforge](https://sourceforge.net/projects/jsbml/files/jsbml/1.2).
We are pleased to announce the release of JSBML-1.2, which is now available for download from [GitHub (below)](#downloads) and from [SourceForge](https://sourceforge.net/projects/jsbml/files/jsbml/1.2).

JSBML is a community-driven project to create a free, open-source, pure Java library for reading, writing, and manipulating SBML files and data streams. It is an alternative to the mixed Java/native code-based interface provided in libSBML.
JSBML is a community-driven project to create a free, open-source, pure Java library for reading, writing, and manipulating [SBML](http://sbml.org) files and data streams. It is an alternative to the mixed Java/native code-based interface provided in [libSBML](http://sbml.org/Software/libSBML).

For more details, please visit
For more details, please visit the JSBML project home page:

<http://sbml.org/Software/JSBML>

The main new feature in this release is the support for SBML Level 3 Version 2 (RC1). This involved some changes in the class hierarchy of JSBML. A notable SBML change introduced in SBML Level 3 Version 2 is that every SBase object can have an 'id' and a 'name' attribute. In JSBML, for compatibility reasons, we did not change the NamedSBase interface, so not every SBase is a NamedSBase. Only SBML elements that had 'id' and 'name' in SBML Levels/Versions below L3V2 will extend NamedSBase. So, when implementing support for SBML L3V2, we recommend that developers try to avoid using NamedSBase and just use SBase instead. The same is true for the JSBML classes UniqueNamedSBase and UniqueSId. If you were using the UniqueNamedSBase class, please try to use UniqueSId instead. As part of the upgrade to support SBML L3V2, users should also consider checking how they access InitialAssignment, Rule and EventAssignment objects, as often the methods make use of the 'variable' or 'symbol' attribute instead of the 'id' attribute.
The main new feature in this release is the support for SBML Level 3 Version 2 (RC2). This involved some changes in the class hierarchy of JSBML. A notable SBML change introduced in SBML Level 3 Version 2 is that every 'SBase' object can have an 'id' and a 'name' attribute. In JSBML, for compatibility reasons, we did not change the 'NamedSBase' interface, so not every 'SBase' is a 'NamedSBase'. Only SBML elements that had 'id' and 'name' in SBML Levels/Versions below L3V2 will extend 'NamedSBase'. So, when implementing support for SBML L3V2, we recommend that developers try to avoid using 'NamedSBase' and just use 'SBase' instead. The same is true for the JSBML classes 'UniqueNamedSBase' and 'UniqueSId'. If you were using the 'UniqueNamedSBase' class, please try to use 'UniqueSId' instead. As part of the upgrade to support SBML L3V2, users should also consider checking how they access 'InitialAssignment', 'Rule' and 'EventAssignment' objects, as often the methods make use of the 'variable' or 'symbol' attribute instead of the 'id' attribute.

We have upgraded the minimum JDK requirement to 1.7 for this release, to be able to use the latest versions of the third-party libraries needed by JSBML. As the number of third-party libraries having JDK 1.8 as a minimum requirement increases, we may need to increase the minimum JDK requirement to 1.8 for next year's JSBML releases. (Please let us know in advance if you think requiring JDK 1.8 will be a problem for you.)

The toString() method of most JSBML classes has been replaced by a generic method so you may find some changes in the output produced by the JSBML classes. One method we did not change for now is ASTNode.toString(), because doing so could cause many side effects. As part of the upgrade to SBML L3V2 and JSBML 1.2, we advise users to make sure they use ASTNode.toFormula() when they want to show/store the infix formula representation of an ASTNode, and to not rely on the toString() method for that purpose. Don't hesitate to provide us with some feedback about this change. We tried to keep any significantly different toString method under a different name, starting with 'print' and followed by the class name, for example Unit.printUnit() will produce the same output as the Unit.toString() method in JSBML 1.1.
The 'toString()' method available on most JSBML classes has been replaced by a generic method so you may find some differences in the output produced by the JSBML classes compared to previous versions. One method we did not change for now is 'ASTNode.toString()', because doing so could cause many side effects. As part of the upgrade to SBML L3V2 and JSBML 1.2, we advise users to make sure they use 'ASTNode.toFormula()' when they want to show/store the infix formula representation of an 'ASTNode', and to not rely on the 'toString()' method for that purpose. Don't hesitate to provide us with some feedback about this change. We tried to keep any significantly different 'toString()' method under a different name, starting with 'print' and followed by the class name, for example 'Unit.printUnit()' will produce the same output as the 'Unit.toString()' method in JSBML 1.1.

Since the time of the last JSBML release, we have moved the JSBML source code repository to github.com. Although we provide the main download files from GitHub, we will continue to distribute the releases from SourceForge until we develop a suitable release replacement scheme using either GitHub or sbml.org.
Since the time of the last JSBML release, we have moved the JSBML source code repository to [GitHub](https://github.com/sbmlteam/jsbml). Although we provide the main download files from GitHub, we will continue to distribute the releases from SourceForge until we develop a suitable release replacement scheme using either GitHub or sbml.org.

You can find a detailed list of the user-visible new features and bug fixes since JSBML version 1.1 on the [NEWS](NEWS.txt) file.
You can find a detailed list of the user-visible new features and bug fixes since JSBML version 1.1 on the [NEWS](NEWS.md) file.

Thank you for your interest and support of JSBML and SBML in general.

Expand Down
88 changes: 64 additions & 24 deletions extensions/spatial/src/org/sbml/jsbml/ext/spatial/SampledField.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*
* $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.
Expand Down Expand Up @@ -34,11 +33,11 @@


/**
*
* @author Alex Thomas
* @author Andreas Dr&auml;ger
* @author Piero Dalle Pezze
* @since 1.0
* @version $Rev$
*/
public class SampledField extends AbstractSpatialNamedSBase {

Expand Down Expand Up @@ -455,59 +454,99 @@ public boolean unsetCompression() {
return false;
}


/**
* Returns the value of interpolation
* Returns the value of interpolation type
*
* @return the value of interpolation
* @return the value of interpolation type
*/
public InterpolationKind getInterpolation() {
public InterpolationKind getInterpolationType() {
if (isSetInterpolation()) {
return interpolation;
}
// This is necessary if we cannot return null here.
throw new PropertyUndefinedError(SpatialConstants.interpolation, this);
throw new PropertyUndefinedError(SpatialConstants.interpolationType, this);
}

/**
* Returns the value of interpolation type
*
* @return the value of interpolation type
* @see SampledField#getInterpolationType()
*/
public InterpolationKind getInterpolation() {
return getInterpolationType();
}


/**
* Returns whether interpolation is set
* Returns whether interpolation type is set
*
* @return whether interpolation is set
* @return whether interpolation type is set
* @see #isSetInterpolationType()
*/
public boolean isSetInterpolation() {
return isSetInterpolationType();
}

/**
* Returns whether interpolation type is set
*
* @return whether interpolation type is set
*/
public boolean isSetInterpolationType() {
return interpolation != null;
}


/**
* Sets the value of interpolation
* @param interpolation
* Sets the value of interpolation type
*
* @param interpolation the value of interpolation type
* @see #setInterpolationType(InterpolationKind)
*/
public void setInterpolation(InterpolationKind interpolation) {
setInterpolationType(interpolation);
}

/**
* Sets the value of interpolation type
*
* @param interpolation the value of interpolation type
*/
public void setInterpolationType(InterpolationKind interpolation) {
InterpolationKind oldInterpolation = this.interpolation;
this.interpolation = interpolation;
firePropertyChange(SpatialConstants.interpolation, oldInterpolation, this.interpolation);
firePropertyChange(SpatialConstants.interpolationType, oldInterpolation, this.interpolation);
}


/**
* Unsets the variable interpolation
* Unsets the variable interpolation type
*
* @return {@code true}, if interpolation was set before,
* @return {@code true}, if interpolation type was set before,
* otherwise {@code false}
* @see #unsetInterpolationType()
*/
public boolean unsetInterpolation() {
return unsetInterpolationType();
}

/**
* Unsets the variable interpolation type
*
* @return {@code true}, if interpolation type was set before,
* otherwise {@code false}
*/
public boolean unsetInterpolationType() {
if (isSetInterpolation()) {
InterpolationKind oldInterpolation = interpolation;
interpolation = null;
firePropertyChange(SpatialConstants.interpolation, oldInterpolation, interpolation);
firePropertyChange(SpatialConstants.interpolationType, oldInterpolation, interpolation);
return true;
}
return false;
}


/**
* Returns the value of {@link #samples}.
*
Expand Down Expand Up @@ -793,14 +832,14 @@ public int hashCode() {
public Map<String, String> writeXMLAttributes() {
Map<String, String> attributes = super.writeXMLAttributes();
if (isSetNumSamples1()) {
attributes.put(SpatialConstants.shortLabel + ":numSamples1", String.valueOf(getNumSamples1()));
attributes.put(SpatialConstants.shortLabel + ":" + SpatialConstants.numSamples1, String.valueOf(getNumSamples1()));
}
if (isSetNumSamples2()) {
attributes.put(SpatialConstants.shortLabel + ":numSamples2",
attributes.put(SpatialConstants.shortLabel + ":" + SpatialConstants.numSamples2,
String.valueOf(getNumSamples2()));
}
if (isSetNumSamples3()) {
attributes.put(SpatialConstants.shortLabel + ":numSamples3",
attributes.put(SpatialConstants.shortLabel + ":" + SpatialConstants.numSamples3,
String.valueOf(getNumSamples3()));
}
if (isSetDataType()) {
Expand All @@ -813,7 +852,7 @@ public Map<String, String> writeXMLAttributes() {
getCompression().toString());
}
if (isSetInterpolation()) {
attributes.put(SpatialConstants.shortLabel + ":interpolation",
attributes.put(SpatialConstants.shortLabel + ":interpolationType",
getInterpolation().toString());
}
if (isSetSamplesLength()) {
Expand Down Expand Up @@ -850,12 +889,13 @@ else if (attributeName.equals(SpatialConstants.numSamples3)) {
logger.warn(MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ_ATTRIBUTE"), value, SpatialConstants.numSamples3, getElementName()));
}
}
// TODO: update the following IF, after Lucian has decided whether it is called interpolation or interpolationType
else if (attributeName.equals(SpatialConstants.interpolation) || attributeName.equals("interpolationType")) {
// The specs were ambiguous for some time so we keep both interpolation and interpolationType in this test
// to be able to read the incorrect models
else if (attributeName.equals(SpatialConstants.interpolationType) || attributeName.equals("interpolation")) {
try {
setInterpolation(InterpolationKind.valueOf(value));
} catch (Exception e) {
logger.warn(MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ_ATTRIBUTE"), value, SpatialConstants.interpolation, getElementName()));
logger.warn(MessageFormat.format(SpatialConstants.bundle.getString("COULD_NOT_READ_ATTRIBUTE"), value, SpatialConstants.interpolationType, getElementName()));
}
}
else if (attributeName.equals(SpatialConstants.compression)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ public class SpatialConstants {
/**
*
*/
public static final String interpolation = "interpolation";
public static final String interpolationType = "interpolationType";
/**
*
*/
Expand Down

0 comments on commit dfdf0bb

Please sign in to comment.