public class SBMLExtensionRegistry 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.
This class provides a central registry of all extensions known to libSBML. Each package extension must be registered with the registry. The registry class is accessed by various classes to retrieve information about known package extensions and to create additional attributes and/or elements by factory objects of the package extensions.
The package extension registry is implemented as a singleton instance of
SBMLExtensionRegistry
. The class provides only utility functionality
implementations of SBML packages do not need to implement any subclasses or
methods of this class. SBMLExtensionRegistry
is useful for its facilities
to query the known packages, and to enable or disable packages selectively.
Modifier and Type | Method and Description |
---|---|
int |
addExtension(SBMLExtension ext)
Add the given
SBMLExtension object to this SBMLExtensionRegistry . |
void |
addL2Namespaces(XMLNamespaces xmlns)
Adds SBML Level 2 namespaces to the namespace list.
|
void |
delete()
Explicitly deletes the underlying native object.
|
static void |
disablePackage(java.lang.String arg0)
Disables the package with the given URI or name.
|
void |
disableUnusedPackages(SBMLDocument doc)
Disables unused packages.
|
void |
enableL2NamespaceForDocument(SBMLDocument doc)
Enables package extensions that support serialization to SBML annotations.
|
static void |
enablePackage(java.lang.String arg0)
Enables the package with the given URI / name.
|
static SWIGTYPE_p_std__vectorT_std__string_t |
getAllRegisteredPackageNames()
Returns a list of registered packages.
|
SBMLExtension |
getExtension(java.lang.String arg0)
Returns an
SBMLExtension object with the given package URI or package
name. |
static SBMLExtensionRegistry |
getInstance()
Returns a singleton instance of the registry.
|
long |
getNumExtension(SBaseExtensionPoint extPoint)
Returns the number of extensions that have a given extension point.
|
static long |
getNumRegisteredPackages()
Returns the number of registered packages.
|
static java.lang.String |
getRegisteredPackageName(long index)
Returns the nth registered package.
|
boolean |
isEnabled(java.lang.String uri)
Returns
true if the given extension is enabled. |
static boolean |
isPackageEnabled(java.lang.String arg0)
Returns
true if the named package is enabled. |
boolean |
isRegistered(java.lang.String uri)
Returns
true if a package extension is registered for the
corresponding package URI. |
void |
removeL2Namespaces(XMLNamespaces xmlns)
Removes SBML Level 2 namespaces from the namespace list.
|
boolean |
setEnabled(java.lang.String uri,
boolean isEnabled)
Enables or disable the package with the given URI.
|
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 SBMLExtensionRegistry.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 SBMLExtensionRegistry.delete()
themselves.
public static SBMLExtensionRegistry getInstance()
Callers need to obtain a copy of the package extension registry before they can invoke its methods. The registry is implemented as a singleton, and this is the method callers can use to get a copy of it.
SBMLExtensionRegistry
object.public int addExtension(SBMLExtension ext)
SBMLExtension
object to this SBMLExtensionRegistry
.
ext
- the SBMLExtension
object to be added.
public SBMLExtension getExtension(java.lang.String arg0)
SBMLExtension
object with the given package URI or package
name.
package
- a string representing the URI or name of the SBML package
whose package extension is being sought.
SBMLExtension
object with the given package URI
or name.
public void removeL2Namespaces(XMLNamespaces xmlns)
xmlns
- an XMLNamespaces
object listing one or more namespaces
to be removed.public void addL2Namespaces(XMLNamespaces xmlns)
xmlns
- an XMLNamespaces
object providing one or more namespaces to
be added.public void enableL2NamespaceForDocument(SBMLDocument doc)
SBML Level 2 does not have a package mechanism in the way that SBML Level 3 does. However, SBML annotations can be used to store SBML constructs. In fact, a widely-used approach to developing SBML Level 3 packages involves first using them as annotations.
doc
- the SBMLDocument
object for which this should be enabled.public void disableUnusedPackages(SBMLDocument doc)
This method walks through all extensions in the list of plugins of the
given SBML document doc
, and disables all that are not being used.
doc
- the SBMLDocument
object whose unused package extensions
should be disabled.public static void disablePackage(java.lang.String arg0)
package
- a string representing the URI or name of the SBML package
whose package extension is to be disabled.public static boolean isPackageEnabled(java.lang.String arg0)
true
if the named package is enabled.
package
- the name or URI of a package to test.
true
if the package is enabled, false
otherwise.public static void enablePackage(java.lang.String arg0)
package
- the name or URI of a package to enable.public long getNumExtension(SBaseExtensionPoint extPoint)
extPoint
- the SBaseExtensionPoint
object
SBMLExtension
-derived objects with the given
extension point.public boolean setEnabled(java.lang.String uri, boolean isEnabled)
uri
- the URI of the target package.isEnabled
- true
to enable the package, false
to disable.
false
if isEnabled
is false
or the given package is not
registered, otherwise this method returns true.
public boolean isEnabled(java.lang.String uri)
true
if the given extension is enabled.
uri
- the URI of the target package.
false
if the given package is disabled or not registered,
true
otherwise.public boolean isRegistered(java.lang.String uri)
true
if a package extension is registered for the
corresponding package URI.
uri
- the URI of the target package.
true
if the package with the given URI is registered,
otherwise returns false.
public static SWIGTYPE_p_std__vectorT_std__string_t getAllRegisteredPackageNames()
This method returns a vector of strings containing the nicknames of the
SBML packages for which package extensions are registered with this copy
of libSBML. The vector will contain String
objects.
public static long getNumRegisteredPackages()
public static java.lang.String getRegisteredPackageName(long index)
index
- zero-based index of the package name to return.
null
if none
such exists.
SBMLExtensionRegistry.getNumRegisteredPackages()