verinec.netsim.gui
Class SimulationScheduler

java.lang.Object
  extended by verinec.netsim.gui.SimulationScheduler

public class SimulationScheduler
extends Object

Responsible for the animation of the events. For this reason, the class maintains two tables, one containing all the events and another for the current active events.

Author:
Renato Loeffel

Field Summary
private  DefaultTableModel activeEvents
           
private  DefaultTableModel eventTable
           
private  int halftime
          needed for Layer2Receive, to determine their start-time.
private  boolean[] layerFilter
          A filter to control which layers are shown.
private  int pausetime
           
private  int simulationend
          unrealistic low value, so this will be changed during initialisation.
private  int simulationstart
          unrealistic high value, so this will be changed during initialisation.
private  SimulatorThread simuThread
           
private  VerinecStudio verinecStudio
           
 
Constructor Summary
SimulationScheduler(Element events, SimulatorThread simuThread, VerinecStudio parent)
          Parses all the events and adds them to the table.
 
Method Summary
private  void addToTable(Element events, Vector data)
          Helper method to parse the testfile.
 void animateEvents(int time, int substeps)
          Animates all events in the table of the current active events.
 void filterEvents(boolean[] theFilter)
          Sets a filter for the layers.
 void loadEvents(int time)
          Update the events table to contain the current ones.
 void schedulepause(int time)
          Schedules a pause.
 void terminateSimulation()
          Removes the filterpanel from the sidewindow when the simulation is terminated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

verinecStudio

private VerinecStudio verinecStudio

simuThread

private SimulatorThread simuThread

eventTable

private DefaultTableModel eventTable

activeEvents

private DefaultTableModel activeEvents

layerFilter

private boolean[] layerFilter
A filter to control which layers are shown. Only the events which value is set to true are shown: Layer5Event: layerFilter[5] Layer4Event: layerFilter[4] Layer3Event: layerFilter[3] Layer2EventMac: layerFilter[2] Layer2EventSend: layerFilter[1] Layer2EventReceive: layerFilter[1] layerFilter[0] would be for events on hardware layer, which is currently not simulated.


simulationstart

private int simulationstart
unrealistic high value, so this will be changed during initialisation.


simulationend

private int simulationend
unrealistic low value, so this will be changed during initialisation.


halftime

private int halftime
needed for Layer2Receive, to determine their start-time.


pausetime

private int pausetime
Constructor Detail

SimulationScheduler

public SimulationScheduler(Element events,
                           SimulatorThread simuThread,
                           VerinecStudio parent)
                    throws SimulationException
Parses all the events and adds them to the table.

Parameters:
events - the whole testfile.
simuThread - the owner of the Scheduler.
parent - A reference to the main application window.
Throws:
SimulationException - When a network component can not be found on the panel.
Method Detail

addToTable

private void addToTable(Element events,
                        Vector data)
                 throws SimulationException
Helper method to parse the testfile. Extracts the events recursively.

Parameters:
events - the current events
data - the ancient events
Throws:
SimulationException - when a networkcomponent could not be found on the panel.

schedulepause

public void schedulepause(int time)
Schedules a pause. (needed by the step buttons).

Parameters:
time - the time when the pause shall occur.

animateEvents

public void animateEvents(int time,
                          int substeps)
Animates all events in the table of the current active events.

Parameters:
time - the current simulation time.
substeps - the current substeps.

loadEvents

public void loadEvents(int time)
Update the events table to contain the current ones. Removes all the events which reached their end time from the table of the active events. Adds the new events which occur at the current time to the table.

Parameters:
time - The time to load events for.

filterEvents

public void filterEvents(boolean[] theFilter)
Sets a filter for the layers.

Parameters:
theFilter - the desired layers.
See Also:
layerFilter

terminateSimulation

public void terminateSimulation()
Removes the filterpanel from the sidewindow when the simulation is terminated.


Copyright © 2005 Verinec, DIUF