MATES 3.0-rc2

org.mates.plugins
Class StatisticsPlugin

java.lang.Object
  extended byorg.mates.sim.Experiment
      extended byorg.mates.plugins.StatisticsPlugin

public class StatisticsPlugin
extends Experiment

A plugin experiment for keeping track of statistics (mostly about the topology).

Author:
Evan Sultanik

Field Summary
 
Fields inherited from class org.mates.sim.Experiment
parent, simulator
 
Constructor Summary
StatisticsPlugin(Experiment parent)
           
 
Method Summary
 int[] getAverageDegreeDistribution()
          Returns the average degree distribution of the topology.
 double getAverageHostDegree()
          Returns the average neighborhood size of each host thus far in the simulation.
 double getAverageTopologyDensity()
          Returns the average density of the topology.
 double getAverageTopologyDiameter()
          Returns the average neighborhood size of each host thus far in the simulation.
 java.awt.Component getGUI()
          Returns the GUI component associated with this experiment.
protected  void handleInitialize()
          Callback function for initializing the experiment.
protected  void handleIterate()
          Callback function for iterating the experiment.
protected  void handleReset()
          Callback function for resetting the experiment.
 void paintAverageDegreeDistribution(java.awt.Graphics graphics, int width, int height)
          Draws the current topology's average degree distribution as a bar graph.
 void paintDegreeDistribution(java.awt.Graphics graphics, int width, int height)
          Draws the current topology's degree distribution as a bar graph.
static void paintDegreeDistribution(java.awt.Graphics graphics, int width, int height, Topology topology)
          Draws a topology's degree distribution as a bar graph.
static void paintDistribution(java.awt.Graphics graphics, int width, int height, int[] dist)
          Draws a distribution as a bar graph.
 void resetAverageDegreeDistribution()
          Resets the average degree distribution.
 void resetAverageHostDegree()
          Resets the average host degree statistic counters.
 void resetAverageTopologyDensity()
          Resets the average topology density statistic counters.
 void resetAverageTopologyDiameter()
          Resets the average topology diameter statistic counters.
 boolean saveAverageDegreeDistribution(java.io.File file, int width, int height)
          Saves the current topology's average degree distribution to an image file.
 boolean saveDegreeDistribution(java.io.File file, int width, int height)
          Saves the current topology's degree distribution to an image file.
static boolean saveDegreeDistribution(java.io.File file, int width, int height, Topology topology)
          Saves a topology's degree distribution to an image file.
 
Methods inherited from class org.mates.sim.Experiment
complete, getMenuItems, getParentExperiment, getSimulator, getSubExperiments, handleMenuAction, initialize, iterate, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StatisticsPlugin

public StatisticsPlugin(Experiment parent)
Method Detail

handleInitialize

protected void handleInitialize()
Description copied from class: Experiment
Callback function for initializing the experiment. Sub-classes of Experiment need not re-implement this function. This function is empty by default; therefore, super.handleInitialize() need not be called from re-implementations of this function.

Overrides:
handleInitialize in class Experiment

handleIterate

protected void handleIterate()
Description copied from class: Experiment
Callback function for iterating the experiment. This function will be called after the simulator has been iterated. Sub-classes of Experiment need not re-implement this function. This function is empty by default; therefore, super.handleIterate() need not be called from re-implementations of this function.

Overrides:
handleIterate in class Experiment

handleReset

protected void handleReset()
Description copied from class: Experiment
Callback function for resetting the experiment. This function will be called after the simulator has been reset. Sub-classes of Experiment need not re-implement this function. This function is empty by default; therefore, super.handleReset() need not be called from re-implementations of this function.

Overrides:
handleReset in class Experiment

saveAverageDegreeDistribution

public boolean saveAverageDegreeDistribution(java.io.File file,
                                             int width,
                                             int height)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
Saves the current topology's average degree distribution to an image file.

Throws:
java.lang.ClassNotFoundException - when writing to an EPS file and org.jibble.epsgraphics.EpsGraphics2D cannot be found.
java.io.IOException - on error writing to file.
See Also:
Screenshot.saveScreenshot(Object, int, int, java.io.File)

saveDegreeDistribution

public boolean saveDegreeDistribution(java.io.File file,
                                      int width,
                                      int height)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Saves the current topology's degree distribution to an image file.

Throws:
java.lang.ClassNotFoundException - when writing to an EPS file and org.jibble.epsgraphics.EpsGraphics2D cannot be found.
java.io.IOException - on error writing to file.
See Also:
Screenshot.saveScreenshot(Object, int, int, java.io.File)

saveDegreeDistribution

public static boolean saveDegreeDistribution(java.io.File file,
                                             int width,
                                             int height,
                                             Topology topology)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
Saves a topology's degree distribution to an image file.

Throws:
java.lang.ClassNotFoundException - when writing to an EPS file and org.jibble.epsgraphics.EpsGraphics2D cannot be found.
java.io.IOException - on error writing to file.
See Also:
Screenshot.saveScreenshot(Object, int, int, java.io.File)

paintAverageDegreeDistribution

public void paintAverageDegreeDistribution(java.awt.Graphics graphics,
                                           int width,
                                           int height)
Draws the current topology's average degree distribution as a bar graph.


paintDegreeDistribution

public void paintDegreeDistribution(java.awt.Graphics graphics,
                                    int width,
                                    int height)
Draws the current topology's degree distribution as a bar graph.


paintDegreeDistribution

public static void paintDegreeDistribution(java.awt.Graphics graphics,
                                           int width,
                                           int height,
                                           Topology topology)
Draws a topology's degree distribution as a bar graph.


paintDistribution

public static void paintDistribution(java.awt.Graphics graphics,
                                     int width,
                                     int height,
                                     int[] dist)
Draws a distribution as a bar graph.


resetAverageHostDegree

public void resetAverageHostDegree()
Resets the average host degree statistic counters.


resetAverageTopologyDensity

public void resetAverageTopologyDensity()
Resets the average topology density statistic counters.


resetAverageTopologyDiameter

public void resetAverageTopologyDiameter()
Resets the average topology diameter statistic counters.


resetAverageDegreeDistribution

public void resetAverageDegreeDistribution()
Resets the average degree distribution.


getAverageTopologyDensity

public double getAverageTopologyDensity()
Returns the average density of the topology. The density is the number of non-loop edges in the graph divided by (n2-n), where n is the number of vertices (i.e. hosts) in the graph. This function will always return a value in the range of [0, 1].


getAverageTopologyDiameter

public double getAverageTopologyDiameter()
Returns the average neighborhood size of each host thus far in the simulation.


getAverageHostDegree

public double getAverageHostDegree()
Returns the average neighborhood size of each host thus far in the simulation.


getAverageDegreeDistribution

public int[] getAverageDegreeDistribution()
Returns the average degree distribution of the topology. This function may return null.

See Also:
Topology.getDegreeDistribution()

getGUI

public java.awt.Component getGUI()
Description copied from class: Experiment
Returns the GUI component associated with this experiment. This component will then be displayed if GraphicalUserInterface is used. This function defaults to return null. getGUI() is intended for child classes that extend Experiment to re-implement this function and return a GUI object.

Overrides:
getGUI in class Experiment

MATES 3.0-rc2

Submit a bug or request a feature
http://mates.sourceforge.net/

Copyright 2004 Evan Sultanik