Class CompositeEnvironment

java.lang.Object
com.tnsai.environment.CompositeEnvironment
All Implemented Interfaces:
Environment

public final class CompositeEnvironment extends Object implements Environment
Combines multiple environments into a single view.

Perception merges data from all sub-environments. Actions are routed to the first environment that handles them.

  • Constructor Details

    • CompositeEnvironment

      public CompositeEnvironment(String name, Environment... environments)
  • Method Details

    • perceive

      public Percept perceive()
      Description copied from interface: Environment
      Agent perceives the current state of the environment.
      Specified by:
      perceive in interface Environment
      Returns:
      the current percept from the environment
    • act

      public ActionOutcome act(String actionName, Map<String,Object> parameters)
      Description copied from interface: Environment
      Agent acts on the environment.
      Specified by:
      act in interface Environment
      Parameters:
      actionName - the action to perform
      parameters - action parameters
      Returns:
      the outcome of the action
    • onChange

      public void onChange(Consumer<Percept> listener)
      Description copied from interface: Environment
      Registers a listener for environment changes.
      Specified by:
      onChange in interface Environment
      Parameters:
      listener - called when the environment changes
    • getName

      public String getName()
      Description copied from interface: Environment
      Gets the environment name/type.
      Specified by:
      getName in interface Environment