Class DefineVariableOperation

java.lang.Object
org.kigalisim.lang.operation.DefineVariableOperation
All Implemented Interfaces:
Operation

public class DefineVariableOperation extends Object implements Operation
Operation that defines a variable and sets its value in the engine.

This operation defines a variable with the specified name and sets its value in the engine.

  • Constructor Details

    • DefineVariableOperation

      public DefineVariableOperation(String variableName, Operation valueOperation)
      Create a new DefineVariableOperation.
      Parameters:
      variableName - The name of the variable to define.
      valueOperation - The operation that calculates the value to set.
  • Method Details

    • execute

      public void execute(PushDownMachine machine)
      Executes the variable definition operation.

      This method executes the value operation to obtain the value, defines the variable if it doesn't exist, and then sets the variable value in the engine.

      Specified by:
      execute in interface Operation
      Parameters:
      machine - The push-down machine on which to execute the operation.