public class SBMLNamespaces extends java.lang.Object
This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. This class is not prescribed by the SBML specifications, although it is used to implement features defined in SBML.
There are differences in the definitions of components between different
SBML Levels, as well as Versions within Levels. For example, the
'sboTerm' attribute was not introduced until Level 2
Version 2, and then only on certain component classes the SBML
Level 2 Version 3 specification moved the 'sboTerm' attribute
to the SBase
class, thereby allowing nearly all components to have SBO
annotations. As a result of differences such as those, libSBML needs to
track the SBML Level and Version of every object created.
The purpose of the SBMLNamespaces
object class is to make it easier to
communicate SBML Level and Version data between libSBML constructors and
other methods. The SBMLNamespaces
object class tracks 3-tuples
(triples) consisting of SBML Level, Version, and the corresponding SBML
XML namespace.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them however, until the introduction of SBML
Level 3, the SBMLNamespaces
object only records one SBML
Level/Version/namespace combination at a time. Most constructors for
SBML objects in libSBML take a SBMLNamespaces
object as an argument,
thereby allowing the constructor to produce the proper combination of
attributes and other internal data structures for the given SBML Level
and Version.
Constructor and Description |
---|
SBMLNamespaces()
|
SBMLNamespaces(long level)
|
SBMLNamespaces(long level,
long version)
|
SBMLNamespaces(long level,
long version,
java.lang.String pkgName,
long pkgVersion)
(For extensions) Creates a new
SBMLNamespaces object corresponding to
the combination of (1) the given SBML level and version , and (2)
the given package with the package version . |
SBMLNamespaces(long level,
long version,
java.lang.String pkgName,
long pkgVersion,
java.lang.String pkgPrefix)
(For extensions) Creates a new
SBMLNamespaces object corresponding to
the combination of (1) the given SBML level and version , and (2)
the given package with the package version . |
SBMLNamespaces(SBMLNamespaces orig)
Copy constructor creates a copy of a
SBMLNamespaces . |
Modifier and Type | Method and Description |
---|---|
int |
addNamespace(java.lang.String uri,
java.lang.String prefix)
Add an XML namespace (a pair of URI and prefix) to the set of namespaces
within this
SBMLNamespaces object. |
int |
addNamespaces(XMLNamespaces xmlns)
Add the given XML namespaces list to the set of namespaces within this
SBMLNamespaces object. |
int |
addPackageNamespace(java.lang.String pkgName,
long pkgVersion)
Add an XML namespace (a pair of URI and prefix) of a package extension
to the set of namespaces within this
SBMLNamespaces object. |
int |
addPackageNamespace(java.lang.String pkgName,
long pkgVersion,
java.lang.String prefix)
Add an XML namespace (a pair of URI and prefix) of a package extension
to the set of namespaces within this
SBMLNamespaces object. |
int |
addPackageNamespaces(XMLNamespaces xmlns)
Add the XML namespaces of package extensions in the given XMLNamespace
object to the set of namespaces within this
SBMLNamespaces object
(Non-package XML namespaces are not added by this function). |
SBMLNamespaces |
cloneObject()
Creates and returns a deep copy of this
SBMLNamespaces object. |
void |
delete()
Explicitly deletes the underlying native object.
|
boolean |
equals(java.lang.Object sb)
Equality comparison method for SBMLNamespaces.
|
static void |
freeSBMLNamespaces(SWIGTYPE_p_List supportedNS)
Frees the list of supported namespaces as generated by
getSupportedNamespaces().
|
long |
getLevel()
Get the SBML Level of this
SBMLNamespaces object. |
XMLNamespaces |
getNamespaces()
Get the XML namespaces list for this
SBMLNamespaces object. |
java.lang.String |
getPackageName()
Returns the name of the main package for this namespace.
|
static java.lang.String |
getSBMLNamespaceURI(long level,
long version)
Returns a string representing the SBML XML namespace for the
given
level and version of SBML. |
static SBMLNamespacesList |
getSupportedNamespaces()
Returns a list of all supported
SBMLNamespaces in this version of
libsbml. |
java.lang.String |
getURI()
Returns a string representing the SBML XML namespace of this
object.
|
long |
getVersion()
Get the SBML Version of this
SBMLNamespaces object. |
int |
hashCode()
Returns a hashcode for this SBMLNamespaces object.
|
static boolean |
isSBMLNamespace(java.lang.String uri)
Predicate returning
true if the given URL is one of SBML XML
namespaces. |
boolean |
isValidCombination()
Predicate returning
true if the given set of namespaces represent a
valid set |
int |
removeNamespace(java.lang.String uri)
Removes an XML namespace from the set of namespaces within this
SBMLNamespaces object. |
int |
removePackageNamespace(long level,
long version,
java.lang.String pkgName,
long pkgVersion)
Removes an XML namespace of a package extension from the set of namespaces
within this
SBMLNamespaces object. |
public SBMLNamespaces(long level, long version) throws SBMLConstructorException
SBMLNamespaces
object corresponding to the given SBML
level
and version
.
SBMLNamespaces
objects are used in libSBML to communicate SBML Level and
Version data between constructors and other methods. The SBMLNamespaces
object class holds triples consisting of SBML Level, Version, and the
corresponding SBML XML namespace. Most constructors for SBML objects in
libSBML take a SBMLNamespaces
object as an argument, thereby allowing
the constructor to produce the proper combination of attributes and
other internal data structures for the given SBML Level and Version.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them. In SBML Levels below Level 3, the
SBMLNamespaces
object only records one SBML Level/Version/namespace
combination at a time. Most constructors for SBML objects in libSBML
take a SBMLNamespaces
object as an argument, thereby allowing the
constructor to produce the proper combination of attributes and other
internal data structures for the given SBML Level and Version.
level
- the SBML levelversion
- the SBML version
SBMLConstructorException
public SBMLNamespaces(long level) throws SBMLConstructorException
SBMLNamespaces
object corresponding to the given SBML
level
and version
.
SBMLNamespaces
objects are used in libSBML to communicate SBML Level and
Version data between constructors and other methods. The SBMLNamespaces
object class holds triples consisting of SBML Level, Version, and the
corresponding SBML XML namespace. Most constructors for SBML objects in
libSBML take a SBMLNamespaces
object as an argument, thereby allowing
the constructor to produce the proper combination of attributes and
other internal data structures for the given SBML Level and Version.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them. In SBML Levels below Level 3, the
SBMLNamespaces
object only records one SBML Level/Version/namespace
combination at a time. Most constructors for SBML objects in libSBML
take a SBMLNamespaces
object as an argument, thereby allowing the
constructor to produce the proper combination of attributes and other
internal data structures for the given SBML Level and Version.
level
- the SBML levelversion
- the SBML version
SBMLConstructorException
public SBMLNamespaces() throws SBMLConstructorException
SBMLNamespaces
object corresponding to the given SBML
level
and version
.
SBMLNamespaces
objects are used in libSBML to communicate SBML Level and
Version data between constructors and other methods. The SBMLNamespaces
object class holds triples consisting of SBML Level, Version, and the
corresponding SBML XML namespace. Most constructors for SBML objects in
libSBML take a SBMLNamespaces
object as an argument, thereby allowing
the constructor to produce the proper combination of attributes and
other internal data structures for the given SBML Level and Version.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them. In SBML Levels below Level 3, the
SBMLNamespaces
object only records one SBML Level/Version/namespace
combination at a time. Most constructors for SBML objects in libSBML
take a SBMLNamespaces
object as an argument, thereby allowing the
constructor to produce the proper combination of attributes and other
internal data structures for the given SBML Level and Version.
level
- the SBML levelversion
- the SBML version
SBMLConstructorException
public SBMLNamespaces(long level, long version, java.lang.String pkgName, long pkgVersion, java.lang.String pkgPrefix) throws SBMLConstructorException
SBMLNamespaces
object corresponding to
the combination of (1) the given SBML level
and version
, and (2)
the given package
with the package
version
.
SBMLNamespaces
objects are used in libSBML to communicate SBML Level and
Version data between constructors and other methods. The SBMLNamespaces
object class holds triples consisting of SBML Level, Version, and the
corresponding SBML XML namespace. Most constructors for SBML objects in
libSBML take a SBMLNamespaces
object as an argument, thereby allowing
the constructor to produce the proper combination of attributes and
other internal data structures for the given SBML Level and Version.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them. In SBML Levels below Level 3, the
SBMLNamespaces
object only records one SBML Level/Version/namespace
combination at a time. Most constructors for SBML objects in libSBML
take a SBMLNamespaces
object as an argument, thereby allowing the
constructor to produce the proper combination of attributes and other
internal data structures for the given SBML Level and Version.
level
- the SBML Levelversion
- the SBML VersionpkgName
- the string of package name (e.g. 'layout', 'multi')pkgVersion
- the package versionpkgPrefix
- the prefix of the package namespace (e.g. 'layout', 'multi') to be added.
The package's name will be used if the given string is empty (default).
SBMLExtensionException
- if the extension module that supports the
combination of the given SBML Level, SBML Version, package name, and
package version has not been registered with libSBML.SBMLConstructorException
public SBMLNamespaces(long level, long version, java.lang.String pkgName, long pkgVersion) throws SBMLConstructorException
SBMLNamespaces
object corresponding to
the combination of (1) the given SBML level
and version
, and (2)
the given package
with the package
version
.
SBMLNamespaces
objects are used in libSBML to communicate SBML Level and
Version data between constructors and other methods. The SBMLNamespaces
object class holds triples consisting of SBML Level, Version, and the
corresponding SBML XML namespace. Most constructors for SBML objects in
libSBML take a SBMLNamespaces
object as an argument, thereby allowing
the constructor to produce the proper combination of attributes and
other internal data structures for the given SBML Level and Version.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them. In SBML Levels below Level 3, the
SBMLNamespaces
object only records one SBML Level/Version/namespace
combination at a time. Most constructors for SBML objects in libSBML
take a SBMLNamespaces
object as an argument, thereby allowing the
constructor to produce the proper combination of attributes and other
internal data structures for the given SBML Level and Version.
level
- the SBML Levelversion
- the SBML VersionpkgName
- the string of package name (e.g. 'layout', 'multi')pkgVersion
- the package versionpkgPrefix
- the prefix of the package namespace (e.g. 'layout', 'multi') to be added.
The package's name will be used if the given string is empty (default).
SBMLExtensionException
- if the extension module that supports the
combination of the given SBML Level, SBML Version, package name, and
package version has not been registered with libSBML.SBMLConstructorException
public SBMLNamespaces(SBMLNamespaces orig) throws SBMLConstructorException
SBMLNamespaces
.
orig
- the SBMLNamespaces
instance to copy.SBMLConstructorException
public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize()
methods for the objects. The finalize()
methods in turn call the SBMLNamespaces.delete()
method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke SBMLNamespaces.delete()
themselves.
public boolean equals(java.lang.Object sb)
Because the Java methods for libSBML are actually wrappers around code
implemented in C++ and C, certain operations will not behave as
expected. Equality comparison is one such case. An instance of a
libSBML object class is actually a proxy object
wrapping the real underlying C/C++ object. The normal ==
equality operator in Java will only compare the Java proxy objects,
not the underlying native object. The result is almost never what you
want in practical situations. Unfortunately, Java does not provide a
way to override ==
.
The alternative that must be followed is to use the
equals()
method. The equals
method on this
class overrides the default java.lang.Object one, and performs an
intelligent comparison of instances of objects of this class. The
result is an assessment of whether two libSBML Java objects are truly
the same underlying native-code objects.
The use of this method in practice is the same as the use of any other
Java equals
method. For example,
a.equals(
b)
returns
true
if a and b are references to the
same underlying object.
equals
 in class java.lang.Object
