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, lv
listOfListeners, 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)
If the attribute is an id or name attribute, it will set the id or name
of this object with the value of the XML attribute ('value').
|
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 currentList)
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, appendNotes, appendNotes, checkLevelAndVersionCompatibility, createHistory, createPlugin, disablePackage, enablePackage, enablePackage, filterCVTerms, filterCVTerms, filterCVTerms, fireNodeRemovedEvent, getAnnotation, getAnnotationString, getCVTerm, getCVTermCount, getCVTerms, getDeclaredNamespaces, getExtension, getExtensionPackages, getHistory, 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, setAnnotation, setHistory, setLevel, setLevelAndVersion, setMetaId, setNamespace, setNotes, setNotes, setParentSBML, setParentSBMLObject, setSBOTerm, setSBOTerm, setThisAsParentSBMLObject, setVersion, unregister, unsetAnnotation, unsetCVTerms, unsetExtension, unsetHistory, unsetMetaId, unsetNamespace, unsetNotes, unsetPlugin, unsetSBOTerm, writeXMLAttributes
addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, firePropertyChange, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
finalize, getClass, notify, notifyAll, wait, wait, wait
removeTreeNodeChangeListener
addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, firePropertyChange, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeUserObject, userObjectKeySet
private static boolean DEBUG_MODE
toString()
method from displaying
the ListOf.Type
(default) to the complete content of all instances of
ListOf
private 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>
LevelVersionError
public 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>
LevelVersionError
public boolean addAll(int index, java.util.Collection<? extends T> collection) throws LevelVersionError
addAll
in interface java.util.List<T extends SBase>
LevelVersionError
public 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.LevelVersionError
#add(T)
public void clear()
public ListOf<T> clone()
SBase
SBase
with the same properties
like this one.clone
in interface SBase
clone
in class AbstractSBase
public boolean contains(java.lang.Object o)
public boolean containsAll(java.util.Collection<?> c)
public boolean equals(java.lang.Object o)
SBase
true
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 SBase
equals
in class AbstractSBase
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.TreeNode
getAllowsChildren
in class AbstractSBase
public javax.swing.tree.TreeNode getChildAt(int index)
getChildAt
in interface javax.swing.tree.TreeNode
getChildAt
in class AbstractSBase
public int getChildCount()
getChildCount
in interface javax.swing.tree.TreeNode
getChildCount
in class AbstractSBase
public java.lang.String getElementName()
SBase
getElementName
in interface SBase
getElementName
in class AbstractSBase
public 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)
SBase
readAttribute
in interface SBase
readAttribute
in class AbstractSBase
attributeName
- 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)
id
- 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>
LevelVersionError
public void setListOf(java.util.List<T> listOf)
listOf
- public void setSBaseListType(java.lang.Class<T> type)
type
- public void setSBaseListType(ListOf.Type currentList)
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 AbstractSBase
public void unsetSBaseListType()