org.sbml.jsbml
public class ListOf<T extends SBase> extends AbstractSBase implements java.util.List<T>
List that extends
AbstractSBase. It represents the listOfxxx XML elements in a SBML
file. Unfortunately, there is no way for multiple inheritance in Java.| Modifier and Type | Class and Description |
|---|---|
static class |
ListOf.Type
This enum lists all the possible names of the listXXX components.
|
| Modifier and Type | Field and Description |
|---|---|
private static boolean |
DEBUG_MODE
Switches the behavior of the
toString() method from displaying
the ListOf.Type (default) to the complete content of all instances of
ListOf |
protected java.util.List<T> |
listOf
list containing all the SBase elements of this object.
|
protected ListOf.Type |
listType
name of the list at it appears in the SBMLFile.
|
private static org.apache.log4j.Logger |
logger
A
Logger for this class. |
private static long |
serialVersionUID
Generated serial version identifier.
|
ignoredExtensions, ignoredXMLElements, lvlistOfListeners, parent, UNKNOWN_ATTRIBUTES, UNKNOWN_ELEMENTS| Constructor and Description |
|---|
ListOf()
Creates a ListOf instance.
|
ListOf(int level,
int version)
Creates a ListOf instance from a level and version.
|
ListOf(ListOf<? extends SBase> listOf)
creates a ListOf instance from a given ListOf.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
T element) |
boolean |
add(T element) |
boolean |
addAll(java.util.Collection<? extends T> c) |
boolean |
addAll(int index,
java.util.Collection<? extends T> collection) |
boolean |
append(T element)
Adds item to the end of this
ListOf. |
void |
clear() |
ListOf<T> |
clone()
Creates a deep copy of this object, i.e., a new
SBase with the same properties
like this one. |
boolean |
contains(java.lang.Object o) |
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object o)
|
java.util.List<T> |
filterList(Filter f)
Returns a new
List that contains only those elements that
satisfy a certain filter criterion. |
T |
firstHit(Filter f)
Returns the first element in this list that satisfies a certain filter
criterion.
|
T |
get(int index)
Returns the element at the specified position in this list or null if the index is negative or too big.
|
T |
get(java.lang.String id)
Gets the list element which has the id 'id'.
|
boolean |
getAllowsChildren() |
javax.swing.tree.TreeNode |
getChildAt(int index) |
int |
getChildCount() |
java.lang.String |
getElementName()
Returns the XML element name of this object.
|
T |
getFirst()
The first element in this list.
|
T |
getLast()
Returns the last element in this list.
|
ListOf.Type |
getSBaseListType() |
int |
indexOf(java.lang.Object o) |
static <T extends SBase> |
initListOf(SBase parent,
ListOf<T> list,
ListOf.Type type)
Helper method to initialize newly created lists.
|
static boolean |
isDebugMode()
If this method returns
true, the toString() method of this
ListOf displays the whole content of the list. |
boolean |
isEmpty() |
java.util.Iterator<T> |
iterator() |
int |
lastIndexOf(java.lang.Object o) |
java.util.ListIterator<T> |
listIterator() |
java.util.ListIterator<T> |
listIterator(int index) |
static <T extends SBase> |
newInstance(SBase parent,
java.lang.Class<T> clazz)
Helper method to initialize a new
ListOf object for the given
parent SBML object and with the given Class as the type of the
list. |
boolean |
readAttribute(java.lang.String attributeName,
java.lang.String prefix,
java.lang.String value)
Sets the given attribute in this
SBase. |
T |
remove(int index) |
boolean |
remove(NamedSBase nsb)
Removes a
NamedSBase according to its unique id. |
boolean |
remove(java.lang.Object o) |
T |
remove(java.lang.String removeId)
Specialized method to remove a named SBase according to its unique id.
|
boolean |
removeAll(java.util.Collection<?> c) |
boolean |
removeAll(Filter f)
Removes all elements from this list that fulfill the filter property of
the given filter.
|
T |
removeFirst(Filter f)
Removes the first element from this list that fulfills the filter
property of the given filter.
|
boolean |
retainAll(java.util.Collection<?> c) |
T |
set(int index,
T element) |
static void |
setDebugMode(boolean debugMode)
Allows you to influence the behavior of the
toString() method. |
void |
setListOf(java.util.List<T> listOf)
|
void |
setSBaseListType(java.lang.Class<T> type)
|
void |
setSBaseListType(ListOf.Type listType)
Sets the
ListOf.Type of this ListOf instance to 'listType'. |
int |
size() |
java.util.List<T> |
subList(int fromIndex,
int toIndex) |
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] a) |
java.lang.String |
toString() |
void |
unsetSBaseListType()
Sets the SBaseListType of this ListOf to SBaseListType.none.
|
addCVTerm, addDeclaredNamespace, addExtension, addPlugin, appendNotes, appendNotes, checkLevelAndVersionCompatibility, createHistory, createPlugin, disablePackage, enablePackage, enablePackage, filterCVTerms, filterCVTerms, filterCVTerms, filterCVTerms, fireNodeRemovedEvent, firePropertyChange, getAnnotation, getAnnotationString, getCVTerm, getCVTermCount, getCVTerms, getDeclaredNamespaces, getExtension, getExtensionCount, getExtensionPackages, getHistory, getIdManager, getLevel, getLevelAndVersion, getMetaId, getModel, getNamespace, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getParent, getParentSBMLObject, getPlugin, getSBMLDocument, getSBOTerm, getSBOTermID, getVersion, hashCode, hasValidAnnotation, hasValidLevelVersionNamespaceCombination, isExtendedByOtherPackages, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetHistory, isSetLevel, isSetLevelAndVersion, isSetMetaId, isSetNotes, isSetParentSBMLObject, isSetPlugin, isSetSBOTerm, isSetVersion, isValidLevelAndVersionCombination, isValidMetaId, notifyChildChange, registerChild, removeCVTerm, removeCVTerm, setAnnotation, setHistory, setLevel, setLevelAndVersion, setMetaId, setNamespace, setNotes, setNotes, setParentSBML, setParentSBMLObject, setSBOTerm, setSBOTerm, setThisAsParentSBMLObject, setVersion, unregisterChild, unsetAnnotation, unsetCVTerms, unsetExtension, unsetHistory, unsetMetaId, unsetNamespace, unsetNotes, unsetPlugin, unsetSBOTerm, writeXMLAttributesaddAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySetfinalize, getClass, hashCode, notify, notifyAll, wait, wait, waitremoveTreeNodeChangeListeneraddAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeUserObject, userObjectKeySetprivate static boolean DEBUG_MODE
toString() method from displaying
the ListOf.Type (default) to the complete content of all instances of
ListOfprivate static final long serialVersionUID
private static final org.apache.log4j.Logger logger
Logger for this class.protected java.util.List<T extends SBase> listOf
protected ListOf.Type listType
public ListOf()
public ListOf(int level,
int version)
public static <T extends SBase> ListOf<T> initListOf(SBase parent, ListOf<T> list, ListOf.Type type)
list - type - public static boolean isDebugMode()
true, the toString() method of this
ListOf displays the whole content of the list. Otherwise, only
the ListOf.Type is shown.public static <T extends SBase> ListOf<T> newInstance(SBase parent, java.lang.Class<T> clazz)
ListOf object for the given
parent SBML object and with the given Class as the type of the
list.T - parent - clazz - public static void setDebugMode(boolean debugMode)
toString() method.
If set to true, the whole content of this ListOf is
displayed by the toString() method, just like it is done in
other List implementations. The default for JSBML, however, is,
to only display the ListOf.Type of this list.debugMode - the debugMode to setpublic void add(int index,
T element)
public boolean add(T element) throws LevelVersionError
add in interface java.util.Collection<T extends SBase>add in interface java.util.List<T extends SBase>LevelVersionErrorpublic boolean addAll(java.util.Collection<? extends T> c) throws LevelVersionError
addAll in interface java.util.Collection<T extends SBase>addAll in interface java.util.List<T extends SBase>LevelVersionErrorpublic boolean addAll(int index,
java.util.Collection<? extends T> collection)
throws LevelVersionError
addAll in interface java.util.List<T extends SBase>LevelVersionErrorpublic boolean append(T element) throws LevelVersionError
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.element - the item to be added to the list.true if this could be successfully appended.LevelVersionErroradd(SBase)public void clear()
public ListOf<T> clone()
SBaseSBase with the same properties
like this one.clone in interface SBaseclone in class AbstractSBasepublic boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean equals(java.lang.Object o)
SBasetrue if and only if the given SBase has exactly the same
properties like this SBase instance.equals in interface java.util.Collection<T extends SBase>equals in interface java.util.List<T extends SBase>equals in interface SBaseequals in class AbstractSBaseo - the SBase to be compared to.true if and only if the given Object is an instance of
SBase that has exactly the same properties like this
SBase instance.public java.util.List<T> filterList(Filter f)
List that contains only those elements that
satisfy a certain filter criterion.f - A filter that defines the criterion for elements to be put
into the list to be returned.public T firstHit(Filter f)
f - A filter defining the criterion for which to be filter.public T get(int index)
public T get(java.lang.String id)
The elements of the list have to implement NamedSBase, if they are not
or if the id is not found, null is returned.
id - the id to search for.public boolean getAllowsChildren()
getAllowsChildren in interface javax.swing.tree.TreeNodegetAllowsChildren in class AbstractSBasepublic javax.swing.tree.TreeNode getChildAt(int index)
getChildAt in interface javax.swing.tree.TreeNodegetChildAt in class AbstractSBasepublic int getChildCount()
getChildCount in interface javax.swing.tree.TreeNodegetChildCount in class AbstractSBasepublic java.lang.String getElementName()
SBasegetElementName in interface SBasegetElementName in class AbstractSBasepublic T getFirst()
public T getLast()
public ListOf.Type getSBaseListType()
public int indexOf(java.lang.Object o)
public boolean isEmpty()
public java.util.Iterator<T> iterator()
public int lastIndexOf(java.lang.Object o)
public java.util.ListIterator<T> listIterator()
public java.util.ListIterator<T> listIterator(int index)
public boolean readAttribute(java.lang.String attributeName,
java.lang.String prefix,
java.lang.String value)
SBaseSBase.
If the given attribute name is not recognized, nothing is done and
false is returned.
readAttribute in interface SBasereadAttribute in class AbstractSBaseattributeName - localName of the XML attributeprefix - prefix of the XML attributevalue - value of the XML attributetrue if the attribute has been successfully read.public boolean remove(NamedSBase nsb)
NamedSBase according to its unique id.nsb - the object to be removed.public boolean remove(java.lang.Object o)
public T remove(java.lang.String removeId)
removeId - the id of the object to be removed.public boolean removeAll(java.util.Collection<?> c)
public boolean removeAll(Filter f)
f - public T removeFirst(Filter f)
f - public boolean retainAll(java.util.Collection<?> c)
public T set(int index, T element) throws LevelVersionError
set in interface java.util.List<T extends SBase>LevelVersionErrorpublic void setListOf(java.util.List<T> listOf)
listOf - public void setSBaseListType(java.lang.Class<T> type)
type - public void setSBaseListType(ListOf.Type listType)
ListOf.Type of this ListOf instance to 'listType'.listType - public int size()
public java.util.List<T> subList(int fromIndex, int toIndex)
public java.lang.Object[] toArray()
public <T> T[] toArray(T[] a)
public java.lang.String toString()
toString in class AbstractSBasepublic void unsetSBaseListType()