org.problets.domain.model.control.selection
Class DefaultCaseModel
java.lang.Object
org.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.CaseModel
org.problets.domain.model.control.selection.DefaultCaseModel
- All Implemented Interfaces:
- java.lang.Cloneable
public class DefaultCaseModel
- extends CaseModel
Class: DefaultCaseModel
Purpose: For default case, parses statements, blocks, and
nested switch statements and add it to StatementSequence or
block.
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 |
Method Summary |
java.lang.String |
getHeader()
Returns the header of the default case |
java.lang.String |
getProcessedExpression()
Processed version of caseValueExpression |
static boolean |
grade(java.lang.String template,
java.lang.String studentCode)
|
boolean |
matches(StackModel stack,
Value conditionValue)
public boolean matches( Value conditionValue )
Matches the value of switch condition and the case value |
Methods inherited from class org.problets.domain.model.control.selection.Selection |
main |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DefaultCaseModel
public DefaultCaseModel(ActivationRecord parent,
HeapModel heap,
java.lang.String in_template,
java.util.Vector statements)
- Constructor
- Parameters:
parent
- - the nested scope's parent activation recordheap
- - the heap to be usedin_template
- - the template to be parsedstatements
- - contains the cases and its statements
getProcessedExpression
public java.lang.String getProcessedExpression()
- Processed version of caseValueExpression
- Overrides:
getProcessedExpression
in class CaseModel
matches
public boolean matches(StackModel stack,
Value conditionValue)
- public boolean matches( Value conditionValue )
Matches the value of switch condition and the case value
- Overrides:
matches
in class CaseModel
- Parameters:
conditionValue
- - Integer value of the switch condition
- Returns:
- - True if the match is found else false
getHeader
public java.lang.String getHeader()
- Returns the header of the default case
- Overrides:
getHeader
in class CaseModel
grade
public static boolean grade(java.lang.String template,
java.lang.String studentCode)