Package com.bayesserver
Class VariableContextCollection
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<VariableContext>
-
- com.bayesserver.VariableContextCollection
-
- All Implemented Interfaces:
Iterable<VariableContext>,Collection<VariableContext>,List<VariableContext>
public final class VariableContextCollection extends AbstractList<VariableContext>
Represents a read-only collection of variables. Each variable in the collection may have an associated time if the Bayesian network is a Dynamic Bayesian network (DBN). A variable can only appear more than once in the collection if it has different times associated. All variables are marked as either head or tail. Head variables are those on the left, and tail variables are those on the right in the expression P(A|B).
-
-
Field Summary
-
Fields inherited from class java.util.AbstractList
modCount
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontains(Variable variable)Determines whether aVariableis in the collection.booleancontains(VariableContext variableContext, boolean ignoreHeadTail)Determines whether a variable-time (and optionally Head/Tail) combination is contained in the collection.booleancontains(Variable variable, Integer time)Determines whether aVariableis in the collection at the specified [time].booleancontainsAll(VariableContextCollection items, boolean ignoreHeadTail)Determines whether all [items] are matched in the collection.booleancontainsAll(List<Variable> items)Determines whether all [items] are matched in the collection.booleancontainsAll(List<Variable> items, List<Integer> times)Determines whether all [items] are matched in the collection.booleancontainsAll(List<VariableContext> items, boolean ignoreHeadTail)Determines whether all [items] are matched in the collection at the specified times.booleancontainsAny(VariableContextCollection items, boolean ignoreHeadTail)Determines whether any [items] are matched in the collection.booleancontainsAny(List<Variable> items, List<Integer> times)Determines whether any [items] are matched in the collection.VariableContextget(int index)Gets theVariableobject at the specified index.intindexOf(Variable item)Determines the index of a specificVariablein the collection.intindexOf(VariableContext variableContext, boolean ignoreHeadTail)Determines the index of a specific variable-time combination in the collection.intindexOf(Variable variable, Integer time)Determines the index of a specificVariablein the collection at the specified [time].VariableContextset(int index, VariableContext value)Gets theVariableobject at the specified index.intsize()Gets the number of elements contained in the collection.StringtoString()-
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
-
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
-
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, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
-
-
-
-
Method Detail
-
toString
public String toString()
- Overrides:
toStringin classAbstractCollection<VariableContext>- Returns:
- A
Stringthat represents the currentObject.
-
size
public int size()
Gets the number of elements contained in the collection.- Specified by:
sizein interfaceCollection<VariableContext>- Specified by:
sizein interfaceList<VariableContext>- Specified by:
sizein classAbstractCollection<VariableContext>
-
indexOf
public int indexOf(Variable item)
Determines the index of a specificVariablein the collection.- Parameters:
item- The variable to find. The value can be null.- Returns:
- The index of the variable or -1 if not found.
-
indexOf
public int indexOf(VariableContext variableContext, boolean ignoreHeadTail)
Determines the index of a specific variable-time combination in the collection.- Parameters:
variableContext- The variable context to match.ignoreHeadTail- When true, the Head and Tail specifications need not match.- Returns:
- The index of the variable or -1 if not found.
-
indexOf
public int indexOf(Variable variable, Integer time)
Determines the index of a specificVariablein the collection at the specified [time].- Parameters:
variable- The variable to find.time- The variable time. Can be null for non temporal variables.- Returns:
- The index of the variable or -1 if not found.
-
contains
public boolean contains(Variable variable)
Determines whether aVariableis in the collection.- Parameters:
variable- TheVariableto locate in the collection. The value can be null.- Returns:
- true if [variable] is found in the collection; otherwise, false.
-
contains
public boolean contains(VariableContext variableContext, boolean ignoreHeadTail)
Determines whether a variable-time (and optionally Head/Tail) combination is contained in the collection.- Parameters:
variableContext- The variableContext to match.ignoreHeadTail- When true, the Head and Tail specifications need not match.- Returns:
- True if a match is found; false otherwise.
-
contains
public boolean contains(Variable variable, Integer time)
Determines whether aVariableis in the collection at the specified [time].- Parameters:
variable- TheVariableto locate in the collection. The value can be null.time- The time associated with the variable, if any. Can be null.- Returns:
- true if [variable] is found in the collection; otherwise, false.
-
containsAll
public boolean containsAll(List<Variable> items)
Determines whether all [items] are matched in the collection.- Parameters:
items- The items to locate in the collection. Cannot be null.- Returns:
- true if all items were matched in the collection; otherwise, false.
- Throws:
NullPointerException- Raised when [items] is null.
-
containsAll
public boolean containsAll(List<Variable> items, List<Integer> times)
Determines whether all [items] are matched in the collection.- Parameters:
items- The items to locate in the collection. Cannot be null.times- The times associated with [items]. Can be null.- Returns:
- true if all items were matched in the collection; otherwise, false.
- Throws:
NullPointerException- Raised when [items] is null.
-
containsAll
public boolean containsAll(List<VariableContext> items, boolean ignoreHeadTail)
Determines whether all [items] are matched in the collection at the specified times.- Parameters:
items- The items to locate in the collection. Cannot be null.ignoreHeadTail- When true, head and tail specifications need not match.- Returns:
- true if all items were matched in the collection; otherwise, false.
- Throws:
NullPointerException- Raised when [items] is null.
-
containsAll
public boolean containsAll(VariableContextCollection items, boolean ignoreHeadTail)
Determines whether all [items] are matched in the collection.- Parameters:
items- The items to locate in the collection. Cannot be null.ignoreHeadTail- When true, the Head and Tail specifications need not match.- Returns:
- true if all items were matched in the collection; otherwise, false.
- Throws:
NullPointerException- Raised when [items] is null.
-
containsAny
public boolean containsAny(VariableContextCollection items, boolean ignoreHeadTail)
Determines whether any [items] are matched in the collection.- Parameters:
items- The items to locate in the collection. Cannot be null.ignoreHeadTail- When true, the Head and Tail specifications need not match.- Returns:
- true if any items were matched in the collection; otherwise, false.
- Throws:
NullPointerException- Raised when [items] is null.
-
containsAny
public boolean containsAny(List<Variable> items, List<Integer> times)
Determines whether any [items] are matched in the collection.- Parameters:
items- The items to locate in the collection. Cannot be null.times- The time for each variable. Each time can be null for non temporal variables. [times] can be null.- Returns:
- true if any items were matched in the collection; otherwise, false.
- Throws:
NullPointerException- Raised when [items] is null.
-
get
public VariableContext get(int index)
Gets theVariableobject at the specified index.- Specified by:
getin interfaceList<VariableContext>- Specified by:
getin classAbstractList<VariableContext>- Parameters:
index- The zero-based index of theVariableto find.- Returns:
- A
Variable.
-
set
public VariableContext set(int index, VariableContext value)
Gets theVariableobject at the specified index.- Specified by:
setin interfaceList<VariableContext>- Overrides:
setin classAbstractList<VariableContext>- Parameters:
index- The zero-based index of theVariableto find.- Returns:
- A
Variable.
-
-