|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcore_lib.Network
public class Network
The Network class is a high-level object managing data and behaviors specific to users, files, and bandwidth
Field Summary | |
---|---|
private java.util.Queue<Transaction> |
delay_queue
Queue storing transactions in progress, yet to commit data. |
private java.util.LinkedList<FileCopy>[] |
files
Array acting as a file library for the Network. |
Globals |
GLOBALS
Parameterization of this Network. |
Statistics |
STATS
Statistics pertaining to happenings on this Network. |
private User[] |
users
Array containing Users in the Network; a User library. |
Constructor Summary | |
---|---|
Network(Globals GLOBALS)
Construct a Network object. |
Method Summary | |
---|---|
void |
addFile(int user_num,
int file_num,
boolean valid)
Add a file/owner/validity entry to the libraries. |
int |
availableFiles()
Determine the number of files available in this Network. |
Transaction |
dequeueTrans()
Dequeue transaction at the head of the delay queue. |
void |
enqueueTrans(Transaction trans)
Enqueue a transaction onto tail of the delay queue. |
boolean |
fileCopyValid(int file_num,
int user_num)
Seek the validity of a FileCopy in the file library. |
int |
fileOwners(int file_num)
The number of owners (e.g. |
java.util.Iterator<FileCopy> |
getFileIterator(int file_num)
Fetch an iterator over all copies of a particular file. |
User |
getUser(int user_num)
Access method to a User in the User library. |
Relation |
getUserRelation(int source,
int dest)
Access method to a Relation object between two library Users. |
boolean |
hasFile(int user_num,
int file_num)
Determine if a user possesses a certain file. |
Transaction |
peekQueue()
Return, but not remove transaction on head of delay queue. |
int |
queueSize()
The number of transactions currently in the delay queue. |
void |
setUser(int user_num,
User user)
Modifier to place a User into the User library. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public Globals GLOBALS
public Statistics STATS
private User[] users
private java.util.LinkedList<FileCopy>[] files
private java.util.Queue<Transaction> delay_queue
Constructor Detail |
---|
public Network(Globals GLOBALS)
GLOBALS
- The Network parameterization objectMethod Detail |
---|
public User getUser(int user_num)
user_num
- Numerical identifier of the User to return
public void setUser(int user_num, User user)
user_num
- Numerical identifier of parameter 'user'user
- The User object to be placed into the User librarypublic Relation getUserRelation(int source, int dest)
source
- Numerical identifier of a Userdest
- Numerical identifier of a second User
public java.util.Iterator<FileCopy> getFileIterator(int file_num)
file_num
- Numerical file identifier
public int fileOwners(int file_num)
file_num
- Numerical file identifier
public boolean fileCopyValid(int file_num, int user_num)
file_num
- Numerical file identifieruser_num
- Numerical user identifier
public boolean hasFile(int user_num, int file_num)
user_num
- Numerical user identifierfile_num
- Numerical file identifier
public int availableFiles()
public void addFile(int user_num, int file_num, boolean valid)
user_num
- Numerical user identifier of file ownerfile_num
- Numerical file identifier of file to be addedvalid
- Validity of the file being addedpublic void enqueueTrans(Transaction trans)
trans
- The transaction to be enqueuedpublic Transaction dequeueTrans()
public Transaction peekQueue()
public int queueSize()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |