Class AbstractLevel
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractLevel
-
- All Implemented Interfaces:
ILevel
,ITimeModel
- Direct Known Subclasses:
ExtendedLevel
public abstract class AbstractLevel extends Object implements ILevel
An abstract implementation of theILevel
interface, providing a default behavior to most methods.It also provides setters for the perception and the influence relation graph.
- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractLevel(SimulationTimeStamp initialTime, LevelIdentifier identifier)
Builds an initialized instance of level having a specific identifier, a perception and influence relation graph containing only an edge between this level and itself and an empty initial consistent dynamic state.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInfluenceableLevel(LevelIdentifier influenceableLevel)
Adds a level to the levels that can be influenced by this level.void
addPerceptibleLevel(LevelIdentifier perceptibleLevel)
Adds a perceptible level by this level.LevelIdentifier
getIdentifier()
Gets the identifier of this level, as defined in the constructor of the level.Set<LevelIdentifier>
getInfluenceableLevels()
Gets the levels that can be influenced by agents located in this level.ConsistentPublicLocalDynamicState
getLastConsistentState()
Gets the last consistent dynamic state of the level.TransitoryPublicLocalDynamicState
getLastTransitoryState()
Gets the last transitory dynamic state of the level.Set<LevelIdentifier>
getPerceptibleLevels()
Gets the levels that can be perceived by agents located in this level.void
initializeStates(ConsistentPublicLocalDynamicState lastConsistentState)
Sets the initial value of the last consistent and the last transitory public state of the 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.levels.ILevel
makeRegularReaction, makeSystemReaction
-
Methods inherited from interface fr.univ_artois.lgi2a.similar.microkernel.levels.ITimeModel
getNextTime
-
-
-
-
Constructor Detail
-
AbstractLevel
protected AbstractLevel(SimulationTimeStamp initialTime, LevelIdentifier identifier)
Builds an initialized instance of level having a specific identifier, a perception and influence relation graph containing only an edge between this level and itself and an empty initial consistent dynamic state. This dynamic state has to be initialized using the following method on the last consistent state of the level:- Parameters:
initialTime
- The initial time stamp of the level.identifier
- The identifier of the level.- Throws:
IllegalArgumentException
- if an argument isnull
.
-
-
Method Detail
-
getIdentifier
public final LevelIdentifier getIdentifier()
Gets the identifier of this level, as defined in the constructor of the level.- Specified by:
getIdentifier
in interfaceILevel
- Returns:
- The identifier of this level.
-
getLastConsistentState
public ConsistentPublicLocalDynamicState getLastConsistentState()
Gets the last consistent dynamic state of the level.- Specified by:
getLastConsistentState
in interfaceILevel
- Returns:
- The last consistent dynamic state of the level.
-
getLastTransitoryState
public TransitoryPublicLocalDynamicState getLastTransitoryState()
Gets the last transitory dynamic state of the level.- Specified by:
getLastTransitoryState
in interfaceILevel
- Returns:
- The last transitory dynamic state of the level.
-
initializeStates
public final void initializeStates(ConsistentPublicLocalDynamicState lastConsistentState)
Sets the initial value of the last consistent and the last transitory public state of the level.- Parameters:
lastConsistentState
- The initial value of the last consistent state of this level.
-
getPerceptibleLevels
public Set<LevelIdentifier> getPerceptibleLevels()
Gets the levels that can be perceived by agents located in this level.It corresponds to the out neighborhood NP+( this )⊂𝔾P of the this level in the perception relation graph.
- Specified by:
getPerceptibleLevels
in interfaceILevel
- Returns:
- The levels that can be perceived by agents located in this level.
-
addPerceptibleLevel
public void addPerceptibleLevel(LevelIdentifier perceptibleLevel)
Adds a perceptible level by this level.- Parameters:
perceptibleLevel
- The level becoming perceptible by this level.- Throws:
IllegalArgumentException
- If the argument isnull
.
-
getInfluenceableLevels
public Set<LevelIdentifier> getInfluenceableLevels()
Gets the levels that can be influenced by agents located in this level.It corresponds to the out neighborhood NI+( this )⊂𝔾I of the this level in the perception relation graph.
- Specified by:
getInfluenceableLevels
in interfaceILevel
- Returns:
- The levels that can be influenced by agents located in this level.
-
addInfluenceableLevel
public void addInfluenceableLevel(LevelIdentifier influenceableLevel)
Adds a level to the levels that can be influenced by this level.- Parameters:
influenceableLevel
- The level becoming influenceable by this level.- Throws:
IllegalArgumentException
- If the argument isnull
.
-
-