|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgps.protocol.Agent
gps.protocol.Peer
gps.protocol.BT.BTPeer
public class BTPeer
BT Peer
| Field Summary | |
|---|---|
static int |
MAX_ALLOWED_CONNECTION_NUM
maximum allowed connection number on this peer |
static int |
MAX_ALLOWED_SESSION_NUM
maximum allowed session number on this peer |
static double |
MAX_OUT_BANDWIDTH_PER_NODE
maximum out bandwidth, not used now |
BTAlgorithmPeerSelectionAtPeer |
mPeerSelection
peer selection algorithm |
| Fields inherited from class gps.protocol.Peer |
|---|
mDocDBbyKey |
| Constructor Summary | |
|---|---|
BTPeer(int i)
constructs a new BTPeer with id provided |
|
| Method Summary | |
|---|---|
void |
agentDraw(java.awt.Graphics g,
int x,
int y)
do some BTPeer specific drawing on the graph |
BTDocument |
getBTDocument(java.lang.String key)
retrieves a document by key |
BTSession |
getSession(java.lang.String key)
gets session for a specific document |
java.util.LinkedHashMap |
getSessions()
gets all sessions on this peer |
boolean |
handle(SimEvent e)
handles peer level events |
void |
handleDownload(BTEvent e)
handles events for downloading a specific ducument from a specified tracker at a specific time. |
void |
handleHandShaking(BTEvent e)
handleHandShaking makes sure each side a session. |
void |
handlePeerMessage(BTEvent e)
handles HAND_SHAKING, all other peer messages are not supposed to be sent to BTPeer. |
void |
handlePublish(BTEvent e)
handles events for publishing a specific ducument to a specified tracker at a specific time. |
void |
handleRandomDownload(BTEvent e)
handles events for downloading a random ducument from a specified tracker at a specific time. |
void |
publish(java.lang.String docHashkey,
BTTracker tracker)
publishing the document to tracker |
BTSession |
removeSession(java.lang.String key)
removes session for a specific document |
void |
reset()
reset internal values |
java.lang.String |
toString()
gets string description |
| Methods inherited from class gps.protocol.Peer |
|---|
getDocument, ownDocument |
| Methods inherited from class gps.protocol.Agent |
|---|
attachTo, getID, getNode, isActive |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_ALLOWED_SESSION_NUM
public static final int MAX_ALLOWED_CONNECTION_NUM
public static final double MAX_OUT_BANDWIDTH_PER_NODE
public BTAlgorithmPeerSelectionAtPeer mPeerSelection
| Constructor Detail |
|---|
public BTPeer(int i)
i - BTPeer id| Method Detail |
|---|
public void reset()
reset in class Peer
public void agentDraw(java.awt.Graphics g,
int x,
int y)
agentDraw in class Agentg - Graphics objectx - x positiony - y positionpublic java.util.LinkedHashMap getSessions()
public BTSession getSession(java.lang.String key)
key - document hash key
public BTSession removeSession(java.lang.String key)
key - document hash key
public BTDocument getBTDocument(java.lang.String key)
key - document hash key
public boolean handle(SimEvent e)
handle in interface SimEventHandlerhandle in class Agente - the event to be handled
public void handlePublish(BTEvent e)
e - the event objectpublic void handleDownload(BTEvent e)
e - the event objectpublic void handleRandomDownload(BTEvent e)
e - the event objectpublic void handlePeerMessage(BTEvent e)
e - is the event objectpublic void handleHandShaking(BTEvent e)
e - is the event object
public void publish(java.lang.String docHashkey,
BTTracker tracker)
docHashkey - the hashkey of the documenttracker - the tracker instancepublic java.lang.String toString()
toString in class Peer
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||