sb
- a reference to an object to which the current object
instance will be comparedtrue
if sb
refers to the same underlying
native object as this one, false
otherwisepublic int hashCode()
hashCode
 in class java.lang.Object
public SBMLNamespaces cloneObject()
SBMLNamespaces
object.
SBMLNamespaces
object.public static java.lang.String getSBMLNamespaceURI(long level, long version)
level
and version
of SBML.
level
- the SBML levelversion
- the SBML version
public static SBMLNamespacesList getSupportedNamespaces()
SBMLNamespaces
in this version of
libsbml.
public static void freeSBMLNamespaces(SWIGTYPE_p_List supportedNS)
supportedNS
- the list to be freed.
public java.lang.String getURI()
public long getLevel()
SBMLNamespaces
object.
SBMLNamespaces
object.public long getVersion()
SBMLNamespaces
object.
SBMLNamespaces
object.public XMLNamespaces getNamespaces()
SBMLNamespaces
object.
SBMLNamespaces
objects are used in libSBML to communicate SBML Level and
Version data between constructors and other methods. The SBMLNamespaces
object class holds triples consisting of SBML Level, Version, and the
corresponding SBML XML namespace. Most constructors for SBML objects in
libSBML take a SBMLNamespaces
object as an argument, thereby allowing
the constructor to produce the proper combination of attributes and
other internal data structures for the given SBML Level and Version.
The plural name (SBMLNamespaces) is not a mistake, because in SBML
Level 3, objects may have extensions added by Level 3 packages
used by a given model and therefore may have multiple namespaces
associated with them. In SBML Levels below Level 3, the
SBMLNamespaces
object only records one SBML Level/Version/namespace
combination at a time. Most constructors for SBML objects in libSBML
take a SBMLNamespaces
object as an argument, thereby allowing the
constructor to produce the proper combination of attributes and other
internal data structures for the given SBML Level and Version.
SBMLNamespaces
object.public int addNamespaces(XMLNamespaces xmlns)
SBMLNamespaces
object.
The following code gives an example of how one could add the XHTML
namespace to the list of namespaces recorded by the top-level
<sbml>
element of a model. It gives the new
namespace a prefix of html
.
SBMLDocument
sd try { sd = newSBMLDocument
(3, 1) } catch (SBMLConstructorException e) { // Here, have code to handle a truly exceptional situation. Candidate // causes include invalid combinations of SBML Level and Version // (impossible if hardwired as given here), running out of memory, and // unknown system exceptions. }SBMLNamespaces
sn = sd.getNamespaces() if (sn != null) { sn.add('http://www.w3.org/1999/xhtml', 'html') } else { // Handle another truly exceptional situation. }
xmlns
- the XML namespaces to be added.
public int addNamespace(java.lang.String uri, java.lang.String prefix)
SBMLNamespaces
object.
uri
- the XML namespace to be added.prefix
- the prefix of the namespace to be added.
public int removeNamespace(java.lang.String uri)
SBMLNamespaces
object.
uri
- the XML namespace to be added.
public int addPackageNamespace(java.lang.String pkgName, long pkgVersion, java.lang.String prefix)
SBMLNamespaces
object.
The SBML Level and SBML Version of this object is used.
pkgName
- the string of package name (e.g. 'layout', 'multi')pkgVersion
- the package versionprefix
- the prefix of the package namespace to be added.
The package's name will be used if the given string is empty (default).
SBMLNamespaces.addNamespace(String, String)
LIBSBML_INVALID_ATTRIBUTE_VALUE
will be returned).
public int addPackageNamespace(java.lang.String pkgName, long pkgVersion)
SBMLNamespaces
object.
The SBML Level and SBML Version of this object is used.
pkgName
- the string of package name (e.g. 'layout', 'multi')pkgVersion
- the package versionprefix
- the prefix of the package namespace to be added.
The package's name will be used if the given string is empty (default).
SBMLNamespaces.addNamespace(String, String)
LIBSBML_INVALID_ATTRIBUTE_VALUE
will be returned).
public int addPackageNamespaces(XMLNamespaces xmlns)
SBMLNamespaces
object
(Non-package XML namespaces are not added by this function).
xmlns
- the XML namespaces to be added.
LIBSBML_INVALID_ATTRIBUTE_VALUE
will be returned if the given
xmlns is null.public int removePackageNamespace(long level, long version, java.lang.String pkgName, long pkgVersion)
SBMLNamespaces
object.
level
- the SBML levelversion
- the SBML versionpkgName
- the string of package name (e.g. 'layout', 'multi')pkgVersion
- the package version
public static boolean isSBMLNamespace(java.lang.String uri)
true
if the given URL is one of SBML XML
namespaces.
uri
- the URI of namespace
true
if the 'uri' is one of SBML namespaces, false
otherwise.
public boolean isValidCombination()
true
if the given set of namespaces represent a
valid set
true
if the set of namespaces is valid, false
otherwise.public java.lang.String getPackageName()