s3games.engine.expr

## Class Context

- java.lang.Object
- - s3games.engine.expr.Context

-     public class Context
      extends java.lang.Object

  Holds a context of evaluation - as the rules are matched against locations and elements, the indexing variables are filled with values. While expressions are evaluated, variables are assigned values. Holds reference to current state and game specification for easier access from internal functions and operators during evaluation

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `Robot` | `robot` reference to robot - to be able to perform internal MOVE command when required by an expression
    `GameSpecification` | `specs` reference to game specification

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Context(GameState state, GameSpecification specs, Robot robot)` construct a new empty context

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `getExpr(java.lang.String exprName)` the expression to which the specified expression name is mapped, or null if expressions do not contain exprName
    `GameState` | `getState()` retrieve the game sate in this context
    `Expr` | `getVar(java.lang.String var)` the value to which the specified variable name is mapped, or null if variables do not contain var
    `void` | `setState(GameState state)` set the game state for this context - the same context is reused when searching through the game tree, a particular current state always needs to be set
    `void` | `setVar(java.lang.String var, Expr val)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### robot

          public Robot robot

      reference to robot - to be able to perform internal MOVE command when required by an expression

    - #### specs

          public GameSpecification specs

      reference to game specification

  - ### Constructor Detail

    - #### Context

          public Context(GameState state,
                 GameSpecification specs,
                 Robot robot)

      construct a new empty context

  - ### Method Detail

    - #### setState

          public void setState(GameState state)

      set the game state for this context - the same context is reused when searching through the game tree, a particular current state always needs to be set

    - #### getState

          public GameState getState()

      retrieve the game sate in this context

    - #### setVar

          public void setVar(java.lang.String var,
                    Expr val)

    - #### getVar

          public Expr getVar(java.lang.String var)

      the value to which the specified variable name is mapped, or null if variables do not contain var

    - #### getExpr

          public Expression getExpr(java.lang.String exprName)

      the expression to which the specified expression name is mapped, or null if expressions do not contain exprName