|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cornell.cs.sam.core.SamProgram
public class SamProgram
Implementation of Program using an ArrayList for storage. See Program interface for more information
Constructor Summary | |
---|---|
SamProgram()
|
Method Summary | |
---|---|
void |
addInst(Instruction i)
Add instruction to the program |
void |
addInst(Instruction[] arr)
Add multiple instructions to the program |
Instruction |
getInst(int pos)
Get instruction at specificed location |
java.util.List<Instruction> |
getInstList()
Get all instructions as a list |
int |
getLength()
Gets total number of instructions in program |
ReferenceTable |
getReferenceTable()
Returns the references table |
SymbolTable |
getSymbolTable()
Returns the symbol table |
boolean |
isExecutable()
Returns whether this program can be executed - it is executable if all symbols have been resolved. |
void |
resolveReferences()
Resolves references in this program from the symbol table |
void |
resolveReferencesFrom(Program prog)
Resolves prog's references from the symbol table |
void |
setReferenceTable(ReferenceTable table)
Sets the references table |
void |
setSymbolTable(SymbolTable table)
Sets the symbol table |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SamProgram()
Method Detail |
---|
public Instruction getInst(int pos)
Program
getInst
in interface Program
pos
- The instruction address
public java.util.List<Instruction> getInstList()
Program
getInstList
in interface Program
public void addInst(Instruction i)
Program
addInst
in interface Program
i
- The instruction to addpublic void addInst(Instruction[] arr)
Program
addInst
in interface Program
arr
- An array of instructions to addpublic int getLength()
Program
getLength
in interface Program
public SymbolTable getSymbolTable()
Program
getSymbolTable
in interface Program
public ReferenceTable getReferenceTable()
Program
getReferenceTable
in interface Program
public void setSymbolTable(SymbolTable table)
Program
setSymbolTable
in interface Program
table
- The symbol table for this programpublic void setReferenceTable(ReferenceTable table)
Program
setReferenceTable
in interface Program
table
- The references table for this programpublic void resolveReferences()
Program
resolveReferences
in interface Program
public void resolveReferencesFrom(Program prog)
Program
resolveReferencesFrom
in interface Program
prog
- The program whose references to resolvepublic boolean isExecutable()
Program
isExecutable
in interface Program
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |