Class EmptyLevelReactionModel
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.extendedkernel.libs.generic.EmptyLevelReactionModel
-
- All Implemented Interfaces:
ILevelReactionModel
public final class EmptyLevelReactionModel extends Object implements ILevelReactionModel
Models a reaction model doing nothing.Note that this reaction model makes sure that no influences persists in the new consistent state of the level.
- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Constructor Description EmptyLevelReactionModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
makeRegularReaction(SimulationTimeStamp transitoryTimeMin, SimulationTimeStamp transitoryTimeMax, ConsistentPublicLocalDynamicState consistentState, Set<IInfluence> regularInfluencesOftransitoryStateDynamics, InfluencesMap remainingInfluences)
Performs a user-defined reaction to the regular influences that were lying in the most recent consistent dynamic state of the level and to the influences that were added into the transitory dynamic state of the level.void
makeSystemReaction(SimulationTimeStamp transitoryTimeMin, SimulationTimeStamp transitoryTimeMax, ConsistentPublicLocalDynamicState consistentState, Collection<IInfluence> systemInfluencesToManage, boolean happensBeforeRegularReaction, InfluencesMap newInfluencesToProcess)
Performs a user-defined reaction to the system influences that are lying in the most recent consistent dynamic state of the level and to the influences that were added into the transitory dynamic state of the level.
-
-
-
Method Detail
-
makeRegularReaction
public void makeRegularReaction(SimulationTimeStamp transitoryTimeMin, SimulationTimeStamp transitoryTimeMax, ConsistentPublicLocalDynamicState consistentState, Set<IInfluence> regularInfluencesOftransitoryStateDynamics, InfluencesMap remainingInfluences)
Performs a user-defined reaction to the regular influences that were lying in the most recent consistent dynamic state of the level and to the influences that were added into the transitory dynamic state of the level.Usage
This method has to:
-
Update the local state of the environment and of the agents contained in the consistent dynamic state
consistentState
argument of this method according to the modifications depicted by the regular influences. -
Add to the
newInfluencesToProcess
set the influences persisting after the reaction. The influences that were consumed by the reaction are not added to this set. -
Add to the
newInfluencesToProcess
set the new influences that were produced by this reaction (for instance the addition of an agent to the simulation). The system reactions will be processed after this user reaction to regular influences if the level they are aimed at is a level currently computing its reaction. Otherwise, the system influence is managed during the next reaction of the targeted level. Moreover, the regular influences added in such a way will be processed during the next reaction of the level they are aimed at.
This method cannot:
- Add influences directly into the consistent state of the simulation. If it does so, it puts the simulation into an inconsistent state.
- Specified by:
makeRegularReaction
in interfaceILevelReactionModel
- Parameters:
transitoryTimeMin
- The lower bound of the transitory period of the level for which this reaction is performed.transitoryTimeMax
- The upper bound of the transitory period of the level for which this reaction is performed.consistentState
- The consistent state being updated by this user reaction.regularInfluencesOftransitoryStateDynamics
- The regular influences that have to be managed by this reaction to go from the previous consistent state to the next consistent state of the level.remainingInfluences
- The data structure that will contain the influences that were produced by the user during the invocation of this method, or the influences that persist after this reaction.
-
Update the local state of the environment and of the agents contained in the consistent dynamic state
-
makeSystemReaction
public void makeSystemReaction(SimulationTimeStamp transitoryTimeMin, SimulationTimeStamp transitoryTimeMax, ConsistentPublicLocalDynamicState consistentState, Collection<IInfluence> systemInfluencesToManage, boolean happensBeforeRegularReaction, InfluencesMap newInfluencesToProcess)
Performs a user-defined reaction to the system influences that are lying in the most recent consistent dynamic state of the level and to the influences that were added into the transitory dynamic state of the level. This method is called twice during the reaction phase of the level:- A first time right after the system reaction to the system influences happening at the beginning of the reaction phase. It gives the opportunity to perform a user-defined reaction to the system influences that were added to the transitory dynamic state of the level during the transitory period (for instance to add an agent to the topology of the environment).
- A second time right after the system reaction to the system influences happening after the user-defined reaction to the regular influences. It gives the opportunity to perform a user-defined reaction to the system influences that were created by the user during the user reaction to the regular influences.
Usage
This method can:
-
Update the local state of the environment and of the agents contained in the consistent dynamic state
consistentState
argument of this method according to the modifications depicted by the system influences. For instance, if the public local state of the environment defines an agent grid, this method can add the public local state of an agent to the grid, in reaction to the 'add agent to level' system influence. -
Add to the
newInfluencesToProcess
set the new influences that were produced by this reaction (for instance the addition of a new agent to the simulation). The influences added in such a way will be processed either during the next reaction of the level they are aimed at (happensBeforeRegularReaction
false
or the level being targeted by the influence is not currently computing a reaction).
This method cannot:
- Add influences directly into the consistent state of the simulation. If it does so, it puts the simulation into an inconsistent state.
- Specified by:
makeSystemReaction
in interfaceILevelReactionModel
- Parameters:
transitoryTimeMin
- The lower bound of the transitory period of the level for which this reaction is performed.transitoryTimeMax
- The lower bound of the transitory period of the level for which this reaction is performed.consistentState
- The consistent state being updated by this user reaction. Note that this state already include the result of the system influences listed in thesystemInfluencesToManage
argument.systemInfluencesToManage
- The system influences that have to be managed by this reaction to go from the previous consistent state to the next consistent state of the level.happensBeforeRegularReaction
-true
if this user-defined system reaction is performed before the call to theILevel.makeRegularReaction(SimulationTimeStamp, SimulationTimeStamp, ConsistentPublicLocalDynamicState, Set, InfluencesMap)
method.newInfluencesToProcess
- The data structure where the influences resulting from this user reaction have to be added.
-
-