public class ListOf extends SBase
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.
SBML defines various ListOf___ classes that are containers used for
organizing the main components of an SBML model. All are derived from
the abstract class SBase
, and inherit the attributes and subelements of
SBase
, such as 'metaid' as and 'annotation'. The ListOf___ classes do
not add any attributes of their own.
The ListOf
class in libSBML is a utility class that serves as the parent
class for implementing the ListOf__ classes. It provides methods for
working generically with the various SBML lists of objects in a program.
LibSBML uses this separate list class rather than ordinary
Java lists,
so that it can provide the methods and features associated with SBase
.
Constructor and Description |
---|
ListOf()
Creates a new
ListOf object. |
ListOf(ListOf orig)
Copy constructor creates a copy of this
ListOf . |
ListOf(long level)
Creates a new
ListOf object. |
ListOf(long level,
long version)
Creates a new
ListOf object. |
ListOf(SBMLNamespaces sbmlns)
Creates a new
ListOf with SBMLNamespaces object. |
Modifier and Type | Method and Description |
---|---|
int |
append(SBase item)
Adds item to the end of this
ListOf . |
int |
appendAndOwn(SBase item)
Adds item to the end of this
ListOf . |
int |
appendFrom(ListOf list)
Adds a clone of all items in the provided
ListOf to this object. |
void |
clear()
Removes all items in this
ListOf object. |
void |
clear(boolean doDelete)
Removes all items in this
ListOf object. |
ListOf |
cloneObject()
Creates and returns a deep copy of this
ListOf . |
void |
delete()
Explicitly deletes the underlying native object.
|
SBase |
get(long n)
Get an item from the list.
|
SBase |
getElementByMetaId(String metaid)
Returns the first child element it can find with the given
metaid , or null if no such object is found. |
SBase |
getElementBySId(String id)
Returns the first child element found that has the given
id in the model-wide SId namespace, or null if no such object is found. |
String |
getElementName()
Returns the XML element name of this object, which for
ListOf , is
always 'listOf'. |
int |
getItemTypeCode()
Get the type code of the objects contained in this
ListOf . |
int |
getTypeCode()
Returns the libSBML type code for this object, namely,
SBML_LIST_OF. |
int |
insert(int location,
SBase item)
Inserts the item at the given position of this
ListOf |
int |
insertAndOwn(int location,
SBase item)
Inserts the item at the given position of this
ListOf |
SBase |
remove(long n)
Removes the nth item from this
ListOf items and returns a
pointer to it. |
int |
removeFromParentAndDelete()
Because
ListOf objects typically live as object children of their parent object and not as pointer children, this function clears itself, but does not attempt to do anything else. |
long |
size()
Get the size of this
ListOf . |
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getLevel, getLine, getListOfAllElements, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, unsetAnnotation, unsetCVTerms, unsetId, unsetMetaId, unsetModelHistory, unsetName, unsetNotes, unsetSBOTerm
public ListOf() throws SBMLConstructorException
ListOf
object.
level
- the SBML Level if not assigned, defaults to the
value of SBML_DEFAULT_LEVEL.
version
- the Version within the SBML Level if not assigned,
defaults to the value of SBML_DEFAULT_VERSION.
SBMLConstructorException
public ListOf(ListOf orig) throws SBMLConstructorException
ListOf
.
orig
- the ListOf
instance to copy.SBMLConstructorException
public ListOf(long level) throws SBMLConstructorException
ListOf
object.
level
- the SBML Level if not assigned, defaults to the
value of SBML_DEFAULT_LEVEL.
version
- the Version within the SBML Level if not assigned,
defaults to the value of SBML_DEFAULT_VERSION.
SBMLConstructorException
public ListOf(long level, long version) throws SBMLConstructorException
ListOf
object.
level
- the SBML Level if not assigned, defaults to the
value of SBML_DEFAULT_LEVEL.
version
- the Version within the SBML Level if not assigned,
defaults to the value of SBML_DEFAULT_VERSION.
SBMLConstructorException
public ListOf(SBMLNamespaces sbmlns) throws SBMLConstructorException
ListOf
with SBMLNamespaces
object.
sbmlns
- the set of namespaces that this ListOf
should contain.SBMLConstructorException
public int append(SBase item)
ListOf
.
This variant of the method makes a clone of the item
handed to it.
This means that when the ListOf
is destroyed, the original items will
not be destroyed.
item
- the item to be added to the list.
ListOf.appendAndOwn(SBase item)
public int appendAndOwn(SBase item)
ListOf
.
This variant of the method does not clone the item
handed to it
instead, it assumes ownership of it. This means that when the ListOf
is destroyed, the item will be destroyed along with it.
item
- the item to be added to the list.
ListOf.append(SBase item)
public int appendFrom(ListOf list)
ListOf
to this object. This means that when this ListOf
is destroyed, the original items will not be destroyed.
list
- A list of items to be added.
ListOf.append(SBase item)
public void clear()
ListOf
object.
If parameter doDelete
is true
(default), all items in this ListOf
object are deleted and cleared, and thus the caller doesn't have to
delete those items. Otherwise, all items are just cleared from this
ListOf
object and the caller is responsible for deleting all items. (In
that case, pointers to all items should be stored elsewhere before
calling this function.)
doDelete
- if true
(default), all items are deleted and cleared.
Otherwise, all items are just cleared and not deleted.
public void clear(boolean doDelete)
ListOf
object.
If parameter doDelete
is true
(default), all items in this ListOf
object are deleted and cleared, and thus the caller doesn't have to
delete those items. Otherwise, all items are just cleared from this
ListOf
object and the caller is responsible for deleting all items. (In
that case, pointers to all items should be stored elsewhere before
calling this function.)
doDelete
- if true
(default), all items are deleted and cleared.
Otherwise, all items are just cleared and not deleted.
public ListOf cloneObject()
ListOf
.
cloneObject
 in class SBase
