infofilter
Class NewsArticle

java.lang.Object
  |
  +--infofilter.NewsArticle

public class NewsArticle
extends java.lang.Object

The NewsArticle class defines all the information about a single news article or web page source.


Field Summary
protected  java.lang.String body
           
protected  int clusterId
           
protected  double clusterScore
           
protected  int[] counts
           
protected  java.lang.String id
           
protected  int keywordScore
           
protected  double predictedRating
           
protected  double rating
           
protected  double score
           
protected  java.lang.String subject
           
protected  java.lang.String userRating
           
 
Constructor Summary
(package private) NewsArticle(java.lang.String id)
          Constructs a news article object with specified ID.
 
Method Summary
 java.lang.String getBody()
          Retrieves the body of this news article.
 int getClusterId()
          Retrieves the cluster id.
 double getClusterScore()
          Retrieves the cluster score for this article.
 int getKeywordScore()
          Retrieves the keyword score for this article.
 double getPredictedRating()
          Retrieves the predicted rating for this article.
(package private)  java.lang.String getProfileString()
          Retrieves the profile data, including the raw keyword counts and the numeric user rating, as a string.
 double getRating()
          Retrieves the rating for this article.
 double getScore(int filterType)
          Retrieves the current score for the given filter type.
 java.lang.String getSubject()
          Retrieves the subject of this news article.
 java.lang.String getUserRating()
          Retrieves the user rating for this article.
(package private)  void readArticle(java.lang.String fileName)
          Reads a news article from the given file.
 void setBody(java.lang.String body)
          Sets the body of this news article to the given string.
 void setClusterId(int clusterId)
          Sets the cluster id for this article.
 void setClusterScore(double clusterScore)
          Sets the cluster score for this article.
 void setKeywordScore(int keywordScore)
          Sets the keyword score for this article.
 void setPredictedRating(double predictedRating)
          Sets the predicted rating for this article.
 void setSubject(java.lang.String subject)
          Sets the subject of this news article to the given string.
 void setUserRating(java.lang.String userRating)
          Sets the user rating and the associated rating for this article.
(package private)  void writeArticle(java.lang.String fileName)
          Writes a news article to the given file.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

id

protected java.lang.String id

subject

protected java.lang.String subject

body

protected java.lang.String body

counts

protected int[] counts

keywordScore

protected int keywordScore

predictedRating

protected double predictedRating

userRating

protected java.lang.String userRating

rating

protected double rating

score

protected double score

clusterId

protected int clusterId

clusterScore

protected double clusterScore
Constructor Detail

NewsArticle

NewsArticle(java.lang.String id)
Constructs a news article object with specified ID.
Parameters:
id - the String object that contains the identifier of the news article
Method Detail

readArticle

void readArticle(java.lang.String fileName)
Reads a news article from the given file.
Parameters:
fileName - the String object that contains the name of the file

writeArticle

void writeArticle(java.lang.String fileName)
Writes a news article to the given file.
Parameters:
fileName - the String object that contains the name of the file

getSubject

public java.lang.String getSubject()
Retrieves the subject of this news article.
Returns:
the String object that contains the subject of the article

setSubject

public void setSubject(java.lang.String subject)
Sets the subject of this news article to the given string.
Parameters:
subject - the String object that contains the new subject

getBody

public java.lang.String getBody()
Retrieves the body of this news article.
Returns:
the String object that contains the body of the article

setBody

public void setBody(java.lang.String body)
Sets the body of this news article to the given string.
Parameters:
body - the String object that contains the new body

getKeywordScore

public int getKeywordScore()
Retrieves the keyword score for this article.
Returns:
the double value for the keyword score

setKeywordScore

public void setKeywordScore(int keywordScore)
Sets the keyword score for this article.
Returns:
the double value for the keyword score

getScore

public double getScore(int filterType)
Retrieves the current score for the given filter type.
Parameters:
filterType - the integer that represents the filter type
Returns:
the double value for the score

getUserRating

public java.lang.String getUserRating()
Retrieves the user rating for this article.
Returns:
the String object that contains the user rating

getRating

public double getRating()
Retrieves the rating for this article.
Returns:
the double value for the rating

setClusterScore

public void setClusterScore(double clusterScore)
Sets the cluster score for this article.
Parameters:
clusterScore - the double value for the score

getClusterScore

public double getClusterScore()
Retrieves the cluster score for this article.
Returns:
the double value for the score

setClusterId

public void setClusterId(int clusterId)
Sets the cluster id for this article.
Parameters:
clusterId - the integer value for the cluster id

getClusterId

public int getClusterId()
Retrieves the cluster id.
Returns:
the integer value for the cluster id

getPredictedRating

public double getPredictedRating()
Retrieves the predicted rating for this article.
Returns:
the double value that is the predicted rating

setPredictedRating

public void setPredictedRating(double predictedRating)
Sets the predicted rating for this article.
Parameters:
the - double value that is the predicted rating

setUserRating

public void setUserRating(java.lang.String userRating)
Sets the user rating and the associated rating for this article.
Parameters:
userRating - the String object that contains the user rating

getProfileString

java.lang.String getProfileString()
Retrieves the profile data, including the raw keyword counts and the numeric user rating, as a string.
Returns:
the String object that contains the profile data