@ThreadSafe @DefaultProvider(value=BinaryRatingDAO.Loader.class) public class BinaryRatingDAO extends Object implements EventDAO, UserEventDAO, ItemEventDAO, UserDAO, ItemDAO, Serializable, Describable
To create a file compatible with this DAO, use the BinaryRatingPacker class or the
pack command in the LensKit command line tool.
Currently, serializing a binary rating DAO puts all the rating data into the serialized output
stream. When deserialized, the data be written back to a direct buffer (allocated with
ByteBuffer.allocateDirect(int)). When deserializing this DAO, make sure your
system has enough virtual memory (beyond what is allowed for Java) to contain the entire data set.
| Modifier and Type | Class and Description |
|---|---|
static class |
BinaryRatingDAO.Loader |
| Modifier and Type | Method and Description |
|---|---|
void |
describeTo(DescriptionWriter writer)
Write this class's description to a sink.
|
List<Event> |
getEventsForItem(long item)
Get the events for a specific item.
|
<E extends Event> |
getEventsForItem(long item,
Class<E> type)
Get the events for a specific item, filtering by type.
|
UserHistory<Event> |
getEventsForUser(long user)
Get the events for a specific user.
|
<E extends Event> |
getEventsForUser(long user,
Class<E> type)
Get the events for a specific user, filtering by type.
|
LongSet |
getItemIds()
Get all known item IDs.
|
LongSet |
getUserIds()
Get all known user IDs.
|
LongSet |
getUsersForItem(long item)
Get the users who have interacted with an item.
|
static BinaryRatingDAO |
open(File file)
Open a binary rating DAO.
|
Cursor<Event> |
streamEvents()
Stream all events.
|
<E extends Event> |
streamEvents(Class<E> type)
Stream all events of a given type.
|
<E extends Event> |
streamEvents(Class<E> type,
SortOrder order)
Stream all events of a given type in a specified order.
|
Cursor<ItemEventCollection<Event>> |
streamEventsByItem()
Stream events grouped by item.
|
<E extends Event> |
streamEventsByItem(Class<E> type)
Stream events grouped by item.
|
Cursor<UserHistory<Event>> |
streamEventsByUser()
Stream events grouped by user.
|
<E extends Event> |
streamEventsByUser(Class<E> type)
Stream events grouped by user.
|
public static BinaryRatingDAO open(File file) throws IOException
file - The file to open.file.IOException - If there ispublic Cursor<Event> streamEvents()
EventDAOstreamEvents in interface EventDAOpublic <E extends Event> Cursor<E> streamEvents(Class<E> type)
EventDAOstreamEvents in interface EventDAOtype - The event type.public <E extends Event> Cursor<E> streamEvents(Class<E> type, SortOrder order)
EventDAOstreamEvents in interface EventDAOtype - The event type.order - The order.public LongSet getItemIds()
ItemDAOgetItemIds in interface ItemDAOpublic Cursor<ItemEventCollection<Event>> streamEventsByItem()
ItemEventDAOstreamEventsByItem in interface ItemEventDAOpublic <E extends Event> Cursor<ItemEventCollection<E>> streamEventsByItem(Class<E> type)
ItemEventDAOstreamEventsByItem in interface ItemEventDAOtype - The type of item to look for.type from all items. If an item
exists but does not have any events, it may or may not be included depending on the
DAO implementation.public List<Event> getEventsForItem(long item)
ItemEventDAOgetEventsForItem in interface ItemEventDAOitem - The item ID.null if the item is unknown.@Nullable public <E extends Event> List<E> getEventsForItem(long item, Class<E> type)
ItemEventDAOgetEventsForItem in interface ItemEventDAOitem - The item ID.type - The type of events to retrieve.null if the item is unknown.@Nullable public LongSet getUsersForItem(long item)
ItemEventDAOgetUsersForItem in interface ItemEventDAOitem - The item ID.null if the item
is unknown.public LongSet getUserIds()
UserDAOgetUserIds in interface UserDAOpublic Cursor<UserHistory<Event>> streamEventsByUser()
UserEventDAOstreamEventsByUser in interface UserEventDAOpublic <E extends Event> Cursor<UserHistory<E>> streamEventsByUser(Class<E> type)
UserEventDAOstreamEventsByUser in interface UserEventDAOtype - The type of item to look for.type. If a
user exists, but does not have any history, they may or may not be included depending
on the DAO implementation.@Nullable public UserHistory<Event> getEventsForUser(long user)
UserEventDAOgetEventsForUser in interface UserEventDAOuser - The user ID.null if the user is unknown.@Nullable public <E extends Event> UserHistory<E> getEventsForUser(long user, Class<E> type)
UserEventDAOgetEventsForUser in interface UserEventDAOuser - The user ID.type - The type of events to retrieve.null if the user is unknown.public void describeTo(DescriptionWriter writer)
DescribabledescribeTo in interface Describablewriter - The description writer to use.