Class Constant

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

public final class Constant extends Object implements Expression
Terminal expression representing a boolean constant in the interpreter pattern. Implements the Expression interface.
  • Constructor Details

    • Constant

      public Constant(boolean value)
      Constructs a Constant expression with the specified boolean value.
      Parameters:
      value - the boolean value this constant represents
  • Method Details

    • interpret

      public boolean interpret(Map<String,Boolean> ctx)
      Interprets the constant expression, returning its boolean value.
      Specified by:
      interpret in interface Expression
      Parameters:
      ctx - the context map (not used in this implementation)
      Returns:
      the boolean value of this constant