Query Cycle Simulator HEADER

qcsim.peer
Interface Peer

All Known Implementing Classes:
PeerImpl

public interface Peer

This interface outlines the methods a Peer implementation is expected to have.

Version:
1.0
Author:
unascribed

Method Summary
 boolean addNeighbor(Peer peer)
          Add neighbor peer.
 PeerBehavior behavior()
          Get peer's behavior.
 PeerContent content()
          get peer's content.
 PeerDescription description()
          Get a description of the peer.
 PeerManager manager()
          The peer's manager
 void message(PeerMessage msg)
          Enqueue a message destined for this peer.
 Peer neighbor(int i)
          The ith neighbor of this peer
 int neighbors()
          The number of peers connected to this peers.
 int peerID()
          Get peer ID
 void removeNeighbor(Peer peer)
          Remove neighbor peer.
 double rpc(PeerRPC rpc)
          Remote procedure call interface
 

Method Detail

manager

public PeerManager manager()
The peer's manager

Returns:
the peer manager.

content

public PeerContent content()
get peer's content.

Returns:
the peer's content

behavior

public PeerBehavior behavior()
Get peer's behavior.

Returns:
the peer's behavior object.

description

public PeerDescription description()
Get a description of the peer.

Returns:
peer description object.

message

public void message(PeerMessage msg)
Enqueue a message destined for this peer.

Parameters:
msg - message received

peerID

public int peerID()
Get peer ID

Returns:
peer id.

neighbors

public int neighbors()
The number of peers connected to this peers.

Returns:
The number of neighbors.

neighbor

public Peer neighbor(int i)
The ith neighbor of this peer

Returns:
neighoring peer.

addNeighbor

public boolean addNeighbor(Peer peer)
Add neighbor peer.

Parameters:
peer - neighbor peer to be added
Returns:
true if peer was added, otherwise false.

removeNeighbor

public void removeNeighbor(Peer peer)
Remove neighbor peer.

Parameters:
peer - neighbor peer to be removed

rpc

public double rpc(PeerRPC rpc)
Remote procedure call interface

Returns:
rpc return value.

Query Cycle Simulator HEADER