Package com.tnsai.environment
Class InMemoryEnvironment
java.lang.Object
com.tnsai.environment.InMemoryEnvironment
- All Implemented Interfaces:
Environment
Simple in-memory environment for testing and basic scenarios.
Stores environment state as a key-value map. Useful for unit testing or simple agent simulations.
-
Constructor Summary
ConstructorsConstructorDescriptionInMemoryEnvironment(String name) InMemoryEnvironment(String name, Map<String, Object> initialState) -
Method Summary
-
Constructor Details
-
InMemoryEnvironment
-
InMemoryEnvironment
-
-
Method Details
-
perceive
Description copied from interface:EnvironmentAgent perceives the current state of the environment.- Specified by:
perceivein interfaceEnvironment- Returns:
- the current percept from the environment
-
act
Description copied from interface:EnvironmentAgent acts on the environment.- Specified by:
actin interfaceEnvironment- Parameters:
actionName- the action to performparameters- action parameters- Returns:
- the outcome of the action
-
onChange
Description copied from interface:EnvironmentRegisters a listener for environment changes.- Specified by:
onChangein interfaceEnvironment- Parameters:
listener- called when the environment changes
-
getName
Description copied from interface:EnvironmentGets the environment name/type.- Specified by:
getNamein interfaceEnvironment
-
getState
Gets the current state directly (for testing).
-