|
||||||||||
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.control.ControlModel
org.problets.domain.model.control.ConditionControl
org.problets.domain.model.control.selection.Selection
org.problets.domain.model.control.selection.SwitchModel
public class SwitchModel
Class: SwitchModel Purpose: Provides procedures to parse the switch cases and get the statement sequence by calling CaseModel. This class is also responsible for generating code and running the model
Field Summary | |
---|---|
static int |
IDENTITY
|
Fields inherited from class org.problets.domain.model.control.ConditionControl |
---|
INCORRECT_TYPE |
Fields inherited from class org.problets.domain.model.control.ControlModel |
---|
ABORT_EXECUTION, BREAK_EXECUTION, CONTINUE_EXECUTION, END_EXECUTION, INFINITE_EXECUTION, RETURN_EXECUTION, RUN_TIME_ERROR_EXECUTION, SKIP_EXECUTION |
Constructor Summary | |
---|---|
SwitchModel(ActivationRecord parent,
HeapModel heap,
java.lang.String in_template)
Constructor |
Method Summary | |
---|---|
ExecutionStatus |
explainProcess(RunEnv runEnv,
Behavior behavior,
boolean stepFlag)
public int explainProcess( RunEnv runEnv, Behavior behavior, boolean stepFlag) Extracts the cases from the caseVector and sends it to the explainProcess of CaseModel so that CaseModel can explain the case. |
void |
getCode(java.util.Vector codeText,
OutputStream output)
public void getCode(Vector codeText, OutputStream output) Generate the Switch clause and display it on the screen |
java.lang.String |
getNestedSwitchStatement(java.lang.String switchBody,
int indexFinder)
public void getNestedSwitchStatement(switchBody, indexFinder) Parses nested Switch clause within the main switch |
static boolean |
grade(java.lang.String template,
java.lang.String studentCode)
Grade is used for checking student's code compared to the actual code. |
static boolean |
gradeOld(java.lang.String template,
java.lang.String studentCode)
Grade is used for checking student's code compared to the actual code. |
java.util.Vector |
postProcessStatements(java.lang.String template)
Post-processes the result of TemplateParser.getNextStatement() to correctly handle case, default, and nested switch statements |
Methods inherited from class org.problets.domain.model.control.selection.Selection |
---|
main |
Methods inherited from class org.problets.domain.model.control.ConditionControl |
---|
getPossibleErrors |
Methods inherited from class org.problets.domain.model.control.ControlModel |
---|
getCodeLength, getName, getStartLineNumber |
Methods inherited from class org.problets.domain.model.DomainModel |
---|
clone, getId, getIdName |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int IDENTITY
Constructor Detail |
---|
public SwitchModel(ActivationRecord parent, HeapModel heap, java.lang.String in_template)
parent
- - the nested scope's parent activation recordheap
- - the heap to be usedin_template
- - the template to be parsedMethod Detail |
---|
public java.util.Vector postProcessStatements(java.lang.String template)
template
- - complete switch template to be parsed
public java.lang.String getNestedSwitchStatement(java.lang.String switchBody, int indexFinder)
switchBody
- - Current template for the switch clauseindexFinder
- - Starting location of the nested switch
public void getCode(java.util.Vector codeText, OutputStream output)
getCode
in class ControlModel
codeText
- - a Vector that holds the codeoutput
- - For outputting the code on the screenpublic ExecutionStatus explainProcess(RunEnv runEnv, Behavior behavior, boolean stepFlag)
explainProcess
in class ControlModel
runEnv
- - Run Environment of the programbehavior
- - behavior of the programstepFlag
- - execution flag
public static boolean grade(java.lang.String template, java.lang.String studentCode)
public static boolean gradeOld(java.lang.String template, java.lang.String studentCode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |