Package com.bayesserver
Class NodeVariableCollection
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<Variable>
-
- com.bayesserver.NodeVariableCollection
-
public final class NodeVariableCollection extends AbstractList<Variable>
Represents the collection of variables belonging to a- See Also:
.
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, Variable item)
Inserts an element into the collection at the specified index.void
clear()
Removes all elements from the collection.boolean
contains(Object o)
Determines whether aVariable
is in the collection.Variable
get(int index)
Gets theVariable
object at the specified index.Variable
get(String name)
Performs a case sensitive lookup.Variable
get(String name, boolean throwIfNotFound)
Performs a case sensitive lookup.Node
getNode()
TheNode
the collection belongs to.int
indexOf(Object o)
Determines the index of a specificVariable
in the collection.Variable
remove(int index)
Removes an element from the collection at the specified index.boolean
remove(Variable item)
Removes theVariable
from the collection.Variable
set(int index, Variable value)
Sets theVariable
object at the specified index.int
size()
Gets the number of elements contained in theNodeVariableCollection
instance.-
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
-
size
public int size()
Gets the number of elements contained in theNodeVariableCollection
instance.- Specified by:
size
in interfaceCollection<Variable>
- Specified by:
size
in interfaceList<Variable>
- Specified by:
size
in classAbstractCollection<Variable>
-
indexOf
public int indexOf(Object o)
Determines the index of a specificVariable
in the collection.
-
contains
public boolean contains(Object o)
Determines whether aVariable
is in the collection.- Specified by:
contains
in interfaceCollection<Variable>
- Specified by:
contains
in interfaceList<Variable>
- Overrides:
contains
in classAbstractCollection<Variable>
- Parameters:
o
- TheVariable
to locate in the collection. The value can be null.- Returns:
- true if [o] is found in the collection; otherwise, false.
-
add
public void add(int index, Variable item)
Inserts an element into the collection at the specified index.- Specified by:
add
in interfaceList<Variable>
- Overrides:
add
in classAbstractList<Variable>
- Parameters:
index
- The zero based index at which to add the element.item
- The item to insert. Cannot be null.- Throws:
NullPointerException
- Raised if [item] is null.IllegalStateException
- Raised if the new variable already belongs to a node.IllegalArgumentException
- index is less than 0.-or-index is equal to or greater than the collection count.
-
clear
public void clear()
Removes all elements from the collection.- Specified by:
clear
in interfaceCollection<Variable>
- Specified by:
clear
in interfaceList<Variable>
- Overrides:
clear
in classAbstractList<Variable>
-
remove
public boolean remove(Variable item)
Removes theVariable
from the collection.- Parameters:
item
- TheVariable
to 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 Variable remove(int index)
Removes an element from the collection at the specified index.- Specified by:
remove
in interfaceList<Variable>
- Overrides:
remove
in classAbstractList<Variable>
- 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.
-
set
public Variable set(int index, Variable value)
Sets theVariable
object at the specified index.
-
-