Package uk.co.cogitolearning.cogpar
Class SetVariable
- java.lang.Object
-
- uk.co.cogitolearning.cogpar.SetVariable
-
- All Implemented Interfaces:
ExpressionNodeVisitor
public class SetVariable extends Object implements ExpressionNodeVisitor
A visitor that sets a variable with a specific name to a given value
-
-
Constructor Summary
Constructors Constructor Description SetVariable(String name, double value)Construct the visitor with the name and the value of the variable to set
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidvisit(AdditionExpressionNode node)Do nothingvoidvisit(ConstantExpressionNode node)Do nothingvoidvisit(ExponentiationExpressionNode node)Do nothingvoidvisit(FunctionExpressionNode node)Do nothingvoidvisit(MultiplicationExpressionNode node)Do nothingvoidvisit(VariableExpressionNode node)Checks the nodes name against the name to set and sets the value if the two strings match
-
-
-
Constructor Detail
-
SetVariable
public SetVariable(String name, double value)
Construct the visitor with the name and the value of the variable to set- Parameters:
name- the name of the variablevalue- the value of the variable
-
-
Method Detail
-
visit
public void visit(VariableExpressionNode node)
Checks the nodes name against the name to set and sets the value if the two strings match- Specified by:
visitin interfaceExpressionNodeVisitor
-
visit
public void visit(ConstantExpressionNode node)
Do nothing- Specified by:
visitin interfaceExpressionNodeVisitor
-
visit
public void visit(AdditionExpressionNode node)
Do nothing- Specified by:
visitin interfaceExpressionNodeVisitor
-
visit
public void visit(MultiplicationExpressionNode node)
Do nothing- Specified by:
visitin interfaceExpressionNodeVisitor
-
visit
public void visit(ExponentiationExpressionNode node)
Do nothing- Specified by:
visitin interfaceExpressionNodeVisitor
-
visit
public void visit(FunctionExpressionNode node)
Do nothing- Specified by:
visitin interfaceExpressionNodeVisitor
-
-