|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--anthill.antsim.impl.ScenarioImpl
Class ScenarioImpl
is a simple implementation of
interface Scenario
in which a predefined set of
resources is inserted in the network and then a certain number
of requests are performed and simulate. A ScenarioImpl
is composed of a Peernet
and a ResourceSet
object. Each resource included in the ResourceSet
is inserted
before starting the simulation in the Peernet
. Then,
the ResourceSet
is used to generate a certain number
of requests to be presented to the nests composing the network.
Field Summary | |
protected Factory |
factory
Factory used to instantiate objects |
protected Peernet |
net
Peernet on which the genetic code will be evaluated |
protected int |
netVersion
Version identifier of the peer network; when init params change, the version increase |
protected static java.util.Random |
random
Random number generator |
protected ResourceSet |
resources
Set of resources stored in the Anthill network |
protected int |
rounds
Number of rounds to be performed |
protected int |
rsetVersion
Version identifier of the resource set; when init params change, the version increase |
protected Stats |
stats
Stats |
Constructor Summary | |
ScenarioImpl(Factory factory,
int rounds)
Instantiates a new ScenarioImpl. |
Method Summary | |
void |
clear()
Restores the object to its initial state. |
void |
complete()
Upcall method used to notify this listener that the request associated to it has finished to return resources. |
void |
evaluate()
Perform the evaluation of this scenario object by simulating it. |
void |
returnResources(Resource[] resources)
Upcall method used to notify this listener that the request associated to it has returned the specified set of resources. |
void |
setStats(Stats stats)
Set the statistics object which will be used throughout the scenario evaluation. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static java.util.Random random
protected Factory factory
protected int rounds
protected Stats stats
protected Peernet net
protected int netVersion
protected ResourceSet resources
protected int rsetVersion
Constructor Detail |
public ScenarioImpl(Factory factory, int rounds)
factory
- the factory object used to generate the peernet
and the resource set contained in a scenariorounds
- the number of rounds of the runMethod Detail |
public void clear()
clear
in interface Clearable
public void setStats(Stats stats)
setStats
in interface Scenario
anthill.antsim.Scenario
stats
- the object used to collect statisticspublic void evaluate()
run()
method
is executed. Statistics about the simulated execution of the
code are collected in the Stats
object specified
through method setStats()
.evaluate
in interface Scenario
public void returnResources(Resource[] resources)
returnResources
in interface ResponseListener
resources
- the resources found.public void complete()
complete
in interface ResponseListener
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |