Package com.bayesserver
Class NetworkNodeCollection
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<Node>
-
- com.bayesserver.NetworkNodeCollection
-
public final class NetworkNodeCollection extends AbstractList<Node>
Represents the collection ofNetwork.getNodes()maintained by theNetworkclass. Duplicates and null values are not allowed.
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, Node item)Inserts an element into the collection at the specified index.voidclear()Removes all elements from the collection.booleancontains(Object o)Determines whether aNodeis in the collection.Nodeget(int index)Gets theNodeobject at the specified index.Nodeget(String name)Performs a case sensitive lookup.Nodeget(String name, boolean throwIfNotFound)Performs a case sensitive lookup.NetworkgetNetwork()TheNetworkthe collection belongs to.intindexOf(Object o)Determines the index of a specificNodein the collection.Noderemove(int index)Removes an element from the collection at the specified index, and any links that it has.booleanremove(Node item)Removes theNodefrom the collection.Nodeset(int index, Node value)Sets theNodeobject at the specified index.intsize()-
Methods inherited from class java.util.AbstractList
add, addAll, equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
addAll, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
get
public Node get(int index)
Gets theNodeobject at the specified index.- Specified by:
getin interfaceList<Node>- Specified by:
getin classAbstractList<Node>- Parameters:
index- The zero-based index of theNodeto find.- Returns:
- A
Node. - Throws:
NullPointerException- Raised when value being set is null.IllegalStateException- Raised if the value being set already belongs to a network.IllegalArgumentException- index is less than 0.-or-index is equal to or greater than the collection count.
-
set
public Node set(int index, Node value)
Sets theNodeobject at the specified index.- Specified by:
setin interfaceList<Node>- Overrides:
setin classAbstractList<Node>- Parameters:
index- The zero-based index of theNodeto find.- Returns:
- A
Node. - Throws:
NullPointerException- Raised when value being set is null.IllegalStateException- Raised if the value being set already belongs to a network.IllegalArgumentException- index is less than 0.-or-index is equal to or greater than the collection count.
-
contains
public boolean contains(Object o)
Determines whether aNodeis in the collection. The operation is O(1).- Specified by:
containsin interfaceCollection<Node>- Specified by:
containsin interfaceList<Node>- Overrides:
containsin classAbstractCollection<Node>- Parameters:
o- TheNodeto locate in the collection. The value can be null.- Returns:
- true if [o] is found in the collection; otherwise, false.
-
clear
public void clear()
Removes all elements from the collection.- Specified by:
clearin interfaceCollection<Node>- Specified by:
clearin interfaceList<Node>- Overrides:
clearin classAbstractList<Node>
-
add
public void add(int index, Node item)Inserts an element into the collection at the specified index.- Specified by:
addin interfaceList<Node>- Overrides:
addin classAbstractList<Node>- Parameters:
index- The zero based index at which to add the element.item- The item to insert. Cannot be null.- Throws:
NullPointerException- Raised when [item] is null.IllegalStateException- Raised if the node already belongs to a network.IllegalArgumentException- index is less than 0.-or-index is equal to or greater than the collection count.
-
indexOf
public int indexOf(Object o)
Determines the index of a specificNodein the collection. This operation is O(1).
-
remove
public boolean remove(Node item)
Removes theNodefrom the collection.- Parameters:
item- TheNodeto be removed from the collection.- Returns:
- true if item was successfully removed from the collection; otherwise, false. This method also returns false if item is not found in the collection.
- Throws:
NullPointerException- Raised if [item] is null.
-
remove
public Node remove(int index)
Removes an element from the collection at the specified index, and any links that it has.- Specified by:
removein interfaceList<Node>- Overrides:
removein classAbstractList<Node>- Parameters:
index- The zero based index at which to remove the element.- Throws:
IllegalArgumentException- index is less than 0.-or-index is equal to or greater than the collection count.
-
size
public int size()
- Specified by:
sizein interfaceCollection<Node>- Specified by:
sizein interfaceList<Node>- Specified by:
sizein classAbstractCollection<Node>
-
-