|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectplanet.simulate.NetworkSimulator
The simulator is the main class. It controls the events to execute them
at the opportune moment and controls the network.
The operational model consists of building a network with the actual
specified parametres at properties files under root directory 'conf'.
Then, this simulator modifies the network by invoking different methods.
The information that is contained by this simulator is the time
(number of steps) of the simulation and the IScheduler specified by constructor.
Constructor Summary | |
NetworkSimulator(IScheduler timer)
Constructor, create a new simulation with a determinate event scheduler and a new network. |
|
NetworkSimulator(IScheduler timer,
Network net)
Constructor, create a new simulation with a determinate event scheduler |
|
NetworkSimulator(IScheduler timer,
Network net,
java.lang.String factoriesProperties,
java.lang.String simProperties,
java.lang.String chordProperties)
Constructor that generates a new instance of Network and prepares its simulation using the parameters specified in the properties file. |
Method Summary | |
void |
addNode(Id id,
Id bootstrap)
Create and joins a new node to the simulated network. |
void |
addNode(Node node,
Id bootstrap)
Joins a new node to the simulated network. |
Network |
getInternalNetwork()
Returns a reference of the internal network. |
int |
getSizeNetwork()
Return the size of the network |
void |
parseEvents(java.util.Vector events)
Prepares all events to simulate from a events vector |
void |
parseFail(IEvent aEvent)
Prepares the fail event to simulate from a event interface |
void |
parseJoin(IEvent aEvent)
Prepares the join event to simulate from a event interface |
void |
parseLeave(IEvent aEvent)
Prepares the leave event to simulate from a event interface |
void |
printNodes()
|
void |
run(int steps)
Executes the events at the opportune moment, controls the nodes, while they join, go away, they fail,and handles to the messages and the message queues |
void |
saveState()
Serialize the actual state. |
boolean |
simulate()
Executes only one step of simulation. |
void |
stabilize()
Make a simple loop that make the stabilization of the actual network. |
void |
stop()
Do nothing. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public NetworkSimulator(IScheduler timer) throws InitializationException
timer
- Scheduler with the all events to simulateIScheduler
public NetworkSimulator(IScheduler timer, Network net) throws InitializationException
timer
- Scheduler with the all events to simulateIScheduler
public NetworkSimulator(IScheduler timer, Network net, java.lang.String factoriesProperties, java.lang.String simProperties, java.lang.String chordProperties) throws InitializationException
timer
- IScheduler with events.factoriesProperties
- Property file with all parameters for factories.simProperties
- Property file with all parameters for simulator.chordProperties
- Property file with all parameters for Chord.
InitializationException
- if occur any problem during initialization.Method Detail |
public void run(int steps) throws InitializationException
run
in interface ISimulator
steps
- number of steps that the simulation lasts
InitializationException
public void saveState()
public boolean simulate() throws InitializationException
InitializationException
public void stabilize() throws InitializationException
while (simulate());
InitializationException
- if occur any problem during simulation.public void addNode(Node node, Id bootstrap) throws InitializationException
node
- New node to add to the network.bootstrap
- Id of the any node in the network
InitializationException
public void printNodes()
public void addNode(Id id, Id bootstrap) throws InitializationException
id
- Id of the new nodebootstrap
- Id of the any node in the network
InitializationException
public void parseEvents(java.util.Vector events) throws InitializationException
events
- Vector of events
InitializationException
public void parseJoin(IEvent aEvent) throws InitializationException
aEvent
- IEvent
InitializationException
IEvent
public void parseLeave(IEvent aEvent) throws InitializationException
aEvent
- IEvent
InitializationException
IEvent
public void parseFail(IEvent aEvent) throws InitializationException
aEvent
- IEvent
InitializationException
IEvent
public void stop()
stop
in interface ISimulator
ISimulator.stop()
public int getSizeNetwork()
public Network getInternalNetwork()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |