org.terrier.structures.indexing.singlepass.hadoop
Class WritableByteArray

java.lang.Object
  extended by org.terrier.structures.indexing.singlepass.hadoop.WritableByteArray
All Implemented Interfaces:
org.apache.hadoop.io.Writable
Direct Known Subclasses:
MapEmittedPostingList

public class WritableByteArray
extends java.lang.Object
implements org.apache.hadoop.io.Writable

Represents a Writable Posting List. This can contain in addition to the posting list, the Document Frequency and Term Frequency. This class is needed because Hadoop must know how to write out the intermediate map output during indexing

Since:
2.2
Author:
Richard McCreadie

Field Summary
protected  byte[] array
          Posting List
protected  int arraylength
          Size of the Posting List
protected  int DocumentFreq
          Document Frequency
protected  int TermFreq
          Term Frequency
 
Constructor Summary
WritableByteArray()
          Empty Constructor
WritableByteArray(int c)
          Constructor - with Document Frequency
WritableByteArray(int c, int c2)
          Constructor - with Document Frequency and Term Frequency
 
Method Summary
static WritableByteArray create_Hadoop_WritableByteArray(byte[] b)
          Factory Method
static WritableByteArray create_Hadoop_WritableByteArray(byte[] b, int c)
          Factory Method
static WritableByteArray create_Hadoop_WritableByteArray(byte[] b, int c, int c2)
          Factory Method
 byte[] getArray()
          Gets the byte array
 int getDocumentFreq()
          Get the document frequency
 int getTermFreq()
          Get the term frequency
 void readFields(java.io.DataInput arg0)
          Read this object from the input stream 'in'
 void setArray(byte[] b)
          Sets the byte array
 void setDocumentFreq(int _DocumentFreq)
          Set the document frequency
 void setTermFrequency(int _TermFreq)
          Set the term frequency
 java.lang.String toString()
          
 void write(java.io.DataOutput arg0)
          Write this object to the output stream 'out'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

array

protected byte[] array
Posting List


DocumentFreq

protected int DocumentFreq
Document Frequency


TermFreq

protected int TermFreq
Term Frequency


arraylength

protected int arraylength
Size of the Posting List

Constructor Detail

WritableByteArray

public WritableByteArray()
Empty Constructor


WritableByteArray

public WritableByteArray(int c)
Constructor - with Document Frequency

Parameters:
c - - Document Frequency

WritableByteArray

public WritableByteArray(int c,
                         int c2)
Constructor - with Document Frequency and Term Frequency

Parameters:
c - - Document Frequency
c2 - - Term Frequency
Method Detail

create_Hadoop_WritableByteArray

public static WritableByteArray create_Hadoop_WritableByteArray(byte[] b)
                                                         throws java.io.IOException
Factory Method

Parameters:
b - - Posting List
Returns:
a newly created object
Throws:
java.io.IOException

create_Hadoop_WritableByteArray

public static WritableByteArray create_Hadoop_WritableByteArray(byte[] b,
                                                                int c)
                                                         throws java.io.IOException
Factory Method

Parameters:
b - - Posting List
c - - Document Frequency
Returns:
a newly created object
Throws:
java.io.IOException

create_Hadoop_WritableByteArray

public static WritableByteArray create_Hadoop_WritableByteArray(byte[] b,
                                                                int c,
                                                                int c2)
                                                         throws java.io.IOException
Factory Method

Parameters:
b - - Posting List
c - - Document Frequency
c2 - - Term Frequency
Returns:
a newly created Indexing_WritableByteArray
Throws:
java.io.IOException

readFields

public void readFields(java.io.DataInput arg0)
                throws java.io.IOException
Read this object from the input stream 'in'

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

write

public void write(java.io.DataOutput arg0)
           throws java.io.IOException
Write this object to the output stream 'out'

Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
java.io.IOException

setArray

public void setArray(byte[] b)
Sets the byte array


getArray

public byte[] getArray()
Gets the byte array


toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

getDocumentFreq

public int getDocumentFreq()
Get the document frequency


setDocumentFreq

public void setDocumentFreq(int _DocumentFreq)
Set the document frequency


getTermFreq

public int getTermFreq()
Get the term frequency


setTermFrequency

public void setTermFrequency(int _TermFreq)
Set the term frequency



Terrier 3.5. Copyright © 2004-2011 University of Glasgow