Package eu.iv4xr.framework.mainConcepts
Class SyntheticEventsProducer
java.lang.Object
eu.iv4xr.framework.mainConcepts.SyntheticEventsProducer
Agents (instances of
BasicAgent
or its
subclasses) are mainly state-based. But sometimes when testing using
test-agents we may want to inspect the system-under-test (SUT) in terms of
events that happen there. If the SUT itself does produce events, recent
events can be either embedded in the observation sent to the test-agent, or
sent to the agent as messages through the use of
ComNode
.
When the SUT does not in itself produces events, we can use this class to implement a wrapper that looks into the agent state and produce synthetic events.
This class is abstract, so you need to provide a concrete implementation
of it. Then, to use it, you can attach it to a test-agent using the method
TestAgent.attachSyntheticEventsProducer(SyntheticEventsProducer)
.
- Author:
- Wish
-
Field Summary
Modifier and TypeFieldDescriptionThe test-agent to which this producer is attached to.If not null, produced events will also be sent to this communication node.Produced synthetic events will be placed here. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract void
Implement this method to generate synthetic events based on the the current state of the agent.Return the list of 'current' events.
-
Field Details
-
agent
The test-agent to which this producer is attached to. -
currentEvents
Produced synthetic events will be placed here. Synthetic events are produced by the methodgenerateCurrentEvents()
. -
communicationNode
If not null, produced events will also be sent to this communication node. Other agents registering to this node will then automatically receive the events.
-
-
Constructor Details
-
SyntheticEventsProducer
public SyntheticEventsProducer()
-
-
Method Details
-
getCurrentEvents
Return the list of 'current' events. These are the events that are synthetically generated by the last call togetCurrentEvents()
. -
generateCurrentEvents
public abstract void generateCurrentEvents()Implement this method to generate synthetic events based on the the current state of the agent. Generated events are to be put incurrentEvents
; make sure to clear this list first.
-