Class Not

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

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

    • Not

      public Not(Expression expr)
      Constructs a NOT expression with the specified operand.
      Parameters:
      expr - the operand expression to negate
  • Method Details

    • interpret

      public boolean interpret(Map<String,Boolean> ctx)
      Interprets the NOT expression by evaluating its operand and returning the logical negation.
      Specified by:
      interpret in interface Expression
      Parameters:
      ctx - the context map for variable evaluation
      Returns:
      true if the operand evaluates to false; false otherwise