org.mymedialite.io
Class RatingData

java.lang.Object
  extended by org.mymedialite.io.RatingData

public class RatingData
extends java.lang.Object

Class that offers methods for reading in rating data


Constructor Summary
RatingData()
           
 
Method Summary
static IRatings read(java.io.BufferedReader reader, IEntityMapping userMapping, IEntityMapping itemMapping, boolean ignoreFirstLine)
          Read in rating data from a BufferedReader Each line must consist of at least three fields, the first being a user identifier, the second being an item identifier and the third being a rating value.
static IRatings read(java.lang.String filename, IEntityMapping userMapping, IEntityMapping itemMapping, boolean ignoreFirstLine)
          Read in rating data from a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RatingData

public RatingData()
Method Detail

read

public static IRatings read(java.lang.String filename,
                            IEntityMapping userMapping,
                            IEntityMapping itemMapping,
                            boolean ignoreFirstLine)
                     throws java.io.IOException,
                            java.lang.NumberFormatException
Read in rating data from a file. Each line must consist of at least three fields, the first being a user identifier, the second being an item identifier and the third being a rating value. Additional fields and empty lines are ignored. See Constants.SPLIT_CHARS for details of the permissible field separators.

Parameters:
filename - the name of the file to read from
userMapping - mapping object for user IDs
itemMapping - mapping object for item IDs
ignoreFirstLine - if true, ignore the first line
Returns:
the rating data
Throws:
java.io.IOException
java.lang.NumberFormatException

read

public static IRatings read(java.io.BufferedReader reader,
                            IEntityMapping userMapping,
                            IEntityMapping itemMapping,
                            boolean ignoreFirstLine)
                     throws java.io.IOException,
                            java.lang.NumberFormatException
Read in rating data from a BufferedReader Each line must consist of at least three fields, the first being a user identifier, the second being an item identifier and the third being a rating value. Additional fields and empty lines are ignored. See Constants.SPLIT_CHARS for details of the permissible field separators.

Parameters:
reader - the BufferedReader to read from
userMapping - mapping object for user IDs
itemMapping - mapping object for item IDs
ignoreFirstLine - if true, ignore the first line
Returns:
the rating data
Throws:
java.io.IOException
java.lang.NumberFormatException