public interface Platform extends TimeProvider
setup
, start
, and stop
)
as well as methods for adding agents
.
Additionally, the interface allows platform status queries such as the platform state
.Modifier and Type | Interface and Description |
---|---|
static class |
Platform.Mode
The execution mode of the platform.
|
static class |
Platform.State
The current state of the platform.
|
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.
|
Platform.Mode |
getMode()
Returns the execution mode of the platform.
|
Platform.State |
getState()
Returns the current state of the platform.
|
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.
|
currentTime
void setup(RuntimeEnvironment config)
config
- the configuration of the platformvoid start()
IllegalStateException
- if the platform is not in the initialised statevoid stop()
IllegalStateException
- if the platform is not runningPlatform.State getState()
Platform.Mode getMode()
IllegalStateException
- if the mode is not specified yetAgentIdentifier addAgent(Agent agent, String name)
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.
agent
- the agent to be added to the platformname
- the name proposed as agent identifieraddAgent(Agent, String, Timestamp)
AgentIdentifier addAgent(Agent agent, String name, Timestamp startTime)
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.
agent
- the agent to be added to the platformname
- the name proposed as agent identifierstartTime
- the intended start timeaddAgent(Agent, String)
int handledProcesses()
void addStateListener(PlatformStateListener listener)
listener
- the listener to be addedCopyright © Aimpulse Intelligent Systems GmbH
All rights reserved.