public class ListOf<T extends SBase> extends AbstractSBase implements java.util.List<T>, UniqueSId
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
AbstractSBase.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. |
protected java.lang.String |
otherListName
name of the list at it appears in the SBMLFile.
|
private static long |
serialVersionUID
Generated serial version identifier.
|
ignoredExtensions, ignoredXMLElements, JSBML_WRONG_SBO_TERM, lv, packageName
listOfListeners, parent, resourceBundle
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.
|
ListOf(java.lang.String id)
Creates a new
ListOf instance with the given id. |
ListOf(java.lang.String id,
int level,
int version)
Creates a new
ListOf instance. |
ListOf(java.lang.String id,
java.lang.String name,
int level,
int version)
Creates a new
ListOf instance. |
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()
Returns the first element in this list.
|
T |
getLast()
Returns the last element in this list.
|
java.lang.String |
getOtherListName()
Returns the XML element name used when the ListOf type is set to
ListOf.Type.other . |
ListOf.Type |
getSBaseListType()
Returns the SBaseListType of this ListOf instance.
|
int |
indexOf(java.lang.Object o) |
static <T extends SBase> |
initListOf(SBase parent,
ListOf<T> list,
ListOf.Type type)
Initializes newly created lists.
|
static boolean |
isDebugMode()
If this method returns
true , the AbstractSBase.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)
Initializes a new
ListOf object for the given
parent SBML object and with the given Class as the type of the
list. |
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 are accepted by the
Filter.accepts(Object)
method of the given filter. |
T |
removeFirst(Filter f)
Removes the first element from this list that is accepted by the
Filter.accepts(Object)
method 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
AbstractSBase.toString() method. |
void |
setListOf(java.util.List<T> listOf)
|
void |
setOtherListName(java.lang.String otherListName)
Sets the XML element name used when the ListOf type is set to
ListOf.Type.other . |
void |
setPackageName(java.lang.String newPackageName)
Sets the name of the package to which this
SBase belong. |
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) |
void |
unsetSBaseListType()
Sets the SBaseListType of this ListOf to SBaseListType.none.
|
addCVTerm, addDeclaredNamespace, addExtension, addPlugin, appendAnnotation, appendAnnotation, appendNotes, appendNotes, checkAndSetPackageNamespaceAndVersion, checkAndSetPackageNamespaceAndVersion, checkAttribute, checkIdentifier, checkLevelAndVersionCompatibility, createHistory, createPlugin, disablePackage, enablePackage, enablePackage, filterCVTerms, filterCVTerms, filterCVTerms, filterCVTerms, fireNodeRemovedEvent, firePropertyChange, getAnnotation, getAnnotationString, getCVTerm, getCVTermCount, getCVTerms, getDeclaredNamespaces, getElementByMetaId, getElementBySId, getExtension, getExtensionCount, getExtensionPackages, getHistory, getId, getIdManager, getLevel, getLevelAndVersion, getMetaId, getModel, getName, getNamespace, getNotes, getNotesString, getNumCVTerms, getNumPlugins, getPackageName, getPackageVersion, getParent, getParentSBMLObject, getPlugin, getSBMLDocument, getSBOTerm, getSBOTermID, getURI, getVersion, hashCode, hasValidAnnotation, hasValidLevelVersionNamespaceCombination, isExtendedByOtherPackages, isIdMandatory, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetHistory, isSetId, isSetLevel, isSetLevelAndVersion, isSetMetaId, isSetName, isSetNotes, isSetPackageVErsion, isSetParentSBMLObject, isSetPlugin, isSetSBOTerm, isSetVersion, isValidLevelAndVersionCombination, isValidMetaId, notifyChildChange, readAttribute, registerChild, removeCVTerm, removeCVTerm, setAnnotation, setAnnotation, setAnnotation, setHistory, setId, setLevel, setLevelAndVersion, setMetaId, setName, setNamespace, setNotes, setNotes, setPackageNamespaceAndVersion, setPackageVersion, setParentSBML, setParentSBMLObject, setSBOTerm, setSBOTerm, setThisAsParentSBMLObject, setVersion, toString, unregisterChild, unsetAnnotation, unsetCVTerms, unsetExtension, unsetHistory, unsetId, unsetMetaId, unsetName, unsetNamespace, unsetNotes, unsetPlugin, unsetSBOTerm, writeXMLAttributes
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, children, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getIndex, getListOfTreeNodeChangeListeners, getNumChildren, getRoot, getTreeNodeChangeListenerCount, getUserObject, indexOf, isLeaf, isReadingInProgress, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeTreeNodeChangeListener, removeUserObject, setParent, userObjectKeySet
finalize, getClass, notify, notifyAll, wait, wait, wait
removeTreeNodeChangeListener
addAllChangeListeners, addAllChangeListeners, addTreeNodeChangeListener, addTreeNodeChangeListener, clearUserObjects, containsUserObjectKey, filter, filter, filter, fireNodeAddedEvent, getListOfTreeNodeChangeListeners, getRoot, getTreeNodeChangeListenerCount, getUserObject, isRoot, isSetParent, isSetUserObjects, putUserObject, removeAllTreeNodeChangeListeners, removeAllTreeNodeChangeListeners, removeFromParent, removeTreeNodeChangeListener, removeUserObject, userObjectKeySet
private static boolean DEBUG_MODE
AbstractSBase.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 transient org.apache.log4j.Logger logger
Logger
for this class.protected java.util.List<T extends SBase> listOf
protected ListOf.Type listType
protected java.lang.String otherListName
ListOf.Type.other
.public ListOf()
public ListOf(int level, int version)
ListOf
instance from a level and version. By default, the
list containing the SBase elements is empty.level
- the SBML levelversion
- the SBML versionpublic ListOf(ListOf<? extends SBase> listOf)
listOf
- the list to clonepublic ListOf(java.lang.String id)
ListOf
instance with the given id.id
- the ListOf id.public ListOf(java.lang.String id, int level, int version)
ListOf
instance.id
- the ListOf id.level
- the SBML level.version
- the SBML version.public ListOf(java.lang.String id, java.lang.String name, int level, int version)
ListOf
instance.id
- the ListOf id.name
- the ListOf name.level
- the SBML level.version
- the SBML version.public static <T extends SBase> ListOf<T> initListOf(SBase parent, ListOf<T> list, ListOf.Type type)
parent
- the list parent, used to set the SBML level and versionlist
- the list to initializetype
- the type of the listpublic static boolean isDebugMode()
true
, the AbstractSBase.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.parent
- the ListOf parentclazz
- the class of objects the new ListOf will containListOf
object for the given
parent SBML object and with the given Class
as the type of the
list.public static void setDebugMode(boolean debugMode)
AbstractSBase.toString()
method.
If set to true
, the whole content of this ListOf
is
displayed by the AbstractSBase.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
- if the SBML level and version of the new element is different from the SBML level and version of list.add(SBase)
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
o
- 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.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()
java.lang.IndexOutOfBoundsException
- if there are no element in the listpublic T getLast()
java.lang.IndexOutOfBoundsException
- if there are no element in the listpublic 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 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)
Filter.accepts(Object)
method of the given filter.f
- a Filter
to applytrue
if this list changed as a result of the callpublic T removeFirst(Filter f)
Filter.accepts(Object)
method of the given filter.f
- a Filter
to applypublic 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
- the list that contain all the elements to add to this ListOf
public void setPackageName(java.lang.String newPackageName)
SBase
belong.
This an internal method that should not be used outside of the main jsbml code (core + packages). One class should always belong to the same package. You have to know what you are doing when using this method.
newPackageName
- the name of the package to which this SBase
belong.public void setSBaseListType(java.lang.Class<T> type)
type
- a class instancepublic void setSBaseListType(ListOf.Type listType)
ListOf.Type
of this ListOf
instance to 'listType'.listType
- a list ListOf.Type
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 void unsetSBaseListType()
public java.lang.String getOtherListName()
ListOf.Type.other
.
This an internal method that should not be used outside of the main jsbml code (packages). You have to know what you are doing when using this method.
public void setOtherListName(java.lang.String otherListName)
ListOf.Type.other
.
This an internal method that should not be used outside of the main jsbml code (packages). You have to know what you are doing when using this method.
otherListName
- the value of otherListName to be set.