org.problets.domain.model.variable.aggregate
Class ErrorVarModel

java.lang.Object
  extended by org.problets.domain.model.DomainModel
      extended by org.problets.domain.model.variable.AbstractVarModel
          extended by org.problets.domain.model.variable.aggregate.ErrorVarModel
All Implemented Interfaces:
java.lang.Cloneable

public class ErrorVarModel
extends AbstractVarModel

Class: ErrorVarModel Purpose: This class acts as a place holder for non-existent variables. For example, when an out of bounds access to an array occurs, an object of this class will be returned.


Field Summary
 
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
ErrorVarModel(java.lang.String inputName, java.lang.String inputType)
          Creates a new error variable
 
Method Summary
 void explainObject(StackModel stack, HeapModel heap, Behavior behavior, java.lang.String statement, int event, int lineNumber, boolean abbreviated)
          To generate error messages for arrays after execution.
 void explainProcess(RunEnv runEnv, Behavior behavior, java.lang.String statement, int event, int lineNumber)
          Executes a statement and provides an explanation based on what type of statement was executed.
 void getCode(java.util.Vector codeText, java.lang.String codeType, java.lang.String template, int lineNumber)
          Generates code for the template before execution
 java.lang.String[] getPossibleErrors()
          Returns the possible errors for this variable
static void main(java.lang.String[] args)
          For Debugging
 void print()
          Prints the value of the error variable
 void setName(java.lang.String inName)
          Assigns the name of the ErrorVarModel.
 
Methods inherited from class org.problets.domain.model.variable.AbstractVarModel
clone, getAllocated, getAssigned, getDeclared, getMetaDataType, getName, getType, getValue, getValueDifference, resetAllocated, resetDeclared, resetFlags, setAllocated, setDeclared, setValue
 
Methods inherited from class org.problets.domain.model.DomainModel
getId, getIdName, grade
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ErrorVarModel

public ErrorVarModel(java.lang.String inputName,
                     java.lang.String inputType)
Creates a new error variable

Parameters:
inputName - the name of the error variable
inputType - the type of the variable this error variable models
Method Detail

setName

public void setName(java.lang.String inName)
Assigns the name of the ErrorVarModel. Used by ArrayModel.getElement

Parameters:
inName - the new name for the ErrorVarModel

getCode

public void getCode(java.util.Vector codeText,
                    java.lang.String codeType,
                    java.lang.String template,
                    int lineNumber)
Generates code for the template before execution

Specified by:
getCode in class AbstractVarModel
Parameters:
codeText - the actual code
codeType - the type of code
template - the template to create the code for
lineNumber - the line number of the statement

getPossibleErrors

public java.lang.String[] getPossibleErrors()
Returns the possible errors for this variable

Specified by:
getPossibleErrors in class AbstractVarModel
Returns:
the possible errors for this variable

explainProcess

public void explainProcess(RunEnv runEnv,
                           Behavior behavior,
                           java.lang.String statement,
                           int event,
                           int lineNumber)
Executes a statement and provides an explanation based on what type of statement was executed.

Specified by:
explainProcess in class AbstractVarModel
Parameters:
runEnv - The run time environment
behavior - The current behavior
statement - The statement to execute
event - The event of execution (ex. initialization, assignment, referencing,...)
lineNumber - The line number of the statement

explainObject

public void explainObject(StackModel stack,
                          HeapModel heap,
                          Behavior behavior,
                          java.lang.String statement,
                          int event,
                          int lineNumber,
                          boolean abbreviated)
To generate error messages for arrays after execution.

Specified by:
explainObject in class AbstractVarModel
Parameters:
stack - the runtime stack
heap - the runtime heap
behavior - the current behavior
statement - the statement
event - the execution event
lineNumber - the line number of the statement
abbreviated - switch for abreviated explanations

print

public void print()
Prints the value of the error variable

Specified by:
print in class AbstractVarModel

main

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

Parameters:
args - args