Commit 2a2ecb08 authored by Matthew Dawson's avatar Matthew Dawson
Browse files

Make the variables list have more useful names.

Make the input and output variable list have more useful names.  Before, they
carried either a legacy idea of what they might have been, or just generic and
confusing.
parent 5b619c9f
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -39,11 +39,11 @@ import java.util.List;
 */
public class Table {
    public Table(VariableCollection variables) {
        this.variables = variables;
        this.inputVariables = variables;
    }

    public void verifyTable() throws IllegalTableSetup {
        if (variableNames.size() != variableOutputs.size()) {
        if (outputVariables.size() != variableOutputs.size()) {
            throw new IllegalTableSetup("The number of output variables and the number of outputs disagree!");
        }

@@ -52,13 +52,13 @@ public class Table {
        for (int i = 0; i < variableOutputs.size(); ++i) {
            TwoDimensionalGrid output = variableOutputs.get(i);
            if (output.sizeX() != topCount || output.sizeY() != leftCount) {
                throw new IllegalTableSetup("There are a different number of outputs then conditions for variable " + variableNames.get(i) + "!");
                throw new IllegalTableSetup("There are a different number of outputs then conditions for variable " + outputVariables.get(i) + "!");
            }
        }
    }

    public VariableCollection getVariables() {
        return variables;
    public VariableCollection getInputVariables() {
        return inputVariables;
    }

    public HierarchicalGrid getLeftGrid() {
@@ -73,14 +73,14 @@ public class Table {
        return variableOutputs;
    }

    public List<Variable> getVariableNames() {
        return variableNames;
    public List<Variable> getOutputVariables() {
        return outputVariables;
    }

    private VariableCollection variables;
    private VariableCollection inputVariables;
    private final HierarchicalGrid leftGrid = new HierarchicalGrid();
    private final HierarchicalGrid topGrid = new HierarchicalGrid();
    private final List<TwoDimensionalGrid> variableOutputs = new ArrayList<TwoDimensionalGrid>();
    private final List<Variable> variableNames = new ArrayList<Variable>();
    private final List<Variable> outputVariables = new ArrayList<Variable>();

}
+3 −3
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class TableTest {
    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithTooManyVariables() throws IllegalTableSetup {
        Table t = new Table(null);
        t.getVariableNames().add(new Variable("a", null));
        t.getOutputVariables().add(new Variable("a", null));

        t.verifyTable();
    }
@@ -56,7 +56,7 @@ public class TableTest {
    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithWrongTopSize() throws IllegalTableSetup {
        Table t = new Table(null);
        t.getVariableNames().add(new Variable("a", null));
        t.getOutputVariables().add(new Variable("a", null));
        t.getVariableOutputs().add(new TwoDimensionalGrid());

        t.getLeftGrid().getSubHiearchy().add(new HierarchicalCell());
@@ -69,7 +69,7 @@ public class TableTest {
    @Test(expected = IllegalTableSetup.class)
    public void testVerifyTableWithWrongLeftSize() throws IllegalTableSetup {
        Table t = new Table(null);
        t.getVariableNames().add(new Variable("a", null));
        t.getOutputVariables().add(new Variable("a", null));
        t.getVariableOutputs().add(new TwoDimensionalGrid());
        t.getVariableOutputs().get(0).resize(2, 5);