libSBML Python API  5.18.0
libsbml.ASTNodeList Class Reference
Inheritance diagram for libsbml.ASTNodeList:
[legend]

Detailed Description

Class for managing lists of ASTNode objects.

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 is necessary because of programming language differences between Python and the underlying C++ core of libSBML's implementation. It would of course be preferable to have a common list type for all lists returned by libSBML (e.g., lists of ASTNode objects, lists of CVTerm objects, etc.). However, this is currently impossible to achieve given the way the underlying C++ lists are implemented.

As a result of this incompatibility, libSBML must implement the Python versions of the lists in another way. The approach taken is to define specialized list types for each kind of object that needs a list; that is, ASTNodeList for ASTNode objects, CVTermList for CVTerm objects, and a few others. These list objects provide the same kind of functionality that the underlying C++ generic lists provide (such as get(), add(), remove(), etc.).

See also
ASTNode::getListOfNodes()

Public Member Functions

def __init__ (self)
 Explicit constructor for this list. More...
 
def add (self, args)
 Adds the given ASTNode object item to this list. More...
 
def get (self, args)
 Returns the nth ASTNode object from this list. More...
 
def getSize (self)
 Returns the number of items in this list. More...
 
def prepend (self, args)
 Adds the ASTNode object item to the beginning of this list. More...
 
def remove (self, args)
 Removes the nth ASTNode object from this list and returns it. More...
 

Constructor & Destructor Documentation

def libsbml.ASTNodeList.__init__ (   self)

Explicit constructor for this list.

__init__()   string

In most circumstances, callers will obtain an ASTNodeList object from a call to a libSBML method that returns the list. However, the constructor is provided in case callers need to construct the lists themselves.

Member Function Documentation

def libsbml.ASTNodeList.add (   self,
  args 
)

Adds the given ASTNode object item to this list.

add(ASTNode item)
Parameters
itemthe ASTNode object to add to add
def libsbml.ASTNodeList.get (   self,
  args 
)

Returns the nth ASTNode object from this list.

get()   ASTNode

If the index number n is greater than the size of the list (as indicated by getSize()), then this method returns None.

Parameters
nthe index number of the item to get, with indexing beginning at number 0.
Returns
the nth item in this ASTNodeList items.
See also
getSize()
def libsbml.ASTNodeList.getSize (   self)

Returns the number of items in this list.

getSize()   long
Returns
the number of elements in this list.
def libsbml.ASTNodeList.prepend (   self,
  args 
)

Adds the ASTNode object item to the beginning of this list.

prepend(ASTNode item)
Parameters
itema pointer to the item to be prepended.
def libsbml.ASTNodeList.remove (   self,
  args 
)

Removes the nth ASTNode object from this list and returns it.

remove(long n)   ASTNode

Callers can use getSize() to find out the length of the list. If n > getSize(), this method returns None and does not delete anything.

Parameters
nthe index number of the item to remove
Returns
the item indexed by n
See also
getSize()