Class TableIterator

    • Constructor Detail

      • TableIterator

        public TableIterator​(Table table,
                             Variable[] order)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the variables.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the variables should be accessed. The last variable's states toggle fastest.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if order does not contain the same variables as [table].
      • TableIterator

        public TableIterator​(Table table,
                             Variable[] order,
                             Integer[] times)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the variables at specified times.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the variables should be accessed. The last variable's states toggle fastest.
        times - The times for the variables.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if order does not contain the same variables as [table].
      • TableIterator

        public TableIterator​(Table table,
                             List<Variable> order,
                             List<Integer> times)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the variables at specified times.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the variables should be accessed. The last variable's states toggle fastest.
        times - The times for the variables.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if order does not contain the same variables as [table].
      • TableIterator

        public TableIterator​(Table table,
                             Node[] order,
                             Integer[] times)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the node variables.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the node variables should be accessed. The last variable's states toggle fastest.
        times - The times for the variables.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if the nodes in order do not contain the same variables as [table].
      • TableIterator

        public TableIterator​(Table table,
                             VariableContextCollection order)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the variables. Any times that are contained within the VariableContextCollection will be used.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the variables should be accessed, including any timing information contained in the VariableContextCollection. The last variable's states toggle fastest.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if order does not contain the same variables as [table].
      • TableIterator

        public TableIterator​(Table table,
                             Node[] order)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the node variables.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the node variables should be accessed. The last variable's states toggle fastest.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if the nodes in order do not contain the same variables as [table].
      • TableIterator

        public TableIterator​(Table table,
                             List<VariableContext> order)
        Initializes a new instance of the TableIterator class, allowing sequential access to [table] with a specified [order] for the node variables.
        Parameters:
        table - The table whose values are to be accessed.
        order - The order in which the node variables should be accessed. The last variable's states toggle fastest.
        Throws:
        NullPointerException - Raised if either [table] or [order] is null.
        IllegalArgumentException - Raised if the variable-time combinations in order do not match those found in [table].
    • Method Detail

      • size

        public int size()
        Gets the count of values in the underlying Table.
        Returns:
        The count.
      • getTable

        public Table getTable()
        Gets the underlying Table.
        Returns:
        The underlying Table.
      • getValue

        public double getValue()
        Gets the underlying Table value at the current position of the iterator.
        Returns:
        The underlying Table value.
      • setValue

        public void setValue​(double value)
        Sets the underlying Table value at the current position of the iterator.
        Parameters:
        value - The underlying Table value.
      • increment

        public void increment()
        Moves the iterator to the next value, with respect to the TableIterator node order.
      • getRow

        public int getRow()
        Gets the current position of the iterator. For the position in the underlying Table see getTableRow().
        Returns:
        The row.
      • getTableRow

        public int getTableRow()
        Gets the position of the iterator in the underlying Table. For the position of the iterator see getRow().
        Returns:
        The table row.
      • copyFrom

        public void copyFrom​(double[] values)
        Resets the iterator and then copies values from an array into the underlying Table using the variable ordering of the TableIterator, not the Table.getSortedVariables(). At the end of the operation the iterator will be reset to the start.
        Parameters:
        values - An array of values to copy.
        Throws:
        NullPointerException - Raised if [values] is null.
        IllegalArgumentException - Raised if [values] is too short.
      • reset

        public void reset()
        Resets the iterator to the start.
      • getStates

        public void getStates​(int[] states)
        Gets the states of all nodes, based on the order of nodes in the TableIterator not the underlying Table.
        Parameters:
        states - A array, whose values will be replaced. The [states] array must have length equal to or greater than the node count in the underlying Table.
        Throws:
        NullPointerException - Raised if [states] is null.
        IllegalArgumentException - Raised if [states] is too short.
      • getState

        public int getState​(int i)
        Gets the state for an individual node indexed by the order of nodes in the TableIterator.
        Parameters:
        i - The node position, based on the order of nodes in the TableIterator.
        Returns:
        The state.