|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.klomp.snark.Piece
class Piece
This class is used solely by PeerCoordinator. Caller must synchronize on many of these methods.
Constructor Summary | |
---|---|
Piece(int id)
|
Method Summary | |
---|---|
boolean |
addPeer(Peer peer)
caller must synchronize |
void |
clear()
Clear all knowledge of peers Caller must synchronize |
int |
compareTo(Piece op)
Highest priority first, then rarest first |
boolean |
equals(Object o)
|
int |
getId()
|
int |
getPeerCount()
How many peers have this piece? Caller must synchronize |
int |
getPriority()
|
int |
getRequestCount()
How many peers are requesting this piece? Caller must synchronize |
int |
hashCode()
|
boolean |
isDisabled()
|
boolean |
isRequested()
caller must synchronize |
boolean |
isRequestedBy(Peer peer)
Is peer requesting this piece? Caller must synchronize |
boolean |
removePeer(Peer peer)
Caller must synchronize. |
void |
setDisabled()
|
void |
setPriority(int p)
|
void |
setRequested(Peer peer,
boolean requested)
Since 0.8.3, keep track of who is requesting here, to avoid deadlocks from querying each peer. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Piece(int id)
Method Detail |
---|
public int compareTo(Piece op)
compareTo
in interface Comparable<Piece>
public boolean equals(Object o)
equals
in class Object
public int hashCode()
hashCode
in class Object
public int getId()
public boolean addPeer(Peer peer)
public boolean removePeer(Peer peer)
public int getPeerCount()
public boolean isRequested()
public void setRequested(Peer peer, boolean requested)
public boolean isRequestedBy(Peer peer)
public int getRequestCount()
public void clear()
public int getPriority()
public void setPriority(int p)
public boolean isDisabled()
public void setDisabled()
public String toString()
toString
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |