public final class ItemSelectors extends Object
| Modifier and Type | Method and Description |
|---|---|
static ItemSelector |
addNRandom(ItemSelector base,
int nRandom)
Select items selected by a selector, plus additional randomly-selected items.
|
static ItemSelector |
allItems()
Item selector that selects all items.
|
static ItemSelector |
allItemsExcept(ItemSelector base) |
static ItemSelector |
fixed(Collection<Long> items)
Select a fixed collection of items.
|
static ItemSelector |
fixed(long... items)
Select a fixed collection of items.
|
static ItemSelector |
mostPopular(int n)
Select the most popular items.
|
static ItemSelector |
nRandom(int n)
Randomly selects items from the universe.
|
static ItemSelector |
randomSubset(ItemSelector base,
int n)
Randomly select items selected by another selector.
|
static ItemSelector |
setDifference(ItemSelector selectorToKeep,
ItemSelector selectorToNotKeep)
Selects the set difference between two other selectors
|
static ItemSelector |
testItems()
Item selector that selects test items.
|
static ItemSelector |
testRatingMatches(org.hamcrest.Matcher<Double> matcher)
Select items where the user's test rating matches a condition.
|
static ItemSelector |
trainingItems()
Item selector that selects training items.
|
static ItemSelector |
union(ItemSelector selectorOne,
ItemSelector selectorTwo)
selects any items selected by at least one of two other selectors.
|
public static ItemSelector allItems()
public static ItemSelector testItems()
public static ItemSelector trainingItems()
public static ItemSelector testRatingMatches(org.hamcrest.Matcher<Double> matcher)
Matchers.greaterThanOrEqualTo(Comparable) will select
items that the user has rated at least a particular value.matcher - The matcher for test ratings.public static ItemSelector allItemsExcept(ItemSelector base)
public static ItemSelector addNRandom(ItemSelector base, int nRandom)
base - The base selector (e.g. testItems()).nRandom - The number of random items to add.base plus an additional
nRandom items.public static ItemSelector randomSubset(ItemSelector base, int n)
base - The base selector (e.g. allItems()).n - The number of random items to select.n items from the items selected by base,
or simply the items selected by base if there are fewer then n items selected.public static ItemSelector nRandom(int n)
ItemSelectors.randomSubset(ItemSelectors.allItems, n)public static ItemSelector mostPopular(int n)
n - The number of items to select.n items with the most events.public static ItemSelector setDifference(ItemSelector selectorToKeep, ItemSelector selectorToNotKeep)
selectorToKeep - selects items that are to be keptselectorToNotKeep - selects items that are to be excludedselectorToKeep
and not selected by selectorToNotKeep.public static ItemSelector union(ItemSelector selectorOne, ItemSelector selectorTwo)
public static ItemSelector fixed(Collection<Long> items)
items - The set of items. to select.items.public static ItemSelector fixed(long... items)
items - The items to select.items.