Class 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 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 is null.
      • 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 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 interface IPublicLocalDynamicState
        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 is null 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 interface IPublicLocalDynamicState
        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 by getLevel( ) 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 interface IPublicLocalDynamicState
        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 interface IPublicLocalDynamicState
        Returns:
        The state dynamics of this public local dynamic state.
      • setStateDynamicsAsCopyOf

        public void setStateDynamicsAsCopyOf​(Collection<IInfluence> toCopy)
        This operation is not supported in transitory states.
        Specified by:
        setStateDynamicsAsCopyOf in interface IModifiablePublicLocalDynamicState
        Parameters:
        toCopy - The set of influences that have to be contained in the state dynamics of this local dynamic state. If null, 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 interface IModifiablePublicLocalDynamicState
      • 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 interface IModifiablePublicLocalDynamicState
      • moveInfluencesToConsistentState

        public void moveInfluencesToConsistentState()
        Moves the influences contained in this transitory state into the consistent dynamic state it is attached to.