Query Cycle Simulator HEADER

qcsim.peer.impl
Class PeerManagerImpl

java.lang.Object
  |
  +--qcsim.peer.impl.PeerManagerImpl
All Implemented Interfaces:
PeerManager

public class PeerManagerImpl
extends java.lang.Object
implements PeerManager

Creates and manage all peers in a simulation.

Version:
1.0
Author:
unascribed

Field Summary
 
Fields inherited from interface qcsim.peer.PeerManager
MC_CHAIN, MC_CLIQUE, MC_RANDOM
 
Constructor Summary
PeerManagerImpl(Simulator simulator)
          Constructor
 
Method Summary
 void collective(java.util.Vector peers, int ctype, int type)
          Create a collective.
 void contentManager(PeerContentManager manager)
          Set the peer content manager
 void deletePeer(int peerID)
          Removes peer from the system.
 int goodPeers()
          Get the number of good peers in the system.
 int highlyTrustedPeers()
          Get the number of highly trusted peers in the system.
 int maliciousPeers()
          Get the number of malicious peers in the system.
 Peer newPeer(NetworkSimulator network, int behavior)
          Create a new peer
 Peer peer(int peerID)
          Get peer
 int peers()
          Number of peers in the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PeerManagerImpl

public PeerManagerImpl(Simulator simulator)
Constructor

Parameters:
simulator - Needed to obtain various simulation attributes.
Method Detail

peers

public int peers()
Number of peers in the system.

Specified by:
peers in interface PeerManager
Returns:
number of peers.

peer

public Peer peer(int peerID)
Get peer

Specified by:
peer in interface PeerManager
Parameters:
peerID - the peer id.
Returns:
the peer.

newPeer

public Peer newPeer(NetworkSimulator network,
                    int behavior)
Create a new peer

Specified by:
newPeer in interface PeerManager
Parameters:
behavior - the peer's behavior/type
Returns:
the peer.

deletePeer

public void deletePeer(int peerID)
Removes peer from the system.

Specified by:
deletePeer in interface PeerManager
Parameters:
peerID - the peer id.

highlyTrustedPeers

public int highlyTrustedPeers()
Get the number of highly trusted peers in the system.

Specified by:
highlyTrustedPeers in interface PeerManager
Returns:
number of highly trusted peers.

maliciousPeers

public int maliciousPeers()
Get the number of malicious peers in the system.

Specified by:
maliciousPeers in interface PeerManager
Returns:
number of malicious peers.

goodPeers

public int goodPeers()
Get the number of good peers in the system.

Specified by:
goodPeers in interface PeerManager
Returns:
number of good peers.

contentManager

public void contentManager(PeerContentManager manager)
Description copied from interface: PeerManager
Set the peer content manager

Specified by:
contentManager in interface PeerManager
Parameters:
manager - the peer content manager.

collective

public void collective(java.util.Vector peers,
                       int ctype,
                       int type)
Create a collective.

Specified by:
collective in interface PeerManager
Parameters:
peers - Vector of peerIDs who will be in the collective
ctype - The type of collective to create.
type - The type of trust value configuration.

Query Cycle Simulator HEADER