|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectjBittorrentAPI.Peer
public class Peer
Class representing a bittorrent peer
Field Summary | |
---|---|
private boolean |
choked
|
private boolean |
choking
|
private float |
dlrate
|
private int |
downloaded
|
private java.util.BitSet |
hasPiece
|
private java.lang.String |
id
|
private boolean |
interested
|
private boolean |
interesting
|
private java.lang.String |
ip
|
private long |
lastDL
|
private long |
lastUL
|
private int |
port
|
private float |
ulrate
|
private int |
uploaded
|
Constructor Summary | |
---|---|
Peer()
|
|
Peer(java.lang.String id,
java.lang.String ip,
int port)
|
Method Summary | |
---|---|
boolean |
equals(Peer p)
Compares if this peer is equal to the peer in parameter |
int |
getDL()
Returns the total number of bytes downloaded from this peer |
float |
getDLRate(boolean reset)
Returns the number of bytes downloaded since the last reset |
java.util.BitSet |
getHasPiece()
Returns the pieces availability of this peer |
java.lang.String |
getID()
Returns the id of this peer |
java.lang.String |
getIP()
Returns the IP address of this peer |
int |
getPort()
Returns the listening port of this peer |
int |
getUL()
Returns the total number of bytes uploaded to this peer |
float |
getULRate(boolean reset)
Returns the number of bytes uploaded since the last reset. |
boolean |
isChoked()
Returns if this peer is choked or not |
boolean |
isChoking()
Returns if this peer is choking or not |
boolean |
isInterested()
Returns if this peer is interested or not |
boolean |
isInteresting()
Returns if this peer is interesting or not |
void |
resetDL()
|
void |
resetUL()
|
void |
setChoked(boolean c)
Sets if this peer is choked or not |
void |
setChoking(boolean c)
Sets if this peer is choking or not |
void |
setDLRate(int dl)
Updates the downloaded values |
void |
setHasPiece(byte[] bitfield)
Updates this peer availability according to the received bitfield |
void |
setHasPiece(int piece,
boolean has)
Updates the availability of the piece in parameter |
void |
setID(java.lang.String id)
Sets the id of this peer |
void |
setInterested(boolean i)
Sets if this peer is intereseted or not |
void |
setInteresting(boolean i)
Sets if this peer is interesting or not |
void |
setIP(java.lang.String ip)
Sets the IP address of this peer |
void |
setPort(int port)
Sets the listening port of this peer |
void |
setULRate(int ul)
Updates the uploaded values |
java.lang.String |
toString()
Returns this peer characteristics in the form |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private boolean choked
private boolean choking
private float dlrate
private int downloaded
private java.util.BitSet hasPiece
private java.lang.String id
private boolean interested
private boolean interesting
private java.lang.String ip
private long lastDL
private long lastUL
private int port
private float ulrate
private int uploaded
Constructor Detail |
---|
public Peer()
public Peer(java.lang.String id, java.lang.String ip, int port)
Method Detail |
---|
public boolean equals(Peer p)
p
- Peer
public int getDL()
public float getDLRate(boolean reset)
reset
- true if the download rate should be reset
public java.util.BitSet getHasPiece()
public java.lang.String getID()
public java.lang.String getIP()
public int getPort()
public int getUL()
public float getULRate(boolean reset)
reset
- true if the download rate should be reset
public boolean isChoked()
public boolean isChoking()
public boolean isInterested()
public boolean isInteresting()
public void resetDL()
public void resetUL()
public void setChoked(boolean c)
c
- booleanpublic void setChoking(boolean c)
c
- booleanpublic void setDLRate(int dl)
dl
- intpublic void setHasPiece(byte[] bitfield)
bitfield
- byte[]public void setHasPiece(int piece, boolean has)
piece
- inthas
- booleanpublic void setID(java.lang.String id)
id
- Stringpublic void setInterested(boolean i)
i
- booleanpublic void setInteresting(boolean i)
i
- booleanpublic void setIP(java.lang.String ip)
ip
- Stringpublic void setPort(int port)
port
- intpublic void setULRate(int ul)
ul
- intpublic java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |