Class AbstractEnvironment
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractEnvironment
-
- All Implemented Interfaces:
IEnvironment
,IEnvironment4Engine
- Direct Known Subclasses:
ExtendedEnvironment
,PassiveEnvironment
public abstract class AbstractEnvironment extends Object implements IEnvironment4Engine
An abstract implementation of theIEnvironment
andIEnvironment4Engine
interfaces, providing a default behavior to the generic methods.This class also provides a method to set the level-related information of the environment.
- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Constructor Description AbstractEnvironment()
Builds an environment for a simulation containing no levels.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ILocalStateOfEnvironment
getPrivateLocalState(LevelIdentifier level)
Gets the private local state of the environment for a specific level.ILocalStateOfEnvironment
getPublicLocalState(LevelIdentifier level)
Gets the public local state of the environment for a specific level.Map<LevelIdentifier,ILocalStateOfEnvironment>
getPublicLocalStates()
Gets the public local states of the environment.void
includeNewLevel(LevelIdentifier level, ILocalStateOfEnvironment publicLocalState, ILocalStateOfEnvironment privateLocalState)
Introduces the level-related data of the environment for a new level.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface fr.univ_artois.lgi2a.similar.microkernel.environment.IEnvironment
natural
-
-
-
-
Constructor Detail
-
AbstractEnvironment
public AbstractEnvironment()
Builds an environment for a simulation containing no levels. Levels are then added using theincludeNewLevel(LevelIdentifier, ILocalStateOfEnvironment, ILocalStateOfEnvironment)
method.
-
-
Method Detail
-
getPublicLocalState
public ILocalStateOfEnvironment getPublicLocalState(LevelIdentifier level)
Gets the public local state of the environment for a specific level.This method returns the value φω+(t,
levelIdentifier
) or φω+(]t,t′[,levelIdentifier
) ∈Φω+, where the value of ]t,t′[ is defined by the context in which this method is called.- Specified by:
getPublicLocalState
in interfaceIEnvironment
- Parameters:
level
- The level of the public local state of the environment.- Returns:
- The public local state of the environment for a specific level.
-
getPublicLocalStates
public Map<LevelIdentifier,ILocalStateOfEnvironment> getPublicLocalStates()
Gets the public local states of the environment.This method returns all the values φω+(t, l) or φω+(]t,t′[, l) ∈Φω+, where the value of ]t,t′[ is defined by the context in which this method is called.
Usage and safety
This method has to be used only in the simulation engine.
- Specified by:
getPublicLocalStates
in interfaceIEnvironment4Engine
- Returns:
- The public local states of the environment.
-
getPrivateLocalState
public ILocalStateOfEnvironment getPrivateLocalState(LevelIdentifier level)
Gets the private local state of the environment for a specific level.This method returns the value φω-(t,
levelIdentifier
) or φω-(]t,t′[,levelIdentifier
) ∈Φω-, where the value of ]t,t′[ is defined by the context in which this method is called.- Specified by:
getPrivateLocalState
in interfaceIEnvironment
- Parameters:
level
- The level of the private local state of the environment.- Returns:
- The private local state of the environment for a specific level.
-
includeNewLevel
public void includeNewLevel(LevelIdentifier level, ILocalStateOfEnvironment publicLocalState, ILocalStateOfEnvironment privateLocalState)
Introduces the level-related data of the environment for a new level.Note that the public local state also has to be added to the first consistent public local dynamic state of the level: the
IModifiablePublicLocalDynamicState.setPublicLocalStateOfEnvironment(ILocalStateOfEnvironment)
method has to be called during the initialization of the simulation for the initial consistent state.- Parameters:
level
- The level for which data are added.publicLocalState
- The public local state of the environment for that level.privateLocalState
- The public local state of the environment for that level.- Throws:
IllegalArgumentException
- If an argument isnull
, or if the level is already present in the environment.
-
-