|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object p2p.simulator.network.Network
public class Network
This class simulates the underlying network. A vector is used to store the messages that are sent using the sendMsg method. A peer can retrive a message, if there is any, using the recvMsg and its Id as parameter.
Field Summary | |
---|---|
static int |
BROADCAST
|
static int |
MULTICAST
|
static int |
POINT_TO_POINT
|
Constructor Summary | |
---|---|
Network()
Instatiates and initializes the uderlying network. |
Method Summary | |
---|---|
void |
broadcastMsg(Message msg)
Should not be used. |
java.util.Vector<Message> |
getNetQueue()
Returns the queue that stores the messages. |
void |
multicastMsg(Message msg,
long begin,
long end)
Sends a message to a range of peers. |
Message |
recvMsg(long id)
Receives a message destinate to peer with the specific id. |
void |
sendMsg(Message msg)
Sends a message to peer. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int POINT_TO_POINT
public static final int BROADCAST
public static final int MULTICAST
Constructor Detail |
---|
public Network()
Method Detail |
---|
public void sendMsg(Message msg)
msg
- The message is beeing sent.public Message recvMsg(long id)
id
- The peer's id that calls the method.
public void broadcastMsg(Message msg)
msg
- public void multicastMsg(Message msg, long begin, long end)
msg
- The message that is beeing sent.begin
- The first peer id of the range.end
- The last peer id of the range.public java.util.Vector<Message> getNetQueue()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |