Class ConsistentPublicLocalDynamicState
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.dynamicstate.ConsistentPublicLocalDynamicState
-
- All Implemented Interfaces:
IModifiablePublicLocalDynamicState
,IPublicLocalDynamicState
public final class ConsistentPublicLocalDynamicState extends Object implements IModifiablePublicLocalDynamicState
Models a consistent public local dynamic state for a levell
at a timet
.Correspondence with theory
An instance of this class models the public local dynamic state δ(t, l) of a level "l" at a consistent time "t".
Usage
Such a public local dynamic state is valid only if the local state of the environment and of the agents are set, using the appropriate methods (
IModifiablePublicLocalDynamicState.setPublicLocalStateOfEnvironment(ILocalStateOfEnvironment)
andIModifiablePublicLocalDynamicState.addPublicLocalStateOfAgent(ILocalStateOfAgent)
).- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Constructor Description ConsistentPublicLocalDynamicState(SimulationTimeStamp time, LevelIdentifier level)
Builds a consistent public local state for a specific time stamp.
-
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)
Adds the public local state of an agent to this public local dynamic state.void
clearRegularInfluences()
Remove all the regular influences of this dynamic state.void
clearSystemInfluences()
Remove all the system influences of this dynamic state.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
getTime()
Gets the consistent time of this state.void
removePublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
Removes the public local state of an agent from this public local dynamic state.void
setPublicLocalStateOfEnvironment(ILocalStateOfEnvironment publicLocalState)
Sets the value of the public local state of the environment in this dynamic state.void
setStateDynamicsAsCopyOf(Collection<IInfluence> toCopy)
Sets the state dynamics of this public local dynamic state as a copy of the specified value.void
setTime(SimulationTimeStamp time)
Sets the consistent time of this state.
-
-
-
Constructor Detail
-
ConsistentPublicLocalDynamicState
public ConsistentPublicLocalDynamicState(SimulationTimeStamp time, LevelIdentifier level)
Builds a consistent public local state for a specific time stamp. This state still has to define the public local state of the environment, of the agents and the initial influences lying into the state dynamics, using the appropriate setting methods.- Parameters:
time
- The time stamp for which the public local dynamic state is defined.level
- The level of the public local dynamic state.- Throws:
IllegalArgumentException
- If an argument is null.
-
-
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.
-
getTime
public SimulationTimeStamp getTime()
Gets the consistent time of this state.If this object models δ(t, l), then this method returns the value of "t".
- Returns:
- The consistent time of this state.
-
setTime
public void setTime(SimulationTimeStamp time)
Sets the consistent time of this state.If this object models δ(t, l), then this method sets the value of "t".
- Parameters:
time
- The new consistent time of this state.
-
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)
Sets the value of the public local state of the environment in this dynamic state.- Specified by:
setPublicLocalStateOfEnvironment
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
publicLocalState
- The public local state of the environment.
-
addPublicLocalStateOfAgent
public void addPublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
Adds the public local state of an agent to this public local dynamic state.This method does nothing if the public local state is already in this dynamic state.
- Specified by:
addPublicLocalStateOfAgent
in interfaceIModifiablePublicLocalDynamicState
- Parameters:
publicLocalState
- The added public local state of the agent.
-
removePublicLocalStateOfAgent
public void removePublicLocalStateOfAgent(ILocalStateOfAgent publicLocalState)
Removes the public local state of an agent from this public local dynamic state.- 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)
Sets the state dynamics of this public local dynamic state as a copy of the specified value.- 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.
-
clearSystemInfluences
public void clearSystemInfluences()
Remove all the system influences of this dynamic state.- Specified by:
clearSystemInfluences
in interfaceIModifiablePublicLocalDynamicState
-
clearRegularInfluences
public void clearRegularInfluences()
Remove all the regular influences of this dynamic state.- Specified by:
clearRegularInfluences
in interfaceIModifiablePublicLocalDynamicState
-
-