org.problets.domain.model.control.abstraction
Class Scope

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

public abstract class Scope
extends ControlModel

Models a scope object. Serves as the base class for Statement, StatementSequence, Block, Function and Program

Author:
Amruth Kumar

Field Summary
static int IDENTITY
          The identity of this class
static java.lang.String MISPLACED_BREAK
          Error corresponding to misplaced break statement
static java.lang.String MISPLACED_CONTINUE
          Error corresponding to misplaced continue statement
 
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
 
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, 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
Scope(ActivationRecord parentActivationRecord, HeapModel heap, java.lang.String inTemplate)
          Constructs a Scope object
 
Method Summary
 ActivationRecord getActivationRecord()
           
static java.lang.String getParameterCode(java.lang.String template, ActivationRecord activationRecord)
          Returns the code the actual parameters in a function call
 java.lang.String[] getPossibleErrors()
          Method to return errors for scope objects May want to post-process based on Student Model
static void main(java.lang.String[] args)
           
 ExecutionStatus newFunctionCall(RunEnv runEnv, Behavior behavior, java.lang.String statement, int codeLineNumber, boolean stepFlag)
          Calls the function and adds its explanation, output and errors to the respective vectors.
 
Methods inherited from class org.problets.domain.model.control.ControlModel
explainProcess, getCode, getCodeLength, getName, getStartLineNumber
 
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

IDENTITY

public static final int IDENTITY
The identity of this class

See Also:
Constant Field Values

MISPLACED_BREAK

public static final java.lang.String MISPLACED_BREAK
Error corresponding to misplaced break statement

See Also:
Constant Field Values

MISPLACED_CONTINUE

public static final java.lang.String MISPLACED_CONTINUE
Error corresponding to misplaced continue statement

See Also:
Constant Field Values
Constructor Detail

Scope

public Scope(ActivationRecord parentActivationRecord,
             HeapModel heap,
             java.lang.String inTemplate)
Constructs a Scope object

Parameters:
parentActivationRecord - ActivationRecord of the parent
heap - HeapModel that can be accessed by this scope object
inTemplate - String representing the template for this scope object
Method Detail

getActivationRecord

public ActivationRecord getActivationRecord()

getPossibleErrors

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

Specified by:
getPossibleErrors in class ControlModel

getParameterCode

public static java.lang.String getParameterCode(java.lang.String template,
                                                ActivationRecord activationRecord)
Returns the code the actual parameters in a function call


newFunctionCall

public ExecutionStatus newFunctionCall(RunEnv runEnv,
                                       Behavior behavior,
                                       java.lang.String statement,
                                       int codeLineNumber,
                                       boolean stepFlag)
Calls the function and adds its explanation, output and errors to the respective vectors. Returns execution status as defined by the constants in ControlModel.

Parameters:
statement - String in the format "( , );" (including ending semi-colon

main

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