AT
- is the type of agent supported by this kernelET
- is the type of environment supported by this kernelYP
- is the type of yellow page supported by this kernelMTS
- is the type of message transport service supported by this kernel.@Deprecated public class Kernel<AT extends Agent,ET extends Environment<AT>,YP extends YellowPages,MTS extends MessageTransportService> extends Object implements Runnable
The kernel is the central point of the multiagent platform.
Modifier and Type | Field and Description |
---|---|
static int |
KERNEL_STOP_TIMEOUT
Deprecated.
Timeout in milliseconds to wait about kernel stop.
|
static int |
TIME_PRECISION
Deprecated.
This is the minimal duration which can be measured
by an operating system (in milliseconds).
|
Constructor and Description |
---|
Kernel()
Deprecated.
Create a kernel with the default components.
|
Kernel(ET env)
Deprecated.
Create a kernel with the specified components.
|
Kernel(MTS mts,
Scheduler<AT> scheduler)
Deprecated.
Create a kernel with the specified scheduler and message transport service.
|
Kernel(MTS mts,
WhitePages<AT> whitepages,
YP yellowpages)
Deprecated.
Create a kernel with the specified components.
|
Kernel(MTS mts,
WhitePages<AT> whitepages,
YP yellowpages,
Scheduler<AT> scheduler)
Deprecated.
Create a kernel with the specified components.
|
Kernel(MTS mts,
WhitePages<AT> whitepages,
YP yellowpages,
Scheduler<AT> scheduler,
ET env)
Deprecated.
Create a kernel with the specified components.
|
Kernel(MTS mts,
YP yellowpages)
Deprecated.
Create a kernel with the specified components.
|
Kernel(MTS mts,
YP yellowpages,
Scheduler<AT> scheduler)
Deprecated.
Create a kernel with the specified components.
|
Kernel(Scheduler<AT> scheduler)
Deprecated.
Create a kernel with the specified scheduler.
|
Modifier and Type | Method and Description |
---|---|
void |
addAgent(Agent agent)
Deprecated.
Add an agent inside this kernel.
|
void |
addAgent(AgentIdentifier id,
AT a)
Deprecated.
Add an agent inside this kernel.
|
void |
addKernelListener(KernelListener listener)
Deprecated.
Add a listener.
|
protected static void |
displayKernelMessage(String msg)
Deprecated.
Kernel log.
|
long |
getAgentCount()
Deprecated.
Replies the count of agents registered inside this kernel.
|
(package private) AgentIdentifier |
getAgentId(AT a)
Deprecated.
Replies the identifier of the specified agent.
|
ET |
getEnvironment()
Deprecated.
Replies the environment used by this kernel (if it exist).
|
KernelIdentifier |
getKernelId()
Deprecated.
Replies the identifier of this kernel.
|
long |
getKernelStep()
Deprecated.
Replies the count of simulation turns
since the start of the kernel.
|
long |
getKernelStepDuration()
Deprecated.
Replies the duration in milliseconds of one turn of the kernel.
|
(package private) MTS |
getMTS()
Deprecated.
Replies the message transport service used by this kernel.
|
Probe |
getProbe(AgentIdentifier agentId)
Deprecated.
Replies a probe on the specified agent.
|
AgentIdentifier[] |
getServiceProviders(String serviceName)
Deprecated.
Replies the list of agents that provide the specified service
|
SimulationClock |
getSimulationClock()
Deprecated.
Replies the simulation clock associated to this kernel.
|
static Kernel<?,?,?,?> |
getSingleton()
Deprecated.
Replies the unique instance of Kernel.
|
YP |
getYellowPageSystem()
Deprecated.
Replies the yellow pages used by this kernel.
|
boolean |
isOnThisKernel(AgentIdentifier agent)
Deprecated.
Replies if this agent identifier corresponds to an
agent inside this kernel.
|
boolean |
isShutdown()
Deprecated.
Replies if this kernel was launch, but is now shutdown.
|
boolean |
isStopped()
Deprecated.
Replies if the kernel is not running.
|
boolean |
isUnderPause()
Deprecated.
Replies if this kernel is under pause.
|
(package private) void |
killAgent(AgentIdentifier id)
Deprecated.
Kill an agent.
|
void |
pause()
Deprecated.
Push the current kernel under pause.
|
static void |
pauseKernel()
Deprecated.
Push the singleton kernel under pause.
|
static Probe |
probe(AgentIdentifier agentId)
Deprecated.
Replies a probe on the specified agent.
|
boolean |
registerAsSingleton()
Deprecated.
Register this kernel as the singleton.
|
(package private) void |
removeAgent(AgentIdentifier id)
Deprecated.
Kill an agent.
|
(package private) void |
removeAllAgents()
Deprecated.
Kill immediately all the agents.
|
void |
removeKernelListener(KernelListener listener)
Deprecated.
remove a listener.
|
void |
run()
Deprecated.
Run the kernel.
|
protected void |
runAgentLifeStage()
Deprecated.
Run the agent live stages.
|
protected void |
runInitializationStage()
Deprecated.
Run the initialization stage of the kernel.
|
protected void |
runShutdownStage()
Deprecated.
run the shutdown stage of the kernel.
|
static AgentIdentifier[] |
service(String serviceName)
Deprecated.
Replies the list of agents that provide the specified service
|
void |
setEnvironment(ET env)
Deprecated.
Set the environment that should be used by this kernel.
|
void |
setWaitingDuration(int duration)
Deprecated.
Set the milliseconds to wait between two simulation steps.
|
protected void |
startAgents(Collection<AT> agents)
Deprecated.
Agent lif-cycle: starts all the specified agents.
|
void |
stop()
Deprecated.
Stop the kernel.
|
protected void |
stopAgents(Collection<AT> agents)
Deprecated.
Notify of the specified agents that they are dead.
|
static void |
stopKernel()
Deprecated.
Stop the kernel singleton.
|
public static final int TIME_PRECISION
public static final int KERNEL_STOP_TIMEOUT
public Kernel()
public Kernel(Scheduler<AT> scheduler)
scheduler
- public Kernel(MTS mts, Scheduler<AT> scheduler)
mts
- scheduler
- public Kernel(MTS mts, WhitePages<AT> whitepages, YP yellowpages)
mts
- whitepages
- yellowpages
- public Kernel(MTS mts, YP yellowpages)
mts
- yellowpages
- public Kernel(MTS mts, WhitePages<AT> whitepages, YP yellowpages, Scheduler<AT> scheduler)
mts
- whitepages
- yellowpages
- scheduler
- public Kernel(MTS mts, YP yellowpages, Scheduler<AT> scheduler)
mts
- yellowpages
- scheduler
- public Kernel(ET env)
env
- public static Kernel<?,?,?,?> getSingleton()
registerAsSingleton()
public boolean registerAsSingleton()
true
if this kernel is now the singleton, otherwise false
getSingleton()
MTS getMTS()
public ET getEnvironment()
public void setEnvironment(ET env)
env
- public void addAgent(Agent agent)
The kernel assumes that the specified agent was never spawn before. An unique identifier will be provided to the specified agent.
agent
- public void addAgent(AgentIdentifier id, AT a)
The kernel assumes that the specified agent was already spawn before. The specified identifier will be given to the agent (if it is unique).
id
- a
- void killAgent(AgentIdentifier id)
This method should only be invoked by Agent.killMe()
.
The agent will be removed at the end of the current scheduling step.
id
- removeAgent(AgentIdentifier)
void removeAgent(AgentIdentifier id)
The agent will be removed immediately.
id
- killAgent(AgentIdentifier)
void removeAllAgents()
AgentIdentifier getAgentId(AT a)
a
- public void run()
This method invokes:
run
in interface Runnable
runInitializationStage()
,
runAgentLifeStage()
,
runShutdownStage()
protected void runInitializationStage()
run()
,
runAgentLifeStage()
,
runShutdownStage()
protected void runAgentLifeStage()
run()
,
runInitializationStage()
,
runShutdownStage()
protected void runShutdownStage()
run()
,
runInitializationStage()
,
runAgentLifeStage()
protected void startAgents(Collection<AT> agents)
agents
- public void setWaitingDuration(int duration)
duration
- protected void stopAgents(Collection<AT> agents)
agents
- public boolean isStopped()
true
true
if the kernel was stopped, otherwise false
public boolean isUnderPause()
true
if the kernel was paused, otherwise false
public boolean isShutdown()
true
if the kernel was shutdown, otherwise false
public void stop()
public static void stopKernel()
public void pause()
public static void pauseKernel()
public static Probe probe(AgentIdentifier agentId)
agentId
- null
if the agent
could not provide a probe.public static AgentIdentifier[] service(String serviceName)
serviceName
- public KernelIdentifier getKernelId()
public YP getYellowPageSystem()
public AgentIdentifier[] getServiceProviders(String serviceName)
serviceName
- public long getAgentCount()
public boolean isOnThisKernel(AgentIdentifier agent)
agent
- true
if the given agent is on this kernel,
otherwise false
protected static void displayKernelMessage(String msg)
msg
- public long getKernelStep()
public long getKernelStepDuration()
public SimulationClock getSimulationClock()
This function replies the clock of the environment if it exists or an internal clock based on the kernel steps.
null
getKernelStep()
,
getKernelStepDuration()
public void addKernelListener(KernelListener listener)
listener
- public void removeKernelListener(KernelListener listener)
listener
- public Probe getProbe(AgentIdentifier agentId)
agentId
- null
if the agent
could not provide a probe.Copyright © 2003-2013 Arakhnê.org Members. All rights reserved under LGPL license terms.