public final class Ratings extends Object
Modifier and Type | Field and Description |
---|---|
static Ordering<Rating> |
ITEM_TIME_COMPARATOR |
Constructor and Description |
---|
Ratings() |
Modifier and Type | Method and Description |
---|---|
static RatingBuilder |
copyBuilder(Rating r)
Construct a rating builder initialized with the values of a rating.
|
static boolean |
equals(Rating r1,
Rating r2)
Compare two ratings for equality.
|
static int |
hashRating(Rating rating)
Compute the hash code of a rating.
|
static MutableSparseVector |
itemRatingVector(Collection<? extends Rating> ratings)
Construct a rating vector that contains the ratings provided by each user.
|
static Rating |
make(long uid,
long iid,
double value)
Make a fresh rating object with no timestamp.
|
static Rating |
make(long uid,
long iid,
double value,
long ts)
Make a fresh rating event.
|
static RatingBuilder |
newBuilder()
Construct a new
RatingBuilder . |
static MutableSparseVector |
userRatingVector(Collection<? extends Rating> ratings)
Construct a rating vector that contains the ratings provided for each
item.
|
static MutableSparseVector |
userRatingVector(Cursor<? extends Rating> ratings)
Extract a user rating vector from a rating cursor.
|
public static MutableSparseVector itemRatingVector(@Nonnull Collection<? extends Rating> ratings)
ratings
- Some ratings (they should all be for the same item)public static MutableSparseVector userRatingVector(@Nonnull Collection<? extends Rating> ratings)
ratings
- A collection of ratings (should all be by the same user)public static MutableSparseVector userRatingVector(@WillClose Cursor<? extends Rating> ratings)
ratings
- The rating cursor.userRatingVector(Collection)
public static Rating make(long uid, long iid, double value)
make(long, long, double, long)
public static Rating make(long uid, long iid, double value, long ts)
public static RatingBuilder newBuilder()
RatingBuilder
.public static RatingBuilder copyBuilder(@Nonnull Rating r)
r
- The rating.public static int hashRating(Rating rating)
Object.hashCode()
in rating
implementations.rating
- The rating.public static boolean equals(Rating r1, Rating r2)
Object.equals(Object)
in rating
implementations.r1
- The first rating.r2
- The second rating.