Class TableAccessor

    • Constructor Detail

      • TableAccessor

        public TableAccessor​(Table table,
                             Variable[] order)
        Initializes a new instance of the TableAccessor class, allowing random 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].
        See Also:
        TableIterator
      • TableAccessor

        public TableAccessor​(Table table,
                             List<VariableContext> order)
        Initializes a new instance of the TableAccessor class, allowing random 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, defined using variable contexts. 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].
        See Also:
        TableIterator
      • TableAccessor

        public TableAccessor​(Table table,
                             VariableContextCollection order)
        Initializes a new instance of the TableAccessor class, allowing random 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].
      • TableAccessor

        public TableAccessor​(Table table,
                             Node[] order,
                             Integer[] times)
        Initializes a new instance of the TableAccessor class, allowing random 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 node 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].
      • TableAccessor

        public TableAccessor​(Table table,
                             Variable[] order,
                             Integer[] times)
        Initializes a new instance of the TableAccessor class, allowing random 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].
      • TableAccessor

        public TableAccessor​(Table table,
                             List<Variable> order,
                             List<Integer> times)
        Initializes a new instance of the TableAccessor class, allowing random 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].
      • TableAccessor

        public TableAccessor​(Table table,
                             Node[] order)
        Initializes a new instance of the TableAccessor class, allowing random 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].
        See Also:
        TableIterator
    • Method Detail

      • getTable

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

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

        public double get​(int[] states)
        Gets the underlying Table value, using states corresponding to the order of variables in the TableAccessor.
        Returns:
        The underlying Table value.
      • set

        public void set​(int[] states,
                        double value)
        Sets the underlying Table value, using states corresponding to the order of variables in the TableAccessor.
        Parameters:
        value - The underlying Table value.
      • get

        public double get​(int i)
        Gets the underlying Table value, specified i.
        Returns:
        The table value.
      • set

        public void set​(int i,
                        double value)
        Sets the underlying Table value, specified i.
        Parameters:
        value - The table value.
      • getStates

        public void getStates​(int i,
                              int[] states)
        Gets the states at the given position [i]. The position is relative to specified variable ordering in the TableAccessor.
        Parameters:
        i - The position at which to retrieve the states.
        states - A buffer for the states, which is overwritten by the method.
        Throws:
        NullPointerException - Raised if [states] is null.
        IllegalArgumentException - Raised if [states] is too short.
      • getState

        public int getState​(int i,
                            int node)
        Gets the state at the given position [i] for the node given by [node]. The position is relative to the specified variable ordering in the TableAccessor.
        Parameters:
        i - The position at which to retrieve the state.
        node - The node.
        Returns:
        The state.
      • getTableIndex

        public int getTableIndex​(int i)
        Gets the equivalent index in the underlying table that corresponds to the index in the accessor.
        Parameters:
        i - The accessor index.
        Returns:
        The equivalent underlying table index.