public class ElementFilter extends Object
This class of objects is defined by libSBML only and has no direct equivalent in terms of SBML components. It is a class used in the implementation of extra functionality provided by libSBML.
Some libSBML objects provide the ability to return lists of components.
To provide callers with greater control over exactly what is
returned, these methods take optional arguments in the form of filters.
The ElementFilter
class is the parent class for these filters.
Constructor and Description |
---|
ElementFilter()
Creates a new
ElementFilter object. |
Modifier and Type | Method and Description |
---|---|
void |
delete()
Explicitly deletes the underlying native object.
|
boolean |
filter(SBase element)
Predicate to test elements.
|
public ElementFilter()
ElementFilter
object.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 ElementFilter.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 ElementFilter.delete()
themselves.
public boolean filter(SBase element)
This is the central predicate of the ElementFilter
class. In subclasses
of ElementFilter
, callers should implement this method such that it
returns true
for element
arguments that are 'desirable' and
false
for those that are 'undesirable' in whatever filtering context the
ElementFilter
subclass is designed to be used.
element
- the element to be tested.
true
if the element
is desirable or should be kept,
false
otherwise.