org.problets.domain.model.expression.node.operator.misc
Class Parenthesis

java.lang.Object
  extended by org.problets.domain.model.DomainModel
      extended by org.problets.domain.model.expression.node.NodeModel
          extended by org.problets.domain.model.expression.node.operator.Operator
              extended by org.problets.domain.model.expression.node.operator.misc.Parenthesis
All Implemented Interfaces:
java.lang.Cloneable

public class Parenthesis
extends Operator

To represent the parenthesis operator

Author:
Amruth Kumar

Field Summary
static boolean isSeparateStep
           
static java.lang.String SYMBOL
           
 
Fields inherited from class org.problets.domain.model.expression.node.operator.Operator
INCORRECT_OPERAND_COUNT
 
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
Parenthesis(java.lang.String inTemplate, ActivationRecord inActivationRecord)
           
 
Method Summary
 Value evaluate()
          Method to detect any errors before subclasses evaluate expressions Not to be used by client.
 void explain(java.util.Vector explanation, java.util.Vector errors)
          Textually explains the evaluation of the tree - as opposed to graphical explanation by the view.
 java.lang.String getEmbeddedContent()
           
 Expression getExpression()
          Returns reference to embedded expression
 java.lang.String getNonRecursiveContent()
          Return just the sub-expression corresponding to this node
 java.lang.String getQualifiedLearningObject()
          Method returns the name of the operator, disambiguated enough so that it can be easily credited in the student model.
 java.lang.String getRecursiveContent()
           
 NodeModel getStudentCopy()
          Called by ParenthesizedStudentNodeView
static void main(java.lang.String[] args)
           
 void recursiveSetValue(java.lang.String inValue)
          Overrides NodeModel's function - do not call this function directly, call NodeModel.skip() or NodeModel.shortCircuit() instead
 void setExpression(Expression inExpression)
          Called by ParenthesisView when reconstructing student's answer from bailed over operands
 
Methods inherited from class org.problets.domain.model.expression.node.operator.Operator
clone, coerceToReal, contentEquals, contentEquals, getArity, getAssociativity, getLocalLearningObjectives, getOperatorType, getPrecedence, getSymbol, grade, locateOperator, recursiveContentEquals
 
Methods inherited from class org.problets.domain.model.expression.node.NodeModel
classifyNodes, getContent, getLeftChild, getOrder, getPosition, getRightChild, getSideEffects, getValue, insertInOrder, setLeftChild, setOrder, setPosition, setRightChild, setValue, shortCircuit, skip, subExpToString, toString, valueEquals
 
Methods inherited from class org.problets.domain.model.DomainModel
getId, getIdName, grade
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

isSeparateStep

public static boolean isSeparateStep

SYMBOL

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

Parenthesis

public Parenthesis(java.lang.String inTemplate,
                   ActivationRecord inActivationRecord)
Method Detail

getRecursiveContent

public java.lang.String getRecursiveContent()
Overrides:
getRecursiveContent in class NodeModel

getExpression

public Expression getExpression()
Returns reference to embedded expression


getEmbeddedContent

public java.lang.String getEmbeddedContent()

getStudentCopy

public NodeModel getStudentCopy()
Called by ParenthesizedStudentNodeView

Overrides:
getStudentCopy in class Operator

getQualifiedLearningObject

public java.lang.String getQualifiedLearningObject()
Method returns the name of the operator, disambiguated enough so that it can be easily credited in the student model.

Overrides:
getQualifiedLearningObject in class Operator

getNonRecursiveContent

public java.lang.String getNonRecursiveContent()
Return just the sub-expression corresponding to this node

Overrides:
getNonRecursiveContent in class NodeModel

setExpression

public void setExpression(Expression inExpression)
Called by ParenthesisView when reconstructing student's answer from bailed over operands


recursiveSetValue

public void recursiveSetValue(java.lang.String inValue)
Overrides NodeModel's function - do not call this function directly, call NodeModel.skip() or NodeModel.shortCircuit() instead

Overrides:
recursiveSetValue in class Operator

evaluate

public Value evaluate()
Description copied from class: Operator
Method to detect any errors before subclasses evaluate expressions Not to be used by client. Checks if both operands are valid Inherited by all except assignment and boolean operators

Overrides:
evaluate in class Operator

explain

public void explain(java.util.Vector explanation,
                    java.util.Vector errors)
Textually explains the evaluation of the tree - as opposed to graphical explanation by the view. IMPORTANT: Ideally, this should call expression.explainObject(); But, explainObject() returns a vector of ExplanationLine objects, not AbstractExpressionStep objects, and since parenthesis can be embedded in another expression, the upper level expression will throw a class cast exception when it tries to sortExpression().

Overrides:
explain in class Operator

main

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