public abstract class Generator extends Entity implements ReflectionConstructable2<SimNode,Parameters>
Generator
is derived from
Entity
and is the abstract base class for all
message generators. Deriving classes must implement
getNextEventTime(double)
to calculate the time for the next message
to be generated.
Each Generator has to have exactly one MessageFactory. If no MessageFactory
is provided, Generator creates a new MessageFactory with an default Message
of type Message and length 1.
Generator provides the basic functionality for all derived generators:
- The generation of messages is controlled by events.
- Each
time an event has been processed, a new event is registered.
The creation of a message is performed by calling createMessage()
,
which forces an aggregated object derived from the class
Factory
to create a new message. Almost all
details of message generation are therefore hidden within the message
factory. The term message is used as a synonym for all possible
representations of a messages, which are derived from
Message
.
- It is possible to set and
get message factories during any phase of simulation by calling
setMessageFactory(Factory)
and getMessageFactory()
. Several
entities (generators) can share the same message factory.
- For
each generator class, there is a corresponding parser class.
Entity.PortAlias
Modifier and Type | Field and Description |
---|---|
protected boolean |
activated |
protected Event |
event |
protected Factory<Message> |
messageFactory |
protected SynchronousOutputPort |
outputPort |
portAliases, ports, simNode
CREATE_INSTANCE_METHOD_NAME
Modifier | Constructor and Description |
---|---|
protected |
Generator(SimNode ownNode) |
protected |
Generator(SimNode ownNode,
Factory<Message> factory,
boolean activateOnStart) |
Modifier and Type | Method and Description |
---|---|
void |
activate() |
protected Message |
createMessage() |
void |
deactivate() |
Factory |
getMessageFactory() |
protected abstract double |
getNextEventTime(double currentTime) |
OutputPort |
getOutput() |
void |
setActivated(boolean start) |
void |
setMessageFactory(Factory<Message> Factory) |
addPort, aliasPort, aliasPort, connect, disconnect, getName, getNode, getPortByName, getPorts, isPortKnown, unaliasPort
protected SynchronousOutputPort outputPort
protected Event event
protected boolean activated
protected Generator(SimNode ownNode)
protected abstract double getNextEventTime(double currentTime)
protected Message createMessage()
public void setActivated(boolean start)
public final void activate()
public final void deactivate()
public Factory getMessageFactory()
public OutputPort getOutput()