|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.cf.taste.impl.model.GenericUserPreferenceArray
public final class GenericUserPreferenceArray
Like GenericItemPreferenceArray but stores preferences for one user (all user IDs the same) rather
than one item.
This implementation maintains two parallel arrays, of item IDs and values. The idea is to save allocating
Preference objects themselves. This saves the overhead of Preference objects but also
duplicating the user ID value.
BooleanUserPreferenceArray,
GenericItemPreferenceArray,
GenericPreference,
Serialized Form| Constructor Summary | |
|---|---|
GenericUserPreferenceArray(int size)
|
|
GenericUserPreferenceArray(List<? extends Preference> prefs)
|
|
| Method Summary | |
|---|---|
GenericUserPreferenceArray |
clone()
|
boolean |
equals(Object other)
|
Preference |
get(int i)
|
long[] |
getIDs()
|
long |
getItemID(int i)
|
long |
getUserID(int i)
|
float |
getValue(int i)
|
int |
hashCode()
|
boolean |
hasPrefWithItemID(long itemID)
|
boolean |
hasPrefWithUserID(long userID)
|
Iterator<Preference> |
iterator()
|
int |
length()
|
void |
set(int i,
Preference pref)
Sets preference at i from information in the given Preference |
void |
setItemID(int i,
long itemID)
Sets item ID for preference at i. |
void |
setUserID(int i,
long userID)
Sets user ID for preference at i. |
void |
setValue(int i,
float value)
Sets preference value for preference at i. |
void |
sortByItem()
Sorts underlying array by item ID, ascending. |
void |
sortByUser()
Sorts underlying array by user ID, ascending. |
void |
sortByValue()
Sorts underlying array by preference value, ascending. |
void |
sortByValueReversed()
Sorts underlying array by preference value, descending. |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public GenericUserPreferenceArray(int size)
public GenericUserPreferenceArray(List<? extends Preference> prefs)
| Method Detail |
|---|
public int length()
length in interface PreferenceArraypublic Preference get(int i)
get in interface PreferenceArrayi - index
Preference representation of the preference at i
public void set(int i,
Preference pref)
PreferenceArrayPreference
set in interface PreferenceArraypublic long getUserID(int i)
getUserID in interface PreferenceArrayi - index
public void setUserID(int i,
long userID)
setUserID in interface PreferenceArrayi - indexuserID - new user IDpublic long getItemID(int i)
getItemID in interface PreferenceArrayi - index
public void setItemID(int i,
long itemID)
PreferenceArray
setItemID in interface PreferenceArrayi - indexitemID - new item IDpublic long[] getIDs()
getIDs in interface PreferenceArraypublic float getValue(int i)
getValue in interface PreferenceArrayi - index
public void setValue(int i,
float value)
PreferenceArray
setValue in interface PreferenceArrayi - indexvalue - new preference valuepublic void sortByUser()
PreferenceArray
sortByUser in interface PreferenceArraypublic void sortByItem()
PreferenceArray
sortByItem in interface PreferenceArraypublic void sortByValue()
PreferenceArray
sortByValue in interface PreferenceArraypublic void sortByValueReversed()
PreferenceArray
sortByValueReversed in interface PreferenceArraypublic boolean hasPrefWithUserID(long userID)
hasPrefWithUserID in interface PreferenceArrayuserID - user ID
public boolean hasPrefWithItemID(long itemID)
hasPrefWithItemID in interface PreferenceArrayitemID - item ID
public GenericUserPreferenceArray clone()
clone in interface PreferenceArrayclone in class Objectpublic int hashCode()
hashCode in class Objectpublic boolean equals(Object other)
equals in class Objectpublic Iterator<Preference> iterator()
iterator in interface Iterable<Preference>public String toString()
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||