Class SyntheticEventsProducer

java.lang.Object
eu.iv4xr.framework.mainConcepts.SyntheticEventsProducer

public abstract class SyntheticEventsProducer extends Object
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 Details

    • agent

      public TestAgent agent
      The test-agent to which this producer is attached to.
    • currentEvents

      public List<Message> currentEvents
      Produced synthetic events will be placed here. Synthetic events are produced by the method generateCurrentEvents().
    • communicationNode

      public ComNode 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

      public List<Message> getCurrentEvents()
      Return the list of 'current' events. These are the events that are synthetically generated by the last call to getCurrentEvents().
    • 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 in currentEvents; make sure to clear this list first.