A {@link DataModel} backed by a comma-delimited file. This class typically expects a file where each linecontains a user ID, followed by item ID, followed by preferences value, separated by commas. You may also use tabs.
The preference value is assumed to be parseable as a double
. The user IDs and item IDs are read parsed as long
s.
This class will reload data from the data file when {@link #refresh(Collection)} is called, unless the filehas been reloaded very recently already.
This class will also look for update "delta" files in the same directory, with file names that start the same way (up to the first period). These files should have the same format, and provide updated data that supersedes what is in the main data file. This is a mechanism that allows an application to push updates to without re-copying the entire data file.
The line may contain a blank preference value (e.g. "123,456,"). This is interpreted to mean "delete preference", and is only useful in the context of an update delta file (see above). Note that if the line is empty or begins with '#' it will be ignored as a comment.
It is also acceptable for the lines to contain additional fields. Fields beyond the third will be ignored.
Finally, for application that have no notion of a preference value (that is, the user simply expresses a preference for an item, but no degree of preference), the caller can simply omit the third token in each line altogether -- for example, "123,456".
Note that it's all-or-nothing -- all of the items in the file must express no preference, or the all must. These cannot be mixed. Put another way there will always be the same number of delimiters on every line of the file!
This class is not intended for use with very large amounts of data (over, say, tens of millions of rows). For that, a JDBC-backed {@link DataModel} and a database are more appropriate.
It is possible and likely useful to subclass this class and customize its behavior to accommodate application-specific needs and input formats. See {@link #processLine(String,FastByIDMap,boolean)} and{@link #processLineWithoutID(String,FastByIDMap)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|