|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore_lib.User
public class User
The User class encapsulates a single user/peer/node in a Network. In addition to describing behavioral properties, this class also manages bandwidth, and tracks prior interactions with other Users.
Nested Class Summary | |
---|---|
static class |
User.Behavior
The Behavior enumeration details the initialization models to which a User's behavior may conform. |
Field Summary | |
---|---|
private BWidthUnit |
dl_bwidth
Manager for download bandwidth. |
private User.Behavior |
model
The Behavior model to which this User conforms. |
private int |
num_files
The number of files owned by this User. |
private double |
pct_cleanup
The probability this User will clean up an invalid file. |
private double |
pct_honest
The probability this User will provide honest feedback. |
private boolean |
pre_trusted
Whether or not the user is pre-trusted |
private BWidthUnit |
ul_bwidth
Manager for upload bandwidth. |
private Relation[] |
vector
Array storing Relations (reputations) of other User's in Network |
Constructor Summary | |
---|---|
User(User.Behavior model,
boolean pre_trusted,
Globals GLOBALS)
Create a User, initializing some fields based on the Behavior argument. |
|
User(User.Behavior model,
double cleanup,
double honest,
boolean pre_trusted,
Globals GLOBALS)
Create a User by providing all relevant fields. |
Method Summary | |
---|---|
static int |
BehaviorToInt(User.Behavior behavior)
Retrieve the integer identifier assigned to a Behavior model. |
boolean |
BWidthAvailableDL(int cycle)
Check the availability of download bandwidth. |
boolean |
BWidthAvailableUL(int cycle)
Check the availability of upload bandwidth. |
void |
BWidthConsumeDL(int cycle)
Consume bandwidth from the download BWidthUnit. |
void |
BWidthConsumeUL(int cycle)
Consume bandwidth from the upload BWidthUnit. |
double |
getCleanup()
Access method to the cleanup field of this User. |
double |
getHonesty()
Access method to the honesty field of this User. |
User.Behavior |
getModel()
Access method to the Behavior model of this User. |
double |
getNumFiles()
Access method to the num_files field of this User. |
Relation |
getRelation(int user_num)
Access method to a global Relation between this user and another. |
void |
incFileCount()
Increase the file possession counter by one. |
static User.Behavior |
IntToBehavior(int behavior_int)
Given an integer, return the Behavior associated with that identifier. |
boolean |
isPreTrusted()
Access method to the pre_trusted field of this User |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private User.Behavior model
private boolean pre_trusted
private double pct_cleanup
private double pct_honest
private int num_files
private Relation[] vector
private BWidthUnit ul_bwidth
private BWidthUnit dl_bwidth
Constructor Detail |
---|
public User(User.Behavior model, boolean pre_trusted, Globals GLOBALS)
model
- Behavior to use for field generationpre_trusted
- Whether or not this user is pre-trustedGLOBALS
- The Network parameterization objectpublic User(User.Behavior model, double cleanup, double honest, boolean pre_trusted, Globals GLOBALS)
model
- Behavior to which this User conformscleanup
- Probability of cleaning up an invalid filehonest
- Probability of providing an honest feedbackpre_trusted
- Whether or not this user is pre-trustedGLOBALS
- The Network parameterization objectMethod Detail |
---|
public static int BehaviorToInt(User.Behavior behavior)
behavior
- The behavior model whose identifier is desired
public static User.Behavior IntToBehavior(int behavior_int)
behavior_int
- The integer identifier of the desired Behavior
public Relation getRelation(int user_num)
user_num
- Numerical identifier of other User
public User.Behavior getModel()
public boolean isPreTrusted()
public double getCleanup()
public double getHonesty()
public double getNumFiles()
public void incFileCount()
public boolean BWidthAvailableUL(int cycle)
cycle
- The cycle when this availability query is being made
public void BWidthConsumeUL(int cycle)
cycle
- The cycle when this consumption is to beginpublic boolean BWidthAvailableDL(int cycle)
cycle
- The cycle when this availability query is being made
public void BWidthConsumeDL(int cycle)
cycle
- The cycle when this consumption is to begin
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |