Class Table

public class Table
extends Object
Stores information about reservation tables. There are also methods implemented that will help manipulate the contents of the tables. Calculation of PCV methods and collision detection methods are also implemented here.

Variables

o nRows
    private int nRows

        The number of rows in the reservation table.

o nCols
    private int nCols

        The number of columns in the reservation table.

o table
    private int table[][]

        A 2-dimensional integer array that is used to represent the reservation table.

o pcv
    private int pcv[]

        The pipeline collision vector.

o modified
    private boolean modified

        A variable that is used to signfy if the reservation table has been changed or not.

Constructors

o Table
    public Table(int nRows, int nCols)

        Creates a table with specified rows and columns.

Methods

o mark
    public void mark(int i, int j)

        Put a 1 in the 2-dimensional array at the position specified by the method parameters

o unmark
    public void unmark(int i, int j)

        Put a 0 in the 2-dimensional array at the position specified by the method parameters.

o getValue
    public int getValue(int i, int j)

        Returns the value of the 2-dimensional integer array at the position specified by the method parameters.

o setModified
    public void setModified(boolean value)

        Sets the value for the modified variable.

o isModified
    public boolean isModified()

        Returns true if the reservation table has been modified.

o collision
    public boolean collision(int x, int y, int[][] m)

            Check if there is a collision between table 'm' and the current table.

o collision
    public boolean collision(int shift, int[][] m)

            Check if there is a collision between current table with the shifted matrix.

o getPCV
    public int[] getPCV()

            Returns the pcv for the current table.

o getPCVString
    public String getPCVString()

            Returns the pcv for the current table as a String object.

o after
    public int[] after(int m[][])

             Returns the PCV given a reservation table
             For example:
             If the current reservation table is A and the paramter passed in represents reservation table B then this function
             will return the PCV for A after B

o getCols
    public int getCols()

            Returns the number of columns in the table.

o getCols
    public int getRows()

            Returns the number of rows in the table.

o getTable
    public int[][] getTable()

            Returns the 2-dimensional representation of the table.

o isEqual
    public boolean isEqual(Table t)

            Returns true if the current table has the same elements as Table t.



Send all bug reports and comments to tchou@elux3.cs.umass.edu