|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.domain.model.DomainModel
org.problets.domain.model.CodeModel
public class CodeModel
CodeModel To generate the code for the problem
Field Summary | |
---|---|
static int |
BLOCK_SCOPE
|
static int |
FILE_SCOPE
|
static int |
FUNCTION_SCOPE
|
static int |
IDENTITY
|
static int |
PROGRAM_SCOPE
|
Constructor Summary | |
---|---|
CodeModel(Template inTemplate)
|
Method Summary | |
---|---|
boolean |
done()
Rewind through fast forward - Idea from Guido Rossling, SIGCSE 2005 Not used - DataVisualizer.rewind() subsumes this functtion public void rewind( int limit ) { // First, re-initialize the whole model, start execution init(); // Initialize a counter of the steps to be executed // - we have already executed first step in init() int instructionCounter = 2; while( instructionCounter <= limit ) { step(); instructionCounter++; } } |
void |
explain(Behavior behavior)
Version called by client, who wants to execute the original copy of the code |
int[] |
getAllLineNumbers()
Returns an array of all line numbers in the code |
Behavior |
getBehavior()
Returns a reference to the behavior of this program. |
void |
getCode(java.util.Vector codeText)
Called by: CodeView in constructor and set_code() methods Calls: Scope.getCode() method // COULD REUSE THISCODETEXT INSTEAD |
HeapModel |
getHeap()
Returns the heap of the current program - needed by CodeViz |
InputStream |
getInputStream()
Returns the input stream of the current program - needed by CodeViz |
Template |
getOriginalTemplate()
Returns a reference to the original template (before preprocessing) whose preprocessed version is used for this code |
java.lang.String |
getOutputAsString()
|
int[] |
getOutputLineNumbers()
Returns an array of line numbers corresponding to output statements in the code |
OutputStream |
getOutputStream()
Returns the output stream of the current program - needed by CodeViz |
Program |
getProgram()
Return a reference to the program in this code |
Behavior |
getSolution()
This method is more efficient than calling getBehavior() since this executes the code once and returns the result as many times as desired |
StackModel |
getStack()
Returns the stack of the current program - needed by CodeViz |
Behavior |
getStepBehavior()
Returns a reference to the behavior for stepping through a code |
RunEnv |
getStepRunEnv()
Returns a reference to the run time environment for stepping through a code |
Template |
getTemplate()
Returns a reference to the template used for this code - needed by TutorModel to obtain antecedents etc. |
void |
init()
Initializes the data structures to facilitate visualization, driven by the user. |
static void |
main(java.lang.String[] args)
|
void |
step()
|
void |
update(Template inTemplate)
The method that generates code for a new template This will be called by ProbletPanel for the codeModel, instead of allocating new codeModel |
Methods inherited from class org.problets.domain.model.DomainModel |
---|
clone, getId, getIdName, grade |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IDENTITY
public static final int PROGRAM_SCOPE
public static final int FILE_SCOPE
public static final int FUNCTION_SCOPE
public static final int BLOCK_SCOPE
Constructor Detail |
---|
public CodeModel(Template inTemplate)
Method Detail |
---|
public void getCode(java.util.Vector codeText)
public Template getTemplate()
public Template getOriginalTemplate()
public java.lang.String getOutputAsString()
public Program getProgram()
public StackModel getStack()
public HeapModel getHeap()
public InputStream getInputStream()
public OutputStream getOutputStream()
public RunEnv getStepRunEnv()
public Behavior getStepBehavior()
public Behavior getBehavior()
public Behavior getSolution()
public int[] getOutputLineNumbers()
public int[] getAllLineNumbers()
public void update(Template inTemplate)
public void explain(Behavior behavior)
public void init()
public void step()
public boolean done()
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |