jfrace
Class Statement

java.lang.Object
  |
  +--jfrace.Statement

public class Statement
extends java.lang.Object

Test statement. Helper class for CPUTestSuite. A test statement contains some registers or an address. These registers or address can be set to numerical values.

Author:
Franz-Josef Elmer.

Constructor Summary
Statement(java.lang.String statement, java.util.Hashtable regNames)
          Create a statement in accordance of the given statement string.
 
Method Summary
 boolean isDoubleEqualSign()
          Return true if '==' appeared instead of '='.
 void markTestedRegisters(boolean[] testedRegisters)
          Mark tested registers.
 java.lang.String setState(CPU cpu, AddressSpace as)
          Set the state of the given CPU or memory in accordance to this statement.
 void test(java.lang.StringBuffer sb, CPU cpu, AddressSpace as)
          Test the state of CPU and memory in accordance to this statement.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statement

public Statement(java.lang.String statement,
                 java.util.Hashtable regNames)
Create a statement in accordance of the given statement string.
Parameters:
statement - description string.
regNames - register names. Needed for obtaining the register index from the name.
Method Detail

isDoubleEqualSign

public boolean isDoubleEqualSign()
Return true if '==' appeared instead of '='.

setState

public java.lang.String setState(CPU cpu,
                                 AddressSpace as)
Set the state of the given CPU or memory in accordance to this statement.
Parameters:
cpu - CPU
as - address space of the memory
Returns:
null if no error. Otherwise an error message is returned.

test

public void test(java.lang.StringBuffer sb,
                 CPU cpu,
                 AddressSpace as)
Test the state of CPU and memory in accordance to this statement.
Parameters:
sb - an error message will be apend to this string buffer.
cpu - CPU
as - address space of the memory.

markTestedRegisters

public void markTestedRegisters(boolean[] testedRegisters)
Mark tested registers. Set the corresponding bit of testedRegisters for those registers which will be tested by the test method in accordance of the statement description given in the constructor.
Parameters:
testedRegisters - the length of this array has to be equal to the number of registers of the CPU.