@Shareable public class SharedPreferenceSnapshot extends Object implements PreferenceSnapshot, Serializable
Constructor and Description |
---|
SharedPreferenceSnapshot(PreferenceSnapshot snapshot) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the build context.
|
LongCollection |
getItemIds()
Get the set of item IDs in the snapshot.
|
FastCollection<IndexedPreference> |
getRatings()
Get the collection of ratings in the snapshot.
|
LongCollection |
getUserIds()
Get the set of user IDs in the snapshot.
|
FastCollection<IndexedPreference> |
getUserRatings(long userId)
Get the ratings for a particular user.
|
Index |
itemIndex()
Get the item ID index.
|
static Supplier<SharedPreferenceSnapshot> |
supplier(TTDataSet data)
Construct a supplier of a snapshot of the training data from a data set.
|
Index |
userIndex()
Get the user ID index.
|
SparseVector |
userRatingVector(long userId)
Get the current preferences of a particular user in SparseVector form.
|
public SharedPreferenceSnapshot(PreferenceSnapshot snapshot)
public LongCollection getUserIds()
PreferenceSnapshot
getUserIds
in interface PreferenceSnapshot
public LongCollection getItemIds()
PreferenceSnapshot
getItemIds
in interface PreferenceSnapshot
public Index userIndex()
PreferenceSnapshot
userIndex
in interface PreferenceSnapshot
public Index itemIndex()
PreferenceSnapshot
itemIndex
in interface PreferenceSnapshot
public FastCollection<IndexedPreference> getRatings()
PreferenceSnapshot
Modifying the returned indexed preferences will not modify the underlying snapshot.
getRatings
in interface PreferenceSnapshot
public FastCollection<IndexedPreference> getUserRatings(long userId)
PreferenceSnapshot
Modifying the returned indexed preferences will not modify the underlying snapshot.
getUserRatings
in interface PreferenceSnapshot
userId
- The user's ID.public void close()
PreferenceSnapshot
Closeable.close()
to drop
the exception that can be thrown.
After the build context has been closed, all methods are allowed to fail. Objects returned from those methods, however, should continue to be valid.
close
in interface Closeable
close
in interface AutoCloseable
close
in interface PreferenceSnapshot
public SparseVector userRatingVector(long userId)
PreferenceSnapshot
userRatingVector
in interface PreferenceSnapshot
userId
- The user's ID.public static Supplier<SharedPreferenceSnapshot> supplier(TTDataSet data)
data
- The data set.Copyright © 2013 GroupLens Research. All Rights Reserved.