edu.cornell.cs.sam.core.instructions
Interface Instruction

All Known Implementing Classes:
SAM_ADD, SAM_ADDF, SAM_ADDSP, SAM_AND, SAM_BITAND, SAM_BITNAND, SAM_BITNOR, SAM_BITNOT, SAM_BITOR, SAM_BITXOR, SAM_CMP, SAM_CMPF, SAM_DIV, SAM_DIVF, SAM_DUP, SAM_EQUAL, SAM_FREE, SAM_FTOI, SAM_FTOIR, SAM_GREATER, SAM_ISNEG, SAM_ISNIL, SAM_ISPOS, SAM_ITOF, SAM_JSR, SAM_JSRIND, SAM_JUMP, SAM_JUMPC, SAM_JUMPIND, SAM_LESS, SAM_LINK, SAM_LSHIFT, SAM_LSHIFTIND, SAM_MALLOC, SAM_MOD, SAM_NAND, SAM_NOR, SAM_NOT, SAM_OR, SAM_POPFBR, SAM_POPSP, SAM_PUSHABS, SAM_PUSHFBR, SAM_PUSHIMM, SAM_PUSHIMMCH, SAM_PUSHIMMF, SAM_PUSHIMMMA, SAM_PUSHIMMPA, SAM_PUSHIMMSTR, SAM_PUSHIND, SAM_PUSHOFF, SAM_PUSHSP, SAM_READ, SAM_READCH, SAM_READF, SAM_READSTR, SAM_RSHIFT, SAM_RSHIFTIND, SAM_RST, SAM_SKIP, SAM_STOP, SAM_STOREABS, SAM_STOREIND, SAM_STOREOFF, SAM_SUB, SAM_SUBF, SAM_SWAP, SAM_TIMES, SAM_TIMESF, SAM_UNLINK, SAM_WRITE, SAM_WRITECH, SAM_WRITEF, SAM_WRITESTR, SAM_XOR, SamAddressInstruction, SamCharInstruction, SamFloatInstruction, SamInstruction, SamIntInstruction, SamStringInstruction

public interface Instruction

Interface for an instruction to be executed


Method Summary
 void exec()
          Executes the instruction
 java.lang.String getName()
          Gets the name of this instruction
 Program getProgram()
          Gets the program that this instruction is part of
 Sys getSystem()
          Gets the System object of this instruction
 void setProgram(Program prog)
          Sets the program that this instruction is part of
 void setSystem(Sys sys)
          Sets the System object for this instruction
 java.lang.String toString()
          Prints out the text that represents this SaM instruction
 

Method Detail

toString

java.lang.String toString()
Prints out the text that represents this SaM instruction

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this instruction

getName

java.lang.String getName()
Gets the name of this instruction

Returns:
The SaM name of this instruction

setSystem

void setSystem(Sys sys)
Sets the System object for this instruction

Parameters:
sys - The system object for this instruction

getSystem

Sys getSystem()
Gets the System object of this instruction

Returns:
The system object for this instruction

setProgram

void setProgram(Program prog)
Sets the program that this instruction is part of

Parameters:
prog - The program containing this instruction

getProgram

Program getProgram()
Gets the program that this instruction is part of

Returns:
The program containing this instruction

exec

void exec()
          throws SystemException
Executes the instruction

Throws:
SystemException - if there is a runtime error