Class Evaluator
java.lang.Object
visitor.Visitor
visitor.Evaluator
Evaluation is a concrete visitor that serves to
compute and evaluate the results of arithmetic expressions.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetter method to obtain the result of the evaluationvoidThe Visitor can traverse a Complex number (a subtype of Expression)voidvisit(IntegerAtom i) The Visitor can traverse an Integer (a subtype of Expression)voidThe Visitor can traverse a Rationnal number (a subtype of Expression)voidUse the visitor design pattern to visit a Real.voidThe Visitor can traverse a binary function (a subtype of Expression)voidThe Visitor can traverse an unary function (a subtype of Expression)voidUse the visitor design pattern to visit an operation
-
Constructor Details
-
Evaluator
public Evaluator()Default constructor of the class. Does not initialise anything.
-
-
Method Details
-
getResult
getter method to obtain the result of the evaluation- Returns:
- an Integer object containing the result of the evaluation
-
visit
-
visit
Description copied from class:VisitorThe Visitor can traverse an Integer (a subtype of Expression) -
visit
-
visit
-
visit
-
visit
Description copied from class:VisitorThe Visitor can traverse an unary function (a subtype of Expression) -
visit
Description copied from class:VisitorThe Visitor can traverse a binary function (a subtype of Expression)
-