CFEngine API

org.recommender.clients.console
Class ClientCFManager

java.lang.Object
  |
  +--org.recommender.clients.console.ClientCFManager

public class ClientCFManager
extends java.lang.Object

A wrapper class for the CFEngine interface. The console client makes requests to this class, which then passes the requests on to the client. All references to the CFEngine are isolated in this class.

Author:
Jon Herlocker
See Also:
CFEngine

Method Summary
 void addRating(User user, Item item, int rating)
          Wrapper for CFEngine.setRating()
 int addRatingList(Rating[] ratings)
          Wrapper for CFEngine.setRatingList
 float getErrRating()
          Query the server to determine the rating value that is returned to indicate that the system has no rating for an item or cannot produce a prediction for an item .
static ClientCFManager getInstance(java.lang.String serverHostName)
           
 User[] getItemRatingList(Item item)
          Wrapper for CFEngine.getItemRatingList
 float getMaxRating()
          Query the server to determine the maximum rating value supported for the current data.
 float getMinRating()
          Query the server to determine the minimum rating value supported for the current data.
 Prediction getPredictedRating(User user, Item item)
          Wrapper for CFEngine.getPredictedRating
 Prediction[] getPredictedRatings(User user, Item[] itemArray)
          Wrapper for CFEngine.getPredictedRatings()
 Rating getRating(User user, Item item)
          Wrapper for CFEngine.getRating()
 Prediction[] getRecommendations(User user, int number, int offset)
          Wrapper for CFEngine.getRecommendations
(package private)  Prediction[] getRecommendationsByType(User user, Type type, int number, int offset)
          Wrapper for CFEngine.getRecommendationsByType
 Rating[] getUserRatingList(User user)
          Wrapper for CFEngine.getUserRatingList()
 void removeRating(User user, Item item)
          Removes a single rating from the CFEngine.
 int removeRatingList(User user, Item[] items)
          Wrapper for CFEngine.removeRatingList
 void setServer(CFEngine engine)
          Setter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static ClientCFManager getInstance(java.lang.String serverHostName)
Returns:
A singleton ClientCFManager instance

setServer

public void setServer(CFEngine engine)
Setter.

Parameters:
engine - The CFEngine interface used to communicate with the server

getItemRatingList

public User[] getItemRatingList(Item item)
Wrapper for CFEngine.getItemRatingList

Parameters:
item -
Returns:
An array of User objects
See Also:
CFEngine

getUserRatingList

public Rating[] getUserRatingList(User user)
Wrapper for CFEngine.getUserRatingList()

Parameters:
user -
Returns:
An array of Item objects
See Also:
CFEngine

getRating

public Rating getRating(User user,
                        Item item)
Wrapper for CFEngine.getRating()

Parameters:
user -
item -
Returns:
A Rating object
See Also:
CFEngine

addRating

public void addRating(User user,
                      Item item,
                      int rating)
Wrapper for CFEngine.setRating()

Parameters:
user -
item -
rating -
See Also:
CFEngine

addRatingList

public int addRatingList(Rating[] ratings)
Wrapper for CFEngine.setRatingList

Parameters:
ratings -
Returns:
the number of rating added
See Also:
CFEngine

removeRating

public void removeRating(User user,
                         Item item)
Removes a single rating from the CFEngine.

Parameters:
user -
item -

removeRatingList

public int removeRatingList(User user,
                            Item[] items)
Wrapper for CFEngine.removeRatingList

Parameters:
user -
items - - An array of items for which ratings are to be removed
Returns:
the number of rating added
See Also:
CFEngine

getPredictedRating

public Prediction getPredictedRating(User user,
                                     Item item)
Wrapper for CFEngine.getPredictedRating

Parameters:
user -
item -
Returns:
A single Prediction object
See Also:
CFEngine

getPredictedRatings

public Prediction[] getPredictedRatings(User user,
                                        Item[] itemArray)
Wrapper for CFEngine.getPredictedRatings()

Parameters:
user -
itemArray -
Returns:
An array of Prediction objects
See Also:
CFEngine

getRecommendations

public Prediction[] getRecommendations(User user,
                                       int number,
                                       int offset)
Wrapper for CFEngine.getRecommendations

Parameters:
user -
number -
offset -
Returns:
An array of Prediction objects
See Also:
CFEngine

getRecommendationsByType

Prediction[] getRecommendationsByType(User user,
                                      Type type,
                                      int number,
                                      int offset)
Wrapper for CFEngine.getRecommendationsByType

Parameters:
user -
type -
number -
offset -
Returns:
An array of Prediction objects

getMinRating

public float getMinRating()
Query the server to determine the minimum rating value supported for the current data.

Returns:
return minimum rating value from the user

getMaxRating

public float getMaxRating()
Query the server to determine the maximum rating value supported for the current data.

Returns:
return maximum rating value from the user

getErrRating

public float getErrRating()
Query the server to determine the rating value that is returned to indicate that the system has no rating for an item or cannot produce a prediction for an item .

Returns:
return the default value indicating no rating or no prediction

CFEngine API

Copyright © 2003 - Oregon State University www.orst.edu