|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ProcessingModule<V,E>
Processing modules for PHISON must implement this interface.
Method Summary | |
---|---|
java.lang.String |
getId()
Deprecated. Use the method getName of WithEnvParams instead. |
void |
run(SimEvents evtype,
ConnectionInfo<V,E> rq)
Process an event, whose type evtype . |
void |
setup(SimCore<V,E> sim)
Performs initialization of a new instance. |
void |
shutdown()
Called by the simulator when simulation has finished. |
SimCore<V,E> |
sim()
Returns the core simulator object to which this module is associated. |
Methods inherited from interface bcds.phison.WithEnvParams |
---|
getEnviron, getEnvParams, getName |
Method Detail |
---|
void setup(SimCore<V,E> sim)
Classes that implement this interface are expected to define a list of environment parameters. The actual values for these parameters are obtained from the simulator, however. That is, the environment object is shared among all modules of a specific simulation run.
Note that a module may choose to copy the value of an environment parameter into a field, so that future uses of that parameter does not involve consulting the environment object. This means that, in such a case, further changes to the values in the environment will not affect the behaviour of the processing module after setup. Conversely, another module might just access the environment object every time the value of a parameter is needed. Each class should clearly state which approach it takes.
void run(SimEvents evtype, ConnectionInfo<V,E> rq)
evtype
. Extra information
is in rq
.
Note that there is no restriction about what a module can do during
a call to run. For example, it can remove a connection from
the TED object, mark links as failed, etc. If a the event is a connection
request that was successfully established, and for some reason it needs
to be removed (make it a rejected connection), the connection must be
removed from the TED and working path in the rq
object must
be set to null so that the remaning modules can see the
connection as "rejected".
If early termination is needed, a module can throw LimitReachedException, which will prevent the activation of any additional module. However, enqueued calls will still be called, unless the maxtime field of the "option" object is also set to the current time (or, better yet, to a time already passed). The way to programatically provoke an early termination is then,
... opt().maxtime = sim().getTime()-1; throw new LimitReachedException("Early termination at " + sim.getTime());
void shutdown()
java.lang.String getId()
SimCore<V,E> sim()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |