public class MessageEventGenerator extends java.lang.Object implements EventQueue
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
HOST_RANGE_S
Sender/receiver address range -setting id ("hosts").
|
protected int[] |
hostRange
Range of host addresses that can be senders or receivers
|
protected java.lang.String |
idPrefix
Prefix for the messages
|
static java.lang.String |
MESSAGE_ID_PREFIX_S
Message ID prefix -setting id ("prefix").
|
static java.lang.String |
MESSAGE_INTERVAL_S
Message creation interval range -setting id ("interval").
|
static java.lang.String |
MESSAGE_SIZE_S
Message size range -setting id ("size").
|
static java.lang.String |
MESSAGE_TIME_S
Message creation time range -setting id ("time").
|
protected double[] |
msgTime
Time range for message creation (min, max)
|
protected double |
nextEventsTime
Time of the next event (simulated seconds)
|
protected java.util.Random |
rng
Random number generator for this Class
|
static java.lang.String |
TO_HOST_RANGE_S
(Optional) receiver address range -setting id ("tohosts").
|
protected int[] |
toHostRange
Range of host addresses that can be receivers
|
| Constructor and Description |
|---|
MessageEventGenerator(Settings s)
Constructor, initializes the interval between events,
and the size of messages generated, as well as number
of hosts in the network.
|
| Modifier and Type | Method and Description |
|---|---|
protected int |
drawHostAddress(int[] hostRange)
Draws a random host address from the configured address range
|
protected int |
drawMessageSize()
Generates a (random) message size
|
protected int |
drawNextEventTimeDiff()
Generates a (random) time difference between two events
|
protected int |
drawToAddress(int[] hostRange,
int from)
Draws a destination host address that is different from the "from"
address
|
protected java.lang.String |
getID()
Returns a next free message ID
|
ExternalEvent |
nextEvent()
Returns the next message creation event
|
double |
nextEventsTime()
Returns next message creation event's time
|
public static final java.lang.String MESSAGE_SIZE_S
public static final java.lang.String MESSAGE_INTERVAL_S
public static final java.lang.String HOST_RANGE_S
public static final java.lang.String TO_HOST_RANGE_S
HOST_RANGE_S setting's range.
The lower bound is inclusive and upper bound exclusive.public static final java.lang.String MESSAGE_ID_PREFIX_S
public static final java.lang.String MESSAGE_TIME_S
protected double nextEventsTime
protected int[] hostRange
protected int[] toHostRange
protected java.lang.String idPrefix
protected double[] msgTime
protected java.util.Random rng
public MessageEventGenerator(Settings s)
s - Settings for this generator.protected int drawHostAddress(int[] hostRange)
hostRange - The range of hostsprotected int drawMessageSize()
protected int drawNextEventTimeDiff()
protected int drawToAddress(int[] hostRange,
int from)
hostRange - The range of hostsfrom - the "from" addresspublic ExternalEvent nextEvent()
nextEvent in interface EventQueueEventQueue.nextEvent()public double nextEventsTime()
nextEventsTime in interface EventQueueEventQueue.nextEventsTime()protected java.lang.String getID()