org.apache.mahout.cf.taste.impl.model
Class BooleanPreference

java.lang.Object
  extended by org.apache.mahout.cf.taste.impl.model.BooleanPreference
All Implemented Interfaces:
Serializable, Preference

public final class BooleanPreference
extends Object
implements Preference, Serializable

Encapsulates a simple boolean "preference" for an item whose value does not matter (is fixed at 1.0). This is appropriate in situations where users conceptually have only a general "yes" preference for items, rather than a spectrum of preference values.

See Also:
Serialized Form

Constructor Summary
BooleanPreference(long userID, long itemID)
           
 
Method Summary
 long getItemID()
           
 long getUserID()
           
 float getValue()
           
 void setValue(float value)
          Sets the strength of the preference for this item
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BooleanPreference

public BooleanPreference(long userID,
                         long itemID)
Method Detail

getUserID

public long getUserID()
Specified by:
getUserID in interface Preference
Returns:
ID of user who prefers the item

getItemID

public long getItemID()
Specified by:
getItemID in interface Preference
Returns:
item ID that is preferred

getValue

public float getValue()
Specified by:
getValue in interface Preference
Returns:
strength of the preference for that item. Zero should indicate "no preference either way"; positive values indicate preference and negative values indicate dislike

setValue

public void setValue(float value)
Description copied from interface: Preference
Sets the strength of the preference for this item

Specified by:
setValue in interface Preference
Parameters:
value - new preference

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.