Class And

java.lang.Object
Behavioral.Interpreter.And
All Implemented Interfaces:
Expression

public final class And extends Object implements Expression
Nonterminal expression representing a logical AND operation in the interpreter pattern. Implements the Expression interface.
  • Constructor Details

    • And

      public And(Expression left, Expression right)
      Constructs an AND expression with the specified left and right operands.
      Parameters:
      left - the left operand expression
      right - the right operand expression
  • Method Details

    • interpret

      public boolean interpret(Map<String,Boolean> ctx)
      Interprets the AND expression by evaluating both operands and returning their logical conjunction.
      Specified by:
      interpret in interface Expression
      Parameters:
      ctx - the context map for variable evaluation
      Returns:
      true if both operands evaluate to true; false otherwise