Package Behavioral.Interpreter
Class Variable
java.lang.Object
Behavioral.Interpreter.Variable
- All Implemented Interfaces:
Expression
Terminal expression representing a variable lookup in the interpreter pattern.
Implements the
Expression interface.-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
Variable
Constructs a Variable expression with the specified variable name.- Parameters:
name- the name of the variable
-
-
Method Details
-
interpret
Interprets the variable expression by looking up its value in the provided context.- Specified by:
interpretin interfaceExpression- Parameters:
ctx- the context map containing variable bindings- Returns:
- the boolean value of the variable
- Throws:
IllegalStateException- if the variable is not found in the context
-