|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectSim.World
public class World
World implements a world of Nodes. The World also simulates the physical transmission of packets, and whether a packet is lost due to noise.
Constructor Summary | |
---|---|
World(edu.rit.numeric.prob.BooleanPrng noisePrng)
Constructs a new World, using the given BooleanPrng to determine packet loss. |
|
World(double noiseRatio,
java.util.Random rng)
Constructs a new World with the given amount of noise. |
Method Summary | |
---|---|
void |
addNode(Node n)
Adds a Node into the World that is capable of receiving frames. |
Node |
getNode(int address)
Returns the Node whose address matches the address given, if it is part of this World. |
Node |
getRandomNode(java.util.Random rng)
Returns a Node in the World at random, with an equal probability of returning any specific Node. |
boolean |
removeNode(int address)
Removes a Node (by giving its unique address) from the World. |
void |
sendFrame(HardwareFrame frame,
Location transmissionPoint,
double distance)
Sends a frame to all Nodes within listening range of the transmission point given. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public World(double noiseRatio, java.util.Random rng)
noiseRatio
- a percentage from 0 (no loss) to 1 (total loss)rng
- non-null source of randomness to use for packet losspublic World(edu.rit.numeric.prob.BooleanPrng noisePrng)
noisePrng
- a percentage from 0 (no loss) to 1 (total loss)Method Detail |
---|
public void addNode(Node n)
n
- non-null Node with unique (to this World) addresspublic Node getNode(int address)
address
- address of Node to return
public Node getRandomNode(java.util.Random rng)
rng
- non-null source of randomness, from which a single integer will be pulled.
public boolean removeNode(int address)
address
- address of Node to remove
public void sendFrame(HardwareFrame frame, Location transmissionPoint, double distance)
frame
- non-null HardwareFrametransmissionPoint
- non-null Locationdistance
- distance in which frame can be received.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |