org.apache.mahout.vectorizer.collocations.llr
Class GramKey

java.lang.Object
  extended by org.apache.hadoop.io.BinaryComparable
      extended by org.apache.mahout.vectorizer.collocations.llr.GramKey
All Implemented Interfaces:
Comparable<org.apache.hadoop.io.BinaryComparable>, org.apache.hadoop.io.Writable, org.apache.hadoop.io.WritableComparable<org.apache.hadoop.io.BinaryComparable>

public final class GramKey
extends org.apache.hadoop.io.BinaryComparable
implements org.apache.hadoop.io.WritableComparable<org.apache.hadoop.io.BinaryComparable>

A GramKey, based on the identity fields of Gram (type, string) plus a byte[] used for secondary ordering


Constructor Summary
GramKey()
           
GramKey(Gram gram, byte[] order)
          create a GramKey based on the specified Gram and order
 
Method Summary
 byte[] getBytes()
           
 int getLength()
           
 int getPrimaryLength()
           
 String getPrimaryString()
           
 Gram.Type getType()
           
 void readFields(DataInput in)
           
 void set(Gram gram, byte[] order)
          set the gram held by this key
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class org.apache.hadoop.io.BinaryComparable
compareTo, compareTo, equals, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Constructor Detail

GramKey

public GramKey()

GramKey

public GramKey(Gram gram,
               byte[] order)
create a GramKey based on the specified Gram and order

Parameters:
gram -
order -
Method Detail

set

public void set(Gram gram,
                byte[] order)
set the gram held by this key


getBytes

public byte[] getBytes()
Specified by:
getBytes in class org.apache.hadoop.io.BinaryComparable

getLength

public int getLength()
Specified by:
getLength in class org.apache.hadoop.io.BinaryComparable

getPrimaryLength

public int getPrimaryLength()

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

getType

public Gram.Type getType()
Returns:
the gram is at the head of its text unit or tail or unigram.

getPrimaryString

public String getPrimaryString()

toString

public String toString()
Overrides:
toString in class Object


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