Query Cycle Simulator HEADER

qcsim.peer
Interface PeerDescription

All Known Implementing Classes:
PeerDescriptionImpl

public interface PeerDescription

Provides a GUI description of a peer and its downloads.

Version:
1.0
Author:
unascribed

Method Summary
 PeerDescription badResponse(int i)
          The ith peer who sent an inauthentic file during the cycle
 int badResponses()
          The number of bad responses up to and including the cycle.
 int behavior()
          The peer behavior type.
 java.awt.Color color(boolean trust)
          Funtion will return the color that the peer should use to paint itself.
 boolean contains(int x, int y)
          Will specify if this peer is contains the given coordinates.
 void cycle(int cycle)
          Used to inform the Peer's history of a new cycle This signal the history object to start tracking a new cycle.
 void displayDescription(java.awt.Dimension dim, double pos)
          This method will set display information needed by the peer's description object.
 java.util.Vector downloadDescriptions()
          Get a descriptions of the peers downloads.
 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)
          This will draw the links that connect this peer to others.
 int failedDownloads()
          The number of failed downloads up to and including the cycle.
 double globalTrust()
          Yields trust value computed by this peer.
 int goodDownloads()
          The number of good downloads up to and including the cycle.
 PeerDescription goodResponse()
          The peer who sent a good file during the cycle.
 int goodUploads()
          The number of good uploads up to and including the cycle.
 int inauthenticDownloads()
          The number of inauthentic downloads up to and including the cycle.
 int inauthenticUploads()
          The number of inauthentic uploads up to and including the cycle.
 void manager(QueryCycleManager manager)
          The Query Cycle Manager, which is used to get the peer descriptions of other peers in the system.
 int peerID()
          The id of the peer this description describes.
 java.awt.geom.Point2D position()
          The current position of the peer description on the display.
 int queryResponseAttempts()
          Get number of query response attempts.
 int voidDownloads()
          The number of void downloads up to and including the cycle.
 

Method Detail

displayDescription

public void displayDescription(java.awt.Dimension dim,
                               double pos)
This method will set display information needed by the peer's description object.

Parameters:
dim - describes the display dimension.
pos - used to conpute the peer's position on the display

manager

public void manager(QueryCycleManager manager)
The Query Cycle Manager, which is used to get the peer descriptions of other peers in the system.

Parameters:
manager - The Query Cycle Manager.

draw

public void draw(java.awt.Graphics g,
                 java.awt.Color color)
This will draw the peer with the specified color. Use the method color to get a color based on the peers behavior or current trust value.

Parameters:
g - The graphics to draw on.
color - The color of the peer.

downloadDescriptions

public java.util.Vector downloadDescriptions()
Get a descriptions of the peers downloads.

Returns:
A vector of download descriptions.

drawLinks

public void drawLinks(java.awt.Graphics g,
                      java.awt.Color color)
This will draw the links that connect this peer to others.

Parameters:
color - The color of the links.

color

public java.awt.Color color(boolean trust)
Funtion will return the color that the peer should use to paint itself.

Parameters:
trust - If true then base color off of trust value.

contains

public boolean contains(int x,
                        int y)
Will specify if this peer is contains the given coordinates.

Parameters:
x - the x position.
y - the y position.
Returns:
true if peer description contains the coordinates.

position

public java.awt.geom.Point2D position()
The current position of the peer description on the display.

Returns:
the center point of the peer's position.

peerID

public int peerID()
The id of the peer this description describes.

Returns:
The peer's id this object describes.

behavior

public int behavior()
The peer behavior type.

Returns:
the type of behavior this peer assumes.

cycle

public void cycle(int cycle)
Used to inform the Peer's history of a new cycle This signal the history object to start tracking a new cycle. This should only be called on a new cycle.

Parameters:
cycle - the new cycle.

goodDownloads

public int goodDownloads()
The number of good downloads up to and including the cycle.


inauthenticDownloads

public int inauthenticDownloads()
The number of inauthentic downloads up to and including the cycle.


voidDownloads

public int voidDownloads()
The number of void downloads up to and including the cycle.


failedDownloads

public int failedDownloads()
The number of failed downloads up to and including the cycle.


goodUploads

public int goodUploads()
The number of good uploads up to and including the cycle.


inauthenticUploads

public int inauthenticUploads()
The number of inauthentic uploads up to and including the cycle.


queryResponseAttempts

public int queryResponseAttempts()
Get number of query response attempts.

Returns:
number query response attempts.

badResponses

public int badResponses()
The number of bad responses up to and including the cycle.


badResponse

public PeerDescription badResponse(int i)
The ith peer who sent an inauthentic file during the cycle

Parameters:
i - the ith peer.

goodResponse

public PeerDescription goodResponse()
The peer who sent a good file during the cycle.


globalTrust

public double globalTrust()
Yields trust value computed by this peer.

Returns:
trust trust value at peer

Query Cycle Simulator HEADER