Class TransitoryPublicLocalDynamicState
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.dynamicstate.TransitoryPublicLocalDynamicState
-
- All Implemented Interfaces:
IModifiablePublicLocalDynamicState
,IPublicLocalDynamicState
public class TransitoryPublicLocalDynamicState extends Object implements IModifiablePublicLocalDynamicState
Models the public dynamic state of a level when the level is in a transitory phase, i.e. when the environment and the agents in the level are evaluating their behavior between two consistent states.Correspondence with theory
An instance of this class models the public local dynamic state δ(]t, t+dtl[, l) of a level "l" for the transitory period ]t, t+dtl[.
Usage
This state is a working copy of the last consistent state of the simulation, where the behavior of agents or of the environment can add influences to the state dynamics of the public local dynamic state of the level. These influences are used during the next reaction phase of the level to determine the next consistent public local dynamic state of the level.
- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Constructor Description TransitoryPublicLocalDynamicState(ConsistentPublicLocalDynamicState lastConsistentDynamicState)
Builds a transitory public local dynamic state modeling the state of the level for a time t between the time stamp of the last consistent dynamic state, and the time stamp of the next consistent dynamic state.TransitoryPublicLocalDynamicState(ConsistentPublicLocalDynamicState lastConsistentDynamicState, SimulationTimeStamp timeUpperBound)
Builds a transitory public local dynamic state modeling the state of the level for a time t between the time stamp of the last consistent dynamic state, and the time stamp of the next consistent dynamic state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInfluence(IInfluence influence)
Adds an influence to this public local dynamic state.void
addPublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
This operation is not supported in transitory states.void
clearRegularInfluences()
Remove all the regular influences of this dynamic state.void
clearSystemInfluences()
Remove all the system influences of this dynamic state.ConsistentPublicLocalDynamicState
getLastConsistentDynamicState()
Gets the last consistent public local dynamic state of the level.LevelIdentifier
getLevel()
Gets the level for which the public local dynamic state is defined.Set<ILocalStateOfAgent>
getPublicLocalStateOfAgents()
Gets the public local state of the agents lying in the level of this dynamic state.ILocalStateOfEnvironment
getPublicLocalStateOfEnvironment()
Gets the public local state of the environment contained in this public local dynamic state.Set<IInfluence>
getRegularInfluencesOfStateDynamics()
Gets the non-system influences contained in the state dynamics.Set<IInfluence>
getStateDynamics()
Gets the state dynamics of this public local dynamic state, i.e. the influences that are still active (being performed) when the level was in this state.Set<IInfluence>
getSystemInfluencesOfStateDynamics()
Gets the system influences contained in the state dynamics.SimulationTimeStamp
getTransitoryPeriodMax()
Gets the upper bound of the transitory period of this state.SimulationTimeStamp
getTransitoryPeriodMin()
Gets the lower bound of the transitory period of this state.void
moveInfluencesToConsistentState()
Moves the influences contained in this transitory state into the consistent dynamic state it is attached to.void
removePublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
This operation is not supported in transitory states.void
setPublicLocalStateOfEnvironment(ILocalStateOfEnvironment publicLocalState)
This operation is not supported in transitory states.void
setStateDynamicsAsCopyOf(Collection<IInfluence> toCopy)
This operation is not supported in transitory states.void
setTransitoryPeriodMax(SimulationTimeStamp time)
Sets the higher bound of the time range for which this transitory state is defined, i.e. the next time when the level will be in a consistent and observable state.
-
-
-
Constructor Detail
-
TransitoryPublicLocalDynamicState
public TransitoryPublicLocalDynamicState(ConsistentPublicLocalDynamicState lastConsistentDynamicState, SimulationTimeStamp timeUpperBound)
Builds a transitory public local dynamic state modeling the state of the level for a time t between the time stamp of the last consistent dynamic state, and the time stamp of the next consistent dynamic state.- Parameters:
lastConsistentDynamicState
- The last consistent dynamic state preceding this transitory dynamic state. If δ(]t, t+dtl[, l) is this transitory state, then this field models δ(t, l)timeUpperBound
- The upper bound of the transitory period of this state.- Throws:
IllegalArgumentException
- If an argument of this constructor isnull
.
-
TransitoryPublicLocalDynamicState
public TransitoryPublicLocalDynamicState(ConsistentPublicLocalDynamicState lastConsistentDynamicState)
Builds a transitory public local dynamic state modeling the state of the level for a time t between the time stamp of the last consistent dynamic state, and the time stamp of the next consistent dynamic state.This constructor assumes that the value of the upper bound of the transitory period is not defined yet, and will be set later by the simulation engine. It therefore provides a default value to that time stamp (where the identifier is the maximal one).
- Parameters:
lastConsistentDynamicState
- The last consistent dynamic state preceding this transitory dynamic state. If δ(]t, t+dtl[, l) is this transitory state, then this field models δ(t, l)- Throws:
IllegalArgumentException
- If an argument of this constructor isnull
.
-
-
Method Detail
-
getLevel
public LevelIdentifier getLevel()
Gets the level for which the public local dynamic state is defined.It returns the identifier of "l" in the notation δ(t, l) or δ(]t,t′[, l).
- Specified by:
getLevel
in interfaceIPublicLocalDynamicState
- Returns:
- The level for which the public local dynamic state is defined.
-
getTransitoryPeriodMin
public SimulationTimeStamp getTransitoryPeriodMin()
Gets the lower bound of the transitory period of this state.This method returns the value "t" within the expression pa(]t,t′[, l);
- Returns:
- The lower bound of the transitory period of this state.
-
getTransitoryPeriodMax
public SimulationTimeStamp getTransitoryPeriodMax()
Gets the upper bound of the transitory period of this state.This method returns the value "t′" within the expression pa(]t,t′[, l);
- Returns:
- The upper bound of the transitory period of this state.
-
setTransitoryPeriodMax
public void setTransitoryPeriodMax(SimulationTimeStamp time)
Sets the higher bound of the time range for which this transitory state is defined, i.e. the next time when the level will be in a consistent and observable state.This method sets the value
t+dtl
in the ]t, t+dtl[ transitory period.- Parameters:
time
- The time stamp modeling the higher bound of the time range for which this transitory state is defined.- Throws:
IllegalArgumentException
- If an argument isnull
or is lower or equal to the current next time.
-
getPublicLocalStateOfEnvironment
public ILocalStateOfEnvironment getPublicLocalStateOfEnvironment()
Gets the public local state of the environment contained in this public local dynamic state.It returns the value φω(t,
getLevel( )
) or φω(]t,t′,getLevel( )
).- Specified by:
getPublicLocalStateOfEnvironment
in interfaceIPublicLocalDynamicState
- Returns:
- The public local state of the environment contained in this public local dynamic state.
-
getPublicLocalStateOfAgents
public Set<ILocalStateOfAgent> getPublicLocalStateOfAgents()
Gets the public local state of the agents lying in the level of this dynamic state.It returns the values φa(t,
getLevel( )
) (resp. φa(]t,t′,getLevel( )
)) for each agent lying in the level identified bygetLevel( )
at the time "t" (resp. during the transitory period ]t,t′[).This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Specified by:
getPublicLocalStateOfAgents
in interfaceIPublicLocalDynamicState
- Returns:
- The public local state of the agents lying in the level of this dynamic state.
-
getStateDynamics
public Set<IInfluence> getStateDynamics()
Gets the state dynamics of this public local dynamic state, i.e. the influences that are still active (being performed) when the level was in this state.It returns the value γ(t,
getLevel( )
) or γ(]t,t′[,getLevel( )
).This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Specified by:
getStateDynamics
in interfaceIPublicLocalDynamicState
- Returns:
- The state dynamics of this public local dynamic state.
-
getSystemInfluencesOfStateDynamics
public Set<IInfluence> getSystemInfluencesOfStateDynamics()
Gets the system influences contained in the state dynamics.This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Specified by:
getSystemInfluencesOfStateDynamics
in interfaceIPublicLocalDynamicState
- Returns:
- The system influences of the value returned by the
IPublicLocalDynamicState.getStateDynamics()
method.
-
getRegularInfluencesOfStateDynamics
public Set<IInfluence> getRegularInfluencesOfStateDynamics()
Gets the non-system influences contained in the state dynamics.This method has to ensure that two consecutive iterations over this set always return its items in the same order.
- Specified by:
getRegularInfluencesOfStateDynamics
in interfaceIPublicLocalDynamicState
- Returns:
- The non-system influences of the value returned by the
IPublicLocalDynamicState.getStateDynamics()
method.
-
setPublicLocalStateOfEnvironment
public void setPublicLocalStateOfEnvironment(ILocalStateOfEnvironment publicLocalState)
This operation is not supported in transitory states.- Specified by:
setPublicLocalStateOfEnvironment
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
publicLocalState
- The public local state of the environment.
-
addPublicLocalStateOfAgent
public void addPublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
This operation is not supported in transitory states.- Specified by:
addPublicLocalStateOfAgent
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
publicLocalState
- The added public local state of the agent.
-
removePublicLocalStateOfAgent
public void removePublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
This operation is not supported in transitory states.- Specified by:
removePublicLocalStateOfAgent
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
publicLocalState
- The removed public local state of the agent.
-
addInfluence
public void addInfluence(IInfluence influence)
Adds an influence to this public local dynamic state.- Specified by:
addInfluence
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
influence
- The influence to add to this public local dynamic state.
-
setStateDynamicsAsCopyOf
public void setStateDynamicsAsCopyOf(Collection<IInfluence> toCopy)
This operation is not supported in transitory states.- Specified by:
setStateDynamicsAsCopyOf
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
toCopy
- The set of influences that have to be contained in the state dynamics of this local dynamic state. Ifnull
, this method sets the state dynamics of this dynamic state to an empty set.
-
getLastConsistentDynamicState
public ConsistentPublicLocalDynamicState getLastConsistentDynamicState()
Gets the last consistent public local dynamic state of the level.If δ(]t, t+dtl[, l) is this transitory state, then this method returns δ(t, l)
- Returns:
- The last consistent public local dynamic state of the level.
-
clearSystemInfluences
public void clearSystemInfluences()
Remove all the system influences of this dynamic state.Warning: this method remove the system influences from both the transitory state and the consistent dynamic state it is attached to.
- Specified by:
clearSystemInfluences
in interfaceIModifiablePublicLocalDynamicState
-
clearRegularInfluences
public void clearRegularInfluences()
Remove all the regular influences of this dynamic state.Warning: this method remove the regular influences from both the transitory state and the consistent dynamic state it is attached to.
- Specified by:
clearRegularInfluences
in interfaceIModifiablePublicLocalDynamicState
-
moveInfluencesToConsistentState
public void moveInfluencesToConsistentState()
Moves the influences contained in this transitory state into the consistent dynamic state it is attached to.
-
-