Class AbstractSimulationEngine
- java.lang.Object
-
- fr.univ_artois.lgi2a.similar.microkernel.libs.abstractimpl.AbstractSimulationEngine
-
- All Implemented Interfaces:
ISimulationEngine
- Direct Known Subclasses:
AbstractSimulationEngineWithInitialization
public abstract class AbstractSimulationEngine extends Object implements ISimulationEngine
An abstract implementation of theISimulationEngine
interface, providing a default behavior to the probe list-related methods. This class ensures that the iteration order over probes is the insertion order of the probes.This class defines also methods to add or remove probes to the simulation engine.
- Author:
- Yoann Kubera
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractSimulationEngine()
Builds an instance of this abstract simulation engine, containing no probes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProbe(String identifier, IProbe probe)
Adds a probe to this simulation engine.IProbe
getProbe(String probeId)
Gets the probe having a specific id.Collection<IProbe>
getProbes()
Gets the probes that are registered to this simulation engine.Set<String>
getProbesIdentifiers()
Lists the identifier of all the probes that are registered to this engine.IProbe
removeProbe(String identifier)
Removes a probe from the simulation engine.-
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.ISimulationEngine
disambiguation, getAgents, getAgents, getEnvironment, getLevelIdentifiers, getLevels, getSimulationDynamicStates, requestSimulationAbortion, runNewSimulation
-
-
-
-
Method Detail
-
addProbe
public void addProbe(String identifier, IProbe probe)
Adds a probe to this simulation engine.- Specified by:
addProbe
in interfaceISimulationEngine
- Parameters:
identifier
- An unique identifier for the probe.probe
- The probe to add to this simulation engine.
-
removeProbe
public IProbe removeProbe(String identifier)
Removes a probe from the simulation engine.- Specified by:
removeProbe
in interfaceISimulationEngine
- Parameters:
identifier
- The identifier of the probe to remove.- Returns:
- The removed probe,
null
if no probe having the provided identifier was registered to this engine.
-
getProbesIdentifiers
public Set<String> getProbesIdentifiers()
Lists the identifier of all the probes that are registered to this engine.- Specified by:
getProbesIdentifiers
in interfaceISimulationEngine
- Returns:
- The identifier of all the probes that are registered to this engine.
-
getProbe
public IProbe getProbe(String probeId)
Gets the probe having a specific id. The probe has to be registered to this engine using theISimulationEngine.addProbe(String, IProbe)
method.- Parameters:
probeId
- The identifier of the probe that was provided when it was added.- Returns:
- The probe having the specific id.
- Throws:
NoSuchElementException
- If no probe is defined for the specified id.
-
getProbes
public Collection<IProbe> getProbes()
Gets the probes that are registered to this simulation engine.- Returns:
- The probes that are registered to this simulation engine.
-
-