bcds.phison.sim
Class PmBase<V,E>

java.lang.Object
  extended by bcds.phison.sim.PmBase<V,E>
All Implemented Interfaces:
ProcessingModule<V,E>, WithEnvParams
Direct Known Subclasses:
PmDTypeReplicator, PmDumpRAState, PmElemsSequencer, PmLinkFailure, PmNetProps, PmSID, PmSIDTraceToDOT, PmStatic, PmTrace2TR, PmTraceConn, PmTraceConnGbl, PmTraceLinkUsage, PmTraceLinkUsageToDOT, PmTracePathLength, PmTraceProgress, PmTraceTimestepBlocking, PmTraceTrafficMatrix, PmTrfReader

public abstract class PmBase<V,E>
extends java.lang.Object
implements ProcessingModule<V,E>, WithEnvParams

Provides default functionality and data for classes implementing the ProcessingModule interface.

Author:
Juan Segovia S.

Constructor Summary
PmBase()
           
 
Method Summary
 SimGlobals<V,E> ctx()
          Returns the simulation context.
 Environ env()
          This is an alias for getEnviron().
 Environ getEnviron()
          Returns the environment object, which comes from the simulator and is shared among all the processing modules of a single simulation run.
 java.lang.Object[] getEnvParams()
          Returns an empty array.
 java.lang.String getId()
          A (unique) ID.
 java.lang.String getName()
          Returns this instance's unqualified class name.
 SimParams opt()
          Returns the global simulation parameters.
 void run(SimEvents evtype, ConnectionInfo<V,E> rq)
          Empty implementation.
 void setup(SimCore<V,E> sim)
          Saves the parameter sim, which can later be obtained by calling the sim() method.
 void shutdown()
          Empty implementation.
 SimCore<V,E> sim()
          Returns the simulator core object.
 SimStatsCollector stats()
          Returns the statistics collector object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PmBase

public PmBase()
Method Detail

setup

public void setup(SimCore<V,E> sim)
Saves the parameter sim, which can later be obtained by calling the sim() method. It also calls adaptTypes if the environment object is non-null (which should normally be).

Specified by:
setup in interface ProcessingModule<V,E>

getId

public java.lang.String getId()
Description copied from interface: ProcessingModule
A (unique) ID. This can be used for locating an instance in a modules registry, for example.

Specified by:
getId in interface ProcessingModule<V,E>

getName

public java.lang.String getName()
Returns this instance's unqualified class name. Purpose: comply with ProcessingModule/WithEnvParams.

Specified by:
getName in interface WithEnvParams

run

public void run(SimEvents evtype,
                ConnectionInfo<V,E> rq)
Empty implementation.

Specified by:
run in interface ProcessingModule<V,E>

shutdown

public void shutdown()
Empty implementation.

Specified by:
shutdown in interface ProcessingModule<V,E>

env

public Environ env()
This is an alias for getEnviron().


getEnvParams

public java.lang.Object[] getEnvParams()
Returns an empty array. This is the default implementation, suitable for modules that do not need additional environment parameters.

Specified by:
getEnvParams in interface WithEnvParams

getEnviron

public Environ getEnviron()
Returns the environment object, which comes from the simulator and is shared among all the processing modules of a single simulation run.

Specified by:
getEnviron in interface WithEnvParams

sim

public SimCore<V,E> sim()
Returns the simulator core object.

Specified by:
sim in interface ProcessingModule<V,E>

ctx

public SimGlobals<V,E> ctx()
Returns the simulation context. It is shorthand for sim().ctx().


opt

public SimParams opt()
Returns the global simulation parameters. It is a shorthand for sim().opt.


stats

public SimStatsCollector stats()
Returns the statistics collector object. It is shorthand for sim().ctx().stats.