|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.problets.domain.model.DomainModel
org.problets.domain.model.expression.node.NodeModel
org.problets.domain.model.expression.node.operator.Operator
public class Operator
To hold one operator in the expression tree
Field Summary | |
---|---|
static java.lang.String |
INCORRECT_OPERAND_COUNT
|
Constructor Summary | |
---|---|
Operator()
|
|
Operator(java.lang.String inOperatorType,
java.lang.String inSymbol,
int inPrecedence,
java.lang.String inAssociativity,
int inArity)
|
Method Summary | |
---|---|
java.lang.Object |
clone()
Returns a bitwise/shallow copy of this node |
boolean |
coerceToReal(Value left,
Value right)
Returns true if there is a need to coerce, and false otherwise |
boolean |
contentEquals(NodeModel rightOp)
Method overrides NodeModel's contentEquals - it considers the content of this node and its left and right child. |
boolean |
contentEquals(NodeModel rightOp,
int depth)
This will be called by contentEquals() and recursiveContentEquals() with appropriate values for depth |
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 |
int |
getArity()
|
java.lang.String |
getAssociativity()
|
void |
getLocalLearningObjectives(java.util.Vector learnObjVector)
Method adds all the local learning objectives (except precedence and associativity) to the vector passed as parameter The answer being correct is a learning objective applicable to ALL operators |
java.lang.String |
getOperatorType()
|
int |
getPrecedence()
|
java.lang.String |
getQualifiedLearningObject()
Method serves as the base class for inherited classes |
NodeModel |
getStudentCopy()
Method returns a copy of this node with only shareable values, resetting the others - Method used by StudentNodeModel to make a copy of the correct node for the student's answer |
java.lang.String |
getSymbol()
|
boolean |
grade(java.lang.String actualTemplate,
java.lang.String studentCode,
java.util.Vector explanation)
Grades the studentCode according to the actualTemplate, returns true if correct, and false otherwise |
int |
locateOperator(java.lang.String actualTemplate)
|
static void |
main(java.lang.String[] args)
|
boolean |
recursiveContentEquals(NodeModel rightOp)
Recursively checks the contents of two trees - used by And/Or to compare bailed out right expressions. |
void |
recursiveSetValue(java.lang.String inValue)
Overrides NodeModel's function - do not call this function directly, call NodeModel.skip() or NodeModel.shortCircuit() instead |
Methods inherited from class org.problets.domain.model.expression.node.NodeModel |
---|
classifyNodes, getContent, getLeftChild, getNonRecursiveContent, getOrder, getPosition, getRecursiveContent, 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 |
---|
public static final java.lang.String INCORRECT_OPERAND_COUNT
Constructor Detail |
---|
public Operator(java.lang.String inOperatorType, java.lang.String inSymbol, int inPrecedence, java.lang.String inAssociativity, int inArity)
public Operator()
Method Detail |
---|
public java.lang.Object clone()
clone
in class NodeModel
public java.lang.String getSymbol()
public int getPrecedence()
public java.lang.String getAssociativity()
public int getArity()
public java.lang.String getOperatorType()
public void getLocalLearningObjectives(java.util.Vector learnObjVector)
public java.lang.String getQualifiedLearningObject()
public boolean contentEquals(NodeModel rightOp, int depth)
contentEquals
in class NodeModel
public boolean contentEquals(NodeModel rightOp)
contentEquals
in class NodeModel
public boolean recursiveContentEquals(NodeModel rightOp)
public NodeModel getStudentCopy()
getStudentCopy
in class NodeModel
public void recursiveSetValue(java.lang.String inValue)
recursiveSetValue
in class NodeModel
public boolean grade(java.lang.String actualTemplate, java.lang.String studentCode, java.util.Vector explanation)
grade
in class NodeModel
public boolean coerceToReal(Value left, Value right)
public Value evaluate()
evaluate
in class NodeModel
public void explain(java.util.Vector explanation, java.util.Vector errors)
explain
in class NodeModel
public int locateOperator(java.lang.String actualTemplate)
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |