Query Cycle Simulator HEADER

qcsim.content.impl
Class ContentImpl

java.lang.Object
  |
  +--qcsim.content.impl.ContentImpl
All Implemented Interfaces:
java.lang.Cloneable, Content

public class ContentImpl
extends java.lang.Object
implements Content, java.lang.Cloneable

This object represents a given content category. It contains a files associated with the content category and is given to a peer as part of its shared data.

Version:
1.0
Author:
unascribed

Field Summary
 
Fields inherited from interface qcsim.content.Content
BAD_FILE, GOOD_FILE
 
Constructor Summary
ContentImpl(int category)
          Create a new content category
 
Method Summary
 boolean addFile(int rank)
          Add the file rank to this content category
 int category()
          The content category id.
 java.lang.Object clone()
          Create a copy of the current object
 boolean containsFile(int rank)
          Search for the file rank in this content category
 boolean equals(java.lang.Object obj)
          Does this content category equal the object.
 int files()
          The number of files.
 double interest()
          The peers interest level in this content category.
 void interest(double interest)
          Set the peers interest level in this content category.
 void printContent()
          Print the files contained in this content category.
 int volume()
          The total volume of data (number of files) in this content category.
 void volume(int volume)
          Set the total volume of data (number of files) in this content category
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentImpl

public ContentImpl(int category)
Create a new content category

Parameters:
category - identifies the content category
Method Detail

equals

public boolean equals(java.lang.Object obj)
Does this content category equal the object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object/content category.

clone

public java.lang.Object clone()
Create a copy of the current object

Overrides:
clone in class java.lang.Object

printContent

public void printContent()
Print the files contained in this content category.


category

public int category()
The content category id.

Specified by:
category in interface Content
Returns:
category id.

interest

public double interest()
The peers interest level in this content category.

Specified by:
interest in interface Content

interest

public void interest(double interest)
Set the peers interest level in this content category.

Specified by:
interest in interface Content

volume

public int volume()
The total volume of data (number of files) in this content category.

Specified by:
volume in interface Content

volume

public void volume(int volume)
Set the total volume of data (number of files) in this content category

Specified by:
volume in interface Content

files

public int files()
The number of files.

Specified by:
files in interface Content
Returns:
The number of files.

containsFile

public boolean containsFile(int rank)
Search for the file rank in this content category

Specified by:
containsFile in interface Content
Parameters:
rank - the file to search.
Returns:
whether the content contains the file.

addFile

public boolean addFile(int rank)
Add the file rank to this content category

Specified by:
addFile in interface Content
Parameters:
rank - file to add.
Returns:
true if file was successfully added.

Query Cycle Simulator HEADER