peersim.dynamics
Class WireGraph

java.lang.Object
  extended by peersim.dynamics.WireGraph
All Implemented Interfaces:
Control
Direct Known Subclasses:
WireByMethod, WireFromFile, WireInetTopology, WireKOut, WireRegRootedTree, WireRingLattice, WireScaleFreeBA, WireScaleFreeDM, WireStar, WireWS

public abstract class WireGraph
extends java.lang.Object
implements Control

This class is the superclass of classes that takes a Linkable protocol or a graph and add edges that define a certain topology. Note that no connections are removed, they are only added. So it can be used in combination with other initializers.


Parameter Summary
protocol
          The Linkable protocol to operate on.
pack
          If this config property is defined, method Linkable.pack() is invoked on the specified protocol at the end of the wiring phase.
undir
          If set, the generated graph is undirected.
undirected
          Alias for "undir".
 
Field Summary
 Graph g
          If set (not null), this is the graph to wire.
protected  int pid
          The protocol we want to wire.
 boolean undir
          If true, edges are added in an undirected fashion.
 
Constructor Summary
protected WireGraph(java.lang.String prefix)
          Standard constructor that reads the configuration parameters.
 
Method Summary
 boolean execute()
          Calls method wire(peersim.graph.Graph) with the graph g, or if null, on the overlay specified by the protocol given by config parameter "protocol".
abstract  void wire(Graph g)
          The method that should wire (add edges to) the given graph.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Parameter Detail

protocol

The Linkable protocol to operate on. If it is not specified, then operates on g. If g is null, execute() throws an Exception. Note that if g is set, it will be used irrespective of the setting of the protocol in this field.


pack

If this config property is defined, method Linkable.pack() is invoked on the specified protocol at the end of the wiring phase. Default to false.


undir

If set, the generated graph is undirected. In other words, for each link (i,j) a link (j,i) will also be added. Defaults to false.


undirected

Alias for "undir".

Field Detail

pid

protected final int pid
The protocol we want to wire. It is negative if no protocol was set (in that case, a graph must be specified, see g).


undir

public final boolean undir
If true, edges are added in an undirected fashion.


g

public Graph g
If set (not null), this is the graph to wire. If null, the current overlay is wired each time execute() is called, as specified by "protocol".

Constructor Detail

WireGraph

protected WireGraph(java.lang.String prefix)
Standard constructor that reads the configuration parameters. Normally invoked by the simulation engine.

Parameters:
prefix - the configuration prefix for this class
Method Detail

execute

public final boolean execute()
Calls method wire(peersim.graph.Graph) with the graph g, or if null, on the overlay specified by the protocol given by config parameter "protocol". If neither g, nor "protocol" is set, throws a RuntimException.

Specified by:
execute in interface Control
Returns:
true if the simulation has to be stopped, false otherwise.

wire

public abstract void wire(Graph g)
The method that should wire (add edges to) the given graph. Has to be implemented by extending classes