input
Class MessageEventGenerator

java.lang.Object
  extended by input.MessageEventGenerator
All Implemented Interfaces:
EventQueue
Direct Known Subclasses:
MessageBurstGenerator, OneFromEachMessageGenerator, OneToEachMessageGenerator

public class MessageEventGenerator
extends java.lang.Object
implements EventQueue

Message creation -external events generator. Creates uniformly distributed message creation patterns whose message size and inter-message intervals can be configured.


Field Summary
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 Summary
MessageEventGenerator(Settings s)
          Constructor, initializes the interval between events, and the size of messages generated, as well as number of hosts in the network.
 
Method Summary
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESSAGE_SIZE_S

public static final java.lang.String MESSAGE_SIZE_S
Message size range -setting id ("size"). Can be either a single value or a range (min, max) of uniformly distributed random values. Defines the message size (bytes).

See Also:
Constant Field Values

MESSAGE_INTERVAL_S

public static final java.lang.String MESSAGE_INTERVAL_S
Message creation interval range -setting id ("interval"). Can be either a single value or a range (min, max) of uniformly distributed random values. Defines the inter-message creation interval (seconds).

See Also:
Constant Field Values

HOST_RANGE_S

public static final java.lang.String HOST_RANGE_S
Sender/receiver address range -setting id ("hosts"). The lower bound is inclusive and upper bound exclusive.

See Also:
Constant Field Values

TO_HOST_RANGE_S

public static final java.lang.String TO_HOST_RANGE_S
(Optional) receiver address range -setting id ("tohosts"). If a value for this setting is defined, the destination hosts are selected from this range and the source hosts from the HOST_RANGE_S setting's range. The lower bound is inclusive and upper bound exclusive.

See Also:
Constant Field Values

MESSAGE_ID_PREFIX_S

public static final java.lang.String MESSAGE_ID_PREFIX_S
Message ID prefix -setting id ("prefix"). The value must be unique for all message sources, so if you have more than one message generator, use different prefix for all of them. The random number generator's seed is derived from the prefix, so by changing the prefix, you'll get also a new message sequence.

See Also:
Constant Field Values

MESSAGE_TIME_S

public static final java.lang.String MESSAGE_TIME_S
Message creation time range -setting id ("time"). Defines the time range when messages are created. No messages are created before the first and after the second value. By default, messages are created for the whole simulation time.

See Also:
Constant Field Values

nextEventsTime

protected double nextEventsTime
Time of the next event (simulated seconds)


hostRange

protected int[] hostRange
Range of host addresses that can be senders or receivers


toHostRange

protected int[] toHostRange
Range of host addresses that can be receivers


idPrefix

protected java.lang.String idPrefix
Prefix for the messages


msgTime

protected double[] msgTime
Time range for message creation (min, max)


rng

protected java.util.Random rng
Random number generator for this Class

Constructor Detail

MessageEventGenerator

public MessageEventGenerator(Settings s)
Constructor, initializes the interval between events, and the size of messages generated, as well as number of hosts in the network.

Parameters:
s - Settings for this generator.
Method Detail

drawHostAddress

protected int drawHostAddress(int[] hostRange)
Draws a random host address from the configured address range

Parameters:
hostRange - The range of hosts
Returns:
A random host address

drawMessageSize

protected int drawMessageSize()
Generates a (random) message size

Returns:
message size

drawNextEventTimeDiff

protected int drawNextEventTimeDiff()
Generates a (random) time difference between two events

Returns:
the time difference

drawToAddress

protected int drawToAddress(int[] hostRange,
                            int from)
Draws a destination host address that is different from the "from" address

Parameters:
hostRange - The range of hosts
from - the "from" address
Returns:
a destination address from the range, but different from "from"

nextEvent

public ExternalEvent nextEvent()
Returns the next message creation event

Specified by:
nextEvent in interface EventQueue
Returns:
The next event
See Also:
EventQueue.nextEvent()

nextEventsTime

public double nextEventsTime()
Returns next message creation event's time

Specified by:
nextEventsTime in interface EventQueue
Returns:
Next event's time
See Also:
EventQueue.nextEventsTime()

getID

protected java.lang.String getID()
Returns a next free message ID

Returns:
next globally unique message ID