public class DefaultPlatform extends Object implements Platform, ControllerStateListener
Platform
interface. The class requires initialization by
calling setup(RuntimeEnvironment)
.Platform.Mode, Platform.State
Constructor and Description |
---|
DefaultPlatform() |
Modifier and Type | Method and Description |
---|---|
AgentIdentifier |
addAgent(Agent agent,
String name)
Adds an agent to the platform.
|
AgentIdentifier |
addAgent(Agent agent,
String name,
Timestamp startTime)
Adds an agent to the platform with a specified start time.
|
void |
addStateListener(PlatformStateListener listener)
Adds a listener that is informed of the state of the platform changes.
|
Timestamp |
currentTime()
Returns the timestamp that represents the current model time.
|
Platform.Mode |
getMode()
Returns the execution mode of the platform.
|
Platform.State |
getState()
Returns the current state of the platform.
|
void |
handleControllerStateChange(Controller.State state)
Handles a change of the controller state
|
int |
handledProcesses()
Returns the amount of processes/agents currently handled by the platform.
|
void |
setup(RuntimeEnvironment config)
Sets up the platform.
|
void |
start()
Starts the platform execution.
|
void |
stop()
Stops the platform execution.
|
public void setup(RuntimeEnvironment config)
Platform
public void start()
Platform
public void stop()
Platform
public Platform.State getState()
Platform
public Platform.Mode getMode()
Platform
public AgentIdentifier addAgent(Agent agent, String name)
Platform
Adds an agent to the platform. The specified agent name is a proposal for the unique agent identifier. If the respective agent identifier is already taken within the scope of the platform, the platform may use an arbitrary modification of the proposed name. The method returns the actually generated identifier.
Agents added with this method are intended to be executed as soon as possible.
addAgent
in interface Platform
agent
- the agent to be added to the platformname
- the name proposed as agent identifierPlatform.addAgent(Agent, String, Timestamp)
public AgentIdentifier addAgent(Agent agent, String name, Timestamp startTime)
Platform
Adds an agent to the platform with a specified start time. The specified agent name is a proposal for the unique agent identifier. If the respective agent identifier is already taken within the scope of the platform, the platform may use an arbitrary modification of the proposed name. The method returns the actually generated identifier.
Specifying the start time allows deferring the start of the agent execution to the respective time. Note that is guaranteed that the agent is not started before the specified start time. However, the agent is not necessarily started exactly at the respective start time depending on the execution mode of the platform.
addAgent
in interface Platform
agent
- the agent to be added to the platformname
- the name proposed as agent identifierstartTime
- the intended start timePlatform.addAgent(Agent, String)
public int handledProcesses()
Platform
handledProcesses
in interface Platform
public Timestamp currentTime()
TimeProvider
currentTime
in interface TimeProvider
public void handleControllerStateChange(Controller.State state)
ControllerStateListener
handleControllerStateChange
in interface ControllerStateListener
state
- the new controller statepublic void addStateListener(PlatformStateListener listener)
Platform
addStateListener
in interface Platform
listener
- the listener to be addedCopyright © Aimpulse Intelligent Systems GmbH
All rights reserved.