Query Cycle Simulator HEADER

qcsim.net.impl
Class PowerLawNetworkImpl

java.lang.Object
  |
  +--qcsim.net.impl.PowerLawNetworkImpl
All Implemented Interfaces:
NetworkSimulator

public class PowerLawNetworkImpl
extends java.lang.Object
implements NetworkSimulator

Implements the network functionality.

Version:
1.0
Author:
unascribed

Field Summary
 
Fields inherited from interface qcsim.net.NetworkSimulator
MAX_TTL, MED_TTL, MIN_TTL
 
Constructor Summary
PowerLawNetworkImpl(PeerManager manager)
           
 
Method Summary
 void goodPeers(int nodes, int neighbors)
          Creates power-law topology network of good peers.
 void highlyTrustedPeers(int nodes, int neighbors)
          Adds highly trusted peers to the network.
 void maliciousPeers(int nodes, int neighbors)
          Adds malicious peers to the network.
 int messages()
          The number of messages transfered during a simulated cycle.
 double rpc(int dest, PeerRPC cmd)
          Send rpc command to peer
 void send(int dest, PeerMessage msg)
          Send a message to a peer.
 int trustValueRequests()
          Total number of trust value request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PowerLawNetworkImpl

public PowerLawNetworkImpl(PeerManager manager)
Method Detail

trustValueRequests

public int trustValueRequests()
Description copied from interface: NetworkSimulator
Total number of trust value request.

Specified by:
trustValueRequests in interface NetworkSimulator

messages

public int messages()
Description copied from interface: NetworkSimulator
The number of messages transfered during a simulated cycle.

Specified by:
messages in interface NetworkSimulator

send

public void send(int dest,
                 PeerMessage msg)
Send a message to a peer.

Specified by:
send in interface NetworkSimulator
Parameters:
dest - destination peer id.
msg - message to send.

rpc

public double rpc(int dest,
                  PeerRPC cmd)
Send rpc command to peer

Specified by:
rpc in interface NetworkSimulator
Parameters:
dest - Destination of rpc call.
cmd - The remote procedure command.
Returns:
the rpc return value.

goodPeers

public void goodPeers(int nodes,
                      int neighbors)
Creates power-law topology network of good peers.

Specified by:
goodPeers in interface NetworkSimulator
Parameters:
nodes - number of nodes in network
neighbors - initial number of neighbors for each peer

highlyTrustedPeers

public void highlyTrustedPeers(int nodes,
                               int neighbors)
Adds highly trusted peers to the network.

Specified by:
highlyTrustedPeers in interface NetworkSimulator
Parameters:
nodes - number of peers to be connected
neighbors - number of initial neighbors

maliciousPeers

public void maliciousPeers(int nodes,
                           int neighbors)
Adds malicious peers to the network.

Specified by:
maliciousPeers in interface NetworkSimulator
Parameters:
nodes - number of peers to be connected
neighbors - number of initial neighbors

Query Cycle Simulator HEADER