org.apache.mahout.cf.taste.hadoop.similarity.item
Class CountUsersKeyWritable

java.lang.Object
  extended by org.apache.mahout.cf.taste.hadoop.similarity.item.CountUsersKeyWritable
All Implemented Interfaces:
Comparable<CountUsersKeyWritable>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<CountUsersKeyWritable>

public class CountUsersKeyWritable
extends Object
implements org.apache.hadoop.io.WritableComparable<CountUsersKeyWritable>

a writable key that is used by CountUsersMapper and CountUsersReducer to count unique users by sending all userIDs to the same reducer and have them sorted in ascending order so that there's no buffering necessary when counting them


Nested Class Summary
static class CountUsersKeyWritable.CountUsersGroupComparator
          all userIDs go to the same reducer
static class CountUsersKeyWritable.CountUsersPartitioner
          all userIDs go to the same partition
 
Constructor Summary
CountUsersKeyWritable()
           
CountUsersKeyWritable(long userID)
           
 
Method Summary
 int compareTo(CountUsersKeyWritable other)
           
 boolean equals(Object other)
           
 long getUserID()
           
 int hashCode()
           
 void readFields(DataInput in)
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CountUsersKeyWritable

public CountUsersKeyWritable()

CountUsersKeyWritable

public CountUsersKeyWritable(long userID)
Method Detail

getUserID

public long getUserID()

readFields

public void readFields(DataInput in)
                throws IOException
Specified by:
readFields in interface org.apache.hadoop.io.Writable
Throws:
IOException

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

compareTo

public int compareTo(CountUsersKeyWritable other)
Specified by:
compareTo in interface Comparable<CountUsersKeyWritable>

equals

public boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2008-2011 The Apache Software Foundation. All Rights Reserved.