experiment
Class Scenario

java.lang.Object
  extended by experiment.Scenario

public class Scenario
extends java.lang.Object

Created by IntelliJ IDEA. User: andy Date: Mar 11, 2010 Based on the real set of data a number of scenarios can be specified. For example, a failure can be simulated by disabling a node or modifying the rssi value on a link at a certain moment in time. As the real data will be used in simulators, WiseML provides a section in the description in which these scenarios can be specified.


Constructor Summary
Scenario(java.lang.String id)
          Default Constructor
 
Method Summary
 void addEvent(Event ev)
          Add an ecent to the scenario's queue
 boolean apply(double visualizationWindow, ExperimentState state)
          Applies the youngest event after checking if it's time.
 java.lang.String getId()
           
 boolean isTime(ExperimentState state, double visualizationWindow)
          Tests if it's the right time to apply the younger event.
 Event pullEvent()
          Returns the younger event
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scenario

public Scenario(java.lang.String id)
Default Constructor

Parameters:
id - the scenario's id
Method Detail

addEvent

public void addEvent(Event ev)
Add an ecent to the scenario's queue

Parameters:
ev - the event to be added

apply

public boolean apply(double visualizationWindow,
                     ExperimentState state)
              throws badSyntaxException
Applies the youngest event after checking if it's time. todo: change the visualizationWindow name and concept.

Parameters:
visualizationWindow - the time window in milliseconds before the next update
state - defines which of the experiment states to apply it to.
Returns:
true if the youngest event was applied
Throws:
badSyntaxException - in case of a malformed event.

getId

public java.lang.String getId()
Returns:
the Scenario's unique id

isTime

public boolean isTime(ExperimentState state,
                      double visualizationWindow)
Tests if it's the right time to apply the younger event.

Parameters:
state - defines which of the experiment states to check.
visualizationWindow - the time window in milliseconds before the next update.
Returns:
true if it is time to apply the youngest event of this scenario.

pullEvent

public Event pullEvent()
Returns the younger event

Returns:
the tail of the event queue