org.unigram.likelike.common
Class Candidate

java.lang.Object
  extended by org.unigram.likelike.common.Candidate
All Implemented Interfaces:
java.lang.Comparable<Candidate>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<Candidate>

public class Candidate
extends java.lang.Object
implements org.apache.hadoop.io.WritableComparable<Candidate>


Constructor Summary
Candidate()
          Default Constructor.
Candidate(org.apache.hadoop.io.LongWritable cid, org.apache.hadoop.io.LongWritable clusterSize)
          Constructor.
 
Method Summary
 int compareTo(Candidate other)
          Compare query into another one.
 boolean equals(java.lang.Object obj)
          Validate assigned Object(should Query instance) is the same as this.
 org.apache.hadoop.io.LongWritable getId()
          Get userId who submit the query string.
 org.apache.hadoop.io.LongWritable getSize()
          Get the time when user submitted query.
 int hashCode()
          hashCode.
 void readFields(java.io.DataInput in)
          Read the serialized the query information.
 void write(java.io.DataOutput out)
          Write the query information for serialization.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Candidate

public Candidate()
Default Constructor.


Candidate

public Candidate(org.apache.hadoop.io.LongWritable cid,
                 org.apache.hadoop.io.LongWritable clusterSize)
Constructor.

Parameters:
cid - candidate (item) id
clusterSize - size of cluster
Method Detail

getId

public final org.apache.hadoop.io.LongWritable getId()
Get userId who submit the query string.

Returns:
id

getSize

public final org.apache.hadoop.io.LongWritable getSize()
Get the time when user submitted query.

Returns:
size

write

public final void write(java.io.DataOutput out)
                 throws java.io.IOException
Write the query information for serialization.

Specified by:
write in interface org.apache.hadoop.io.Writable
Parameters:
out - DataOutput
Throws:
java.io.IOException - -

readFields

public final void readFields(java.io.DataInput in)
                      throws java.io.IOException
Read the serialized the query information.

Specified by:
readFields in interface org.apache.hadoop.io.Writable
Parameters:
in - DataInput
Throws:
java.io.IOException - -

compareTo

public final int compareTo(Candidate other)
Compare query into another one.

Specified by:
compareTo in interface java.lang.Comparable<Candidate>
Parameters:
other - query to be compared
Returns:
1 when this is bigger than other 0 when this is the same as other -1 when this is the smaller than other

equals

public final boolean equals(java.lang.Object obj)
Validate assigned Object(should Query instance) is the same as this.

Overrides:
equals in class java.lang.Object
Parameters:
obj - a object to be validated.
Returns:
true when this and obj is identical contents false when this and obj is different

hashCode

public final int hashCode()
hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
hash value