Class 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).
    • Method Detail

      • indexOf

        public int indexOf​(Variable item)
        Determines the index of a specific Variable in 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 specific Variable in 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 a Variable is in the collection.
        Parameters:
        variable - The Variable to 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 a Variable is in the collection at the specified [time].
        Parameters:
        variable - The Variable to 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.