Commit 51d4fec4 authored by Yanjun Jiang's avatar Yanjun Jiang
Browse files

Add a new table name property for Table class.

This new table name property is added when generating EventB files, but
can be used for other purpose too.
parent d8916c57
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -38,7 +38,8 @@ import java.util.List;
 * @author Matthew Dawson <matthew@mjdsystems.ca>
 */
public class Table {
    public Table(VariableCollection variables) {
    public Table(String tableName, VariableCollection variables) {
        this.tableName = tableName;
        this.inputVariables = variables;
    }

@@ -57,6 +58,10 @@ public class Table {
        }
    }

    public String getTableName() {
        return tableName;
    }

    public VariableCollection getInputVariables() {
        return inputVariables;
    }
@@ -77,6 +82,7 @@ public class Table {
        return outputVariables;
    }

    private String tableName;
    private VariableCollection inputVariables;
    private final HierarchicalGrid leftGrid = new HierarchicalGrid();
    private final HierarchicalGrid topGrid = new HierarchicalGrid();
+4 −4
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ public class TableTest {

    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithTooManyVariables() throws IllegalTableSetup {
        Table t = new Table(null);
        Table t = new Table(null, null);
        t.getOutputVariables().add(new Variable("a", null));

        t.verifyTable();
@@ -47,7 +47,7 @@ public class TableTest {

    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithTooManyVariableOutputs() throws IllegalTableSetup {
        Table t = new Table(null);
        Table t = new Table(null, null);
        t.getVariableOutputs().add(new TwoDimensionalGrid());

        t.verifyTable();
@@ -55,7 +55,7 @@ public class TableTest {

    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithWrongTopSize() throws IllegalTableSetup {
        Table t = new Table(null);
        Table t = new Table(null, null);
        t.getOutputVariables().add(new Variable("a", null));
        t.getVariableOutputs().add(new TwoDimensionalGrid());

@@ -68,7 +68,7 @@ public class TableTest {

    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithWrongLeftSize() throws IllegalTableSetup {
        Table t = new Table(null);
        Table t = new Table(null, null);
        t.getOutputVariables().add(new Variable("a", null));
        t.getVariableOutputs().add(new TwoDimensionalGrid());
        t.getVariableOutputs().get(0).resize(2, 5);