ListOf
.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 ListOf.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 ListOf.delete()
themselves.
public SBase get(long n)
n
- the index number of the item to get.
ListOf
items.
ListOf.size()
public SBase getElementByMetaId(String metaid)
metaid
, or null
if no such object is found.
getElementByMetaId
 in class SBase
metaid
- string representing the metaid of objects to find
metaid
.public SBase getElementBySId(String id)
id
in the model-wide SId namespace, or null
if no such object is found.
getElementBySId
 in class SBase
id
- string representing the id of objects to find
id
.public String getElementName()
ListOf
, is
always 'listOf'.
getElementName
 in class SBase
public int getItemTypeCode()
ListOf
.
LibSBML attaches an identifying code to every
kind of SBML object. These are known as SBML type codes. In
other languages, the set of type codes is stored in an enumeration in
the Java language interface for libSBML, the type codes are defined as
static integer constants in the interface class libsbmlConstants
. The names of the type codes all begin with the
characters SBML_.
ListOf
instance, or SBML_UNKNOWN
(default).public int getTypeCode()
SBML_LIST_OF.
LibSBML attaches an identifying code to every
kind of SBML object. These are known as SBML type codes. In
other languages, the set of type codes is stored in an enumeration in
the Java language interface for libSBML, the type codes are defined as
static integer constants in the interface class libsbmlConstants
. The names of the type codes all begin with the
characters SBML_.
getTypeCode
 in class SBase
SBML_UNKNOWN
(default).
ListOf.getElementName()
public int insert(int location, SBase item)
ListOf
This variant of the method makes a clone of the item
handet to it.
This means that when the ListOf
is destroyed, the original items will
not be destroyed.
location
- the location where to insert the itemitem
- the item to be inserted to the list
ListOf.insertAndOwn(int location, SBase item)
public int insertAndOwn(int location, SBase item)
ListOf
This variant of the method makes a clone of the item
handet to it.
This means that when the ListOf
is destroyed, the original items will
not be destroyed.
location
- the location where to insert the itemitem
- the item to be inserted to the list
ListOf.insert(int location, SBase item)
public SBase remove(long n)
ListOf
items and returns a
pointer to it.
The caller owns the returned item and is responsible for deleting it.
n
- the index of the item to remove
ListOf.size()
public int removeFromParentAndDelete()
ListOf
objects typically live as object children of their parent object and not as pointer children, this function clears itself, but does not attempt to do anything else. If a particular ListOf
subclass does indeed exist as a pointer only, this function will need to be overridden.
removeFromParentAndDelete
 in class SBase