|
Query Cycle Simulator HEADER | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Object | +--qcsim.peer.impl.PeerDescriptionImpl
Provides a GUI description of a peer and its downloads.
| Field Summary | |
(package private) static int |
side
|
| Constructor Summary | |
PeerDescriptionImpl()
Constructor |
|
PeerDescriptionImpl(PeerImpl peer)
Constructor |
|
| Method Summary | |
PeerDescription |
badResponse(int i)
Get the ith bad response during the current cycle. |
void |
badResponse(PeerDescription desc)
Add the peer description to the list of bad responses. |
int |
badResponses()
The total cound of bad responses for the current cycle |
int |
behavior()
The peer behavior type. |
void |
behavior(int behavior)
|
boolean |
collectiveNeighbor(int peerID)
This method adds the peerID to its list of known peers in a malicious collective. |
java.awt.Color |
color(boolean colorTrust)
Funtion will return the color that the peer should use to paint itself. |
boolean |
contains(int x,
int y)
Does this peer's description contain the x and y coordinate. |
void |
cycle(int cycle)
Update the current cycle this description should be maintaining. |
void |
displayDescription(java.awt.Dimension dim,
double rand)
Set the dimension of the display on which to paint the peer. |
java.util.Vector |
downloadDescriptions()
Get a list of download descriptions. |
void |
draw(java.awt.Graphics g,
java.awt.Color color)
This will draw the peer with the specified color. |
void |
drawLinks(java.awt.Graphics g,
java.awt.Color color)
Will draw the links connecting this peer to its neighbor. |
int |
failedDownloads()
Get the total number of failed downloads. |
void |
failedDownloads(int num)
Update the total number of failed downloads. |
double |
globalTrust()
Yields trust value computed by this peer. |
void |
globalTrust(double trust)
Set global trust for a given cycle |
int |
goodDownloads()
Get the total number good downloads. |
void |
goodDownloads(int num)
Update the total number of good downloads. |
PeerDescription |
goodResponse()
Get the good response cooresponding to the current cycle. |
void |
goodResponse(PeerDescription desc)
Add the description of the peer that sent a good response. |
int |
goodUploads()
Get the total number of good uploads. |
void |
goodUploads(int num)
Update the total number of good uploads. |
int |
inauthenticDownloads()
Get the total number of inauthentic downloads. |
void |
inauthenticDownloads(int num)
Update the total number of inauthentic downloads. |
int |
inauthenticUploads()
Get the total number of inauthentic uploads. |
void |
inauthenticUploads(int num)
Update the total number of inauthentic uploads. |
void |
manager(QueryCycleManager manager)
The Query Cycle Manager, which is used to get the peer descriptions of other peers in the system. |
void |
notification(Notification notification)
This just signals the begining of a new cycle |
int |
peerID()
Peer id this object describes. |
java.awt.geom.Point2D |
position()
The current position on the display. |
int |
queryResponseAttempts()
Get the total number of query response attempts. |
void |
queryResponseAttempts(int num)
Update the total number of query response attempts. |
void |
readExternal(java.io.ObjectInput in)
|
java.lang.String |
toString()
String that represents the object this desription describes. |
int |
voidDownloads()
Get the total number of void downloads. |
void |
voidDownloads(int num)
Update the total number of void downloads. |
void |
writeExternal(java.io.ObjectOutput out)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
static final int side
| Constructor Detail |
public PeerDescriptionImpl(PeerImpl peer)
peer - the peer to describe.public PeerDescriptionImpl()
| Method Detail |
public void manager(QueryCycleManager manager)
manager in interface PeerDescriptionmanager - The Query Cycle Manager.public java.lang.String toString()
toString in class java.lang.Objectpublic void notification(Notification notification)
notification in interface Notifieenotification - The notification.
public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOException
public void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOException
java.lang.ClassNotFoundExceptionpublic int peerID()
peerID in interface PeerDescriptionpublic int behavior()
PeerDescription
behavior in interface PeerDescriptionpublic void behavior(int behavior)
public void displayDescription(java.awt.Dimension dim,
double rand)
displayDescription in interface PeerDescriptiondim - The display dimension.rand - used to conpute the peer's position on the display
public boolean contains(int x,
int y)
contains in interface PeerDescriptionx - the x position.y - the y position.
public java.util.Vector downloadDescriptions()
downloadDescriptions in interface PeerDescription
public void draw(java.awt.Graphics g,
java.awt.Color color)
draw in interface PeerDescriptiong - The graphics to draw on.color - The color of the peer.
public void drawLinks(java.awt.Graphics g,
java.awt.Color color)
drawLinks in interface PeerDescriptioncolor - Used to color the link.public java.awt.Color color(boolean colorTrust)
color in interface PeerDescriptioncolorTrust - If true then base color off of trust value.public java.awt.geom.Point2D position()
position in interface PeerDescriptionpublic void cycle(int cycle)
cycle in interface PeerDescriptioncycle - the new cycle.public int goodDownloads()
goodDownloads in interface PeerDescriptionpublic void goodDownloads(int num)
num - number of good downloads.public int inauthenticDownloads()
inauthenticDownloads in interface PeerDescriptionpublic void inauthenticDownloads(int num)
num - number of inauthentic downloads.public int voidDownloads()
voidDownloads in interface PeerDescriptionpublic void voidDownloads(int num)
num - number of void downloads.public int failedDownloads()
failedDownloads in interface PeerDescriptionpublic void failedDownloads(int num)
num - number of failed downloads.public int goodUploads()
goodUploads in interface PeerDescriptionpublic void goodUploads(int num)
num - number of good uploads.public int inauthenticUploads()
inauthenticUploads in interface PeerDescriptionpublic void inauthenticUploads(int num)
num - number of inauthentic uploads.public int queryResponseAttempts()
queryResponseAttempts in interface PeerDescriptionpublic void queryResponseAttempts(int num)
num - The number of query response attempts.public int badResponses()
badResponses in interface PeerDescriptionpublic void badResponse(PeerDescription desc)
desc - The description of the peer.public PeerDescription badResponse(int i)
badResponse in interface PeerDescriptioni - The index (staring from 0) of the desired description.
public void goodResponse(PeerDescription desc)
desc - The description of the peer.public PeerDescription goodResponse()
goodResponse in interface PeerDescriptionpublic boolean collectiveNeighbor(int peerID)
peerID - The id of the peer to add.public double globalTrust()
globalTrust in interface PeerDescriptionpublic void globalTrust(double trust)
trust - the global trust value
|
Query Cycle Simulator HEADER | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||