Class Or

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

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

    • Or

      public Or(Expression left, Expression right)
      Constructs an OR 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 OR expression by evaluating both operands and returning their logical disjunction.
      Specified by:
      interpret in interface Expression
      Parameters:
      ctx - the context map for variable evaluation
      Returns:
      true if at least one operand evaluates to true; false otherwise