org.problets.domain.model.control.iteration
Class AbstractLoopModel

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.ConditionControl
              extended by org.problets.domain.model.control.iteration.AbstractLoopModel
All Implemented Interfaces:
java.lang.Cloneable
Direct Known Subclasses:
DoWhileModel, ForLoopModel, WhileModel

public abstract class AbstractLoopModel
extends ConditionControl

Class: AbstractLoopModel Purpose: Base class for loop models, including a for loop, a while loop, and a do..while loop

Author:
Garrett Dancik, Gregory Tomalesky, Amruth Kumar

Field Summary
static java.lang.String ASSIGNMENT_IN_CONDITION
           
static java.lang.String CONST_CONDITION
           
static java.lang.String DECLARATION_IN_CONDITION
           
static java.lang.String INCORRECT_UPDATE
           
static java.lang.String NO_UPDATE
          The errors of interest for loops
static java.lang.String NULL_CONDITION
           
static java.lang.String TERMINAL_MODIFIED
           
 
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
 
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
AbstractLoopModel(java.lang.String inTemplate)
          public AbstractLoopModel(int startingIteration); This is the contstructor for the AbstractLoopModel.
 
Method Summary
 void getLoopValues(java.util.Vector condVarVector, java.util.Vector condValueVector)
          public void getLoopValues(Vector condVarVector, Vector condValueVector) This function determines whether or not a condition has left/right hand sides or not.
 java.lang.String[] getPossibleErrors()
          Method to return errors for variables May want to post-process based on Student Model
static void main(java.lang.String[] args)
           
 
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

NO_UPDATE

public static final java.lang.String NO_UPDATE
The errors of interest for loops

See Also:
Constant Field Values

INCORRECT_UPDATE

public static final java.lang.String INCORRECT_UPDATE
See Also:
Constant Field Values

TERMINAL_MODIFIED

public static final java.lang.String TERMINAL_MODIFIED
See Also:
Constant Field Values

DECLARATION_IN_CONDITION

public static final java.lang.String DECLARATION_IN_CONDITION
See Also:
Constant Field Values

ASSIGNMENT_IN_CONDITION

public static final java.lang.String ASSIGNMENT_IN_CONDITION
See Also:
Constant Field Values

NULL_CONDITION

public static final java.lang.String NULL_CONDITION
See Also:
Constant Field Values

CONST_CONDITION

public static final java.lang.String CONST_CONDITION
See Also:
Constant Field Values
Constructor Detail

AbstractLoopModel

public AbstractLoopModel(java.lang.String inTemplate)
public AbstractLoopModel(int startingIteration); This is the contstructor for the AbstractLoopModel. It will initialize the number of iterations present in the loop, as well as set all flags to false and all Strings to "";

Parameters:
startingIteration - - the number of times the loop has iterated
Method Detail

getPossibleErrors

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

Overrides:
getPossibleErrors in class ConditionControl

getLoopValues

public void getLoopValues(java.util.Vector condVarVector,
                          java.util.Vector condValueVector)
public void getLoopValues(Vector condVarVector, Vector condValueVector) This function determines whether or not a condition has left/right hand sides or not. If so, it places the value from the lhs into condVarVector and the rhs value int condValueVector. If there are no sides, we take the value of the statement and place in both vectors

Parameters:
condVarVector - - a vector holding the left hand side Value object
condValueVector - - a vector holding the right hand side Value object

main

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