org.problets.domain.model.control
Class ControlModel

java.lang.Object
  extended by org.problets.domain.model.DomainModel
      extended by org.problets.domain.model.control.ControlModel
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
ConditionControl, Scope

public abstract class ControlModel
extends DomainModel

A Wrapper class for different control statements i.e. if/else for-loops, switch-case

Author:
Greg Tomalesky

Field Summary
static int ABORT_EXECUTION
           
static int BREAK_EXECUTION
           
static int CONTINUE_EXECUTION
           
static int END_EXECUTION
           
static int INFINITE_EXECUTION
           
static int RETURN_EXECUTION
           
static int RUN_TIME_ERROR_EXECUTION
           
static int SKIP_EXECUTION
           
 
Fields inherited from class org.problets.domain.model.DomainModel
BOOLEAN, BREAKPOINT, CHARACTER, DOUBLE_PRECISION_REAL, ERROR_TYPE, EVAL_STATUS, expACTION, expASSIGNMENT, expAUTO_DEALLOCATION, expCALL, expCONDITION, expDECLARATION, expDEREFERENCING, expDYNAMIC_ALLOCATION, expDYNAMIC_ALLOCATION_INITIALIZATION, expDYNAMIC_DEALLOCATION, expELSE_CLAUSE, expERROR, expEXECUTION, expIF_CLAUSE, expINITIALIZATION, expINPUT, expPARAMETER_PASSING, expPRINT, expQUESTIONABLE, expREFERENCING, expRETURN, expRUNTIME_ERROR, expSEMANTIC_ERROR, expSYNTAX_ERROR, expUPDATE, IDENTITY, MAX_OBJECT_IDENTITY, MIN_OBJECT_IDENTITY, QUADRUPLE_PRECISION_REAL, RUNTIME_ERROR, SEMANTIC_ERROR, SIGNED_INTEGER, SIGNED_LONG, SIGNED_SHORT, SINGLE_PRECISION_REAL, SYNTAX_ERROR, UNDEFINED_TYPE, UNSIGNED_INTEGER, UNSIGNED_LONG, UNSIGNED_SHORT, WARNING
 
Constructor Summary
ControlModel(java.lang.String inTemplate)
           
 
Method Summary
 ExecutionStatus explainProcess(RunEnv runEnv, Behavior behavior, boolean stepFlag)
          public void explainProcess(Vector explanation, Vector errors, int lineNumber); Generate the explanation for the control object
 void getCode(java.util.Vector codeText, OutputStream output)
          public void getCode(Vector codeText, String template, int lineNumber); Generate the code for the control object
 int getCodeLength()
          public int getTotalBlockSize(); Return the total number of lines for the control object
 java.lang.String getName()
          Get the name of this control construct - for generation of error menus
abstract  java.lang.String[] getPossibleErrors()
          Method to return errors for variables May want to post-process based on Student Model
 int getStartLineNumber()
          Method to return the starting line number of this scope in the code
static void main(java.lang.String[] args)
           
 
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

CONTINUE_EXECUTION

public static final int CONTINUE_EXECUTION
See Also:
Constant Field Values

END_EXECUTION

public static final int END_EXECUTION
See Also:
Constant Field Values

RETURN_EXECUTION

public static final int RETURN_EXECUTION
See Also:
Constant Field Values

BREAK_EXECUTION

public static final int BREAK_EXECUTION
See Also:
Constant Field Values

SKIP_EXECUTION

public static final int SKIP_EXECUTION
See Also:
Constant Field Values

ABORT_EXECUTION

public static final int ABORT_EXECUTION
See Also:
Constant Field Values

INFINITE_EXECUTION

public static final int INFINITE_EXECUTION
See Also:
Constant Field Values

RUN_TIME_ERROR_EXECUTION

public static final int RUN_TIME_ERROR_EXECUTION
See Also:
Constant Field Values
Constructor Detail

ControlModel

public ControlModel(java.lang.String inTemplate)
Method Detail

getCodeLength

public int getCodeLength()
public int getTotalBlockSize(); Return the total number of lines for the control object

Parameters:
- - none
Returns:
- the total number of lines

getStartLineNumber

public int getStartLineNumber()
Method to return the starting line number of this scope in the code


getName

public java.lang.String getName()
Get the name of this control construct - for generation of error menus


getPossibleErrors

public abstract java.lang.String[] getPossibleErrors()
Method to return errors for variables May want to post-process based on Student Model


getCode

public void getCode(java.util.Vector codeText,
                    OutputStream output)
public void getCode(Vector codeText, String template, int lineNumber); Generate the code for the control object

Parameters:
codeText - - a Vector that holds the code

explainProcess

public ExecutionStatus explainProcess(RunEnv runEnv,
                                      Behavior behavior,
                                      boolean stepFlag)
public void explainProcess(Vector explanation, Vector errors, int lineNumber); Generate the explanation for the control object

Parameters:
explanation - - a Vector for the explanation of the code
errors - - a Vector to hold any errors
lineNumber - - line number of code we are explaining
Returns:
status of execution, as designated by constants in DomainModel

main

public static void main(java.lang.String[] args)