org.terrier.structures
Class SimpleBitIndexPointer

java.lang.Object
  extended by org.terrier.structures.SimpleBitIndexPointer
All Implemented Interfaces:
org.apache.hadoop.io.Writable, BitFilePosition, BitIndexPointer, Pointer

public class SimpleBitIndexPointer
extends java.lang.Object
implements BitIndexPointer, org.apache.hadoop.io.Writable

An implementation of a BitIndexPointer. Records a pointer in a BitIndex structure - i.e. a file number (0-31), a byte offset (long), a bit offset (0-8), and a number of entries (positive int).

Since:
3.0
Author:
Craig Macdonald

Nested Class Summary
static class SimpleBitIndexPointer.Factory
          Factory class for SimpleBitIndexPointer.
 
Field Summary
 
Fields inherited from interface org.terrier.structures.BitIndexPointer
BIT_MASK, FILE_SHIFT, MAX_FILE_ID
 
Constructor Summary
SimpleBitIndexPointer()
          Construct an instance of the class.
SimpleBitIndexPointer(byte fileId, long byteOffset, byte bitOffset, int numEntries)
          Construct an instance of the class with
SimpleBitIndexPointer(long byteOffset, byte bitOffset, int numEntries)
          Construct an instance of the class with
 
Method Summary
 byte getFileNumber()
          Returns the file number: 0-32
 int getNumberOfEntries()
          Returns number of "things" that this pointer refers to
 long getOffset()
          Return the offset
 byte getOffsetBits()
          Return the offset bits
 java.lang.String pointerToString()
          Returns a textual representation of the pointer alone
 void readFields(java.io.DataInput arg0)
          Populate this pointer from DataInput source
 void setBitIndexPointer(BitIndexPointer pointer)
          Update this pointer to reflect the same values as the specified pointer
 void setFileNumber(byte fileId)
          Set the file number
 void setNumberOfEntries(int count)
          Set the number of "things that the pointer refers to
 void setOffset(BitFilePosition pos)
          Set the offset
 void setOffset(long _bytes, byte _bits)
          Set the offset in bytes and bits
 void setPointer(Pointer p)
          Sets the pointer within this object to that represented by the specified pointer
 java.lang.String toString()
          Debug friendly output of this pointer
 void write(java.io.DataOutput arg0)
          Write this pointer to DataOutput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleBitIndexPointer

public SimpleBitIndexPointer()
Construct an instance of the class.


SimpleBitIndexPointer

public SimpleBitIndexPointer(byte fileId,
                             long byteOffset,
                             byte bitOffset,
                             int numEntries)
Construct an instance of the class with

Parameters:
fileId -
byteOffset -
bitOffset -
numEntries -

SimpleBitIndexPointer

public SimpleBitIndexPointer(long byteOffset,
                             byte bitOffset,
                             int numEntries)
Construct an instance of the class with

Parameters:
byteOffset -
bitOffset -
numEntries -
Method Detail

getNumberOfEntries

public int getNumberOfEntries()
Returns number of "things" that this pointer refers to

Specified by:
getNumberOfEntries in interface Pointer

setNumberOfEntries

public void setNumberOfEntries(int count)
Set the number of "things that the pointer refers to

Specified by:
setNumberOfEntries in interface Pointer

getOffsetBits

public byte getOffsetBits()
Return the offset bits

Specified by:
getOffsetBits in interface BitFilePosition

getFileNumber

public byte getFileNumber()
Returns the file number: 0-32

Specified by:
getFileNumber in interface BitIndexPointer

setFileNumber

public void setFileNumber(byte fileId)
Set the file number

Specified by:
setFileNumber in interface BitIndexPointer

getOffset

public long getOffset()
Return the offset

Specified by:
getOffset in interface BitFilePosition

setOffset

public void setOffset(long _bytes,
                      byte _bits)
Set the offset in bytes and bits

Specified by:
setOffset in interface BitFilePosition

setBitIndexPointer

public void setBitIndexPointer(BitIndexPointer pointer)
Update this pointer to reflect the same values as the specified pointer

Specified by:
setBitIndexPointer in interface BitIndexPointer
Parameters:
pointer - - pointer to use to set the offset, bit offset and file Id parameters.

setOffset

public void setOffset(BitFilePosition pos)
Set the offset

Specified by:
setOffset in interface BitFilePosition

readFields

public void readFields(java.io.DataInput arg0)
                throws java.io.IOException
Populate this pointer from DataInput source

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 pointer to DataOutput

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

toString

public java.lang.String toString()
Debug friendly output of this pointer

Overrides:
toString in class java.lang.Object

pointerToString

public java.lang.String pointerToString()
Returns a textual representation of the pointer alone

Specified by:
pointerToString in interface Pointer

setPointer

public void setPointer(Pointer p)
Sets the pointer within this object to that represented by the specified pointer

Specified by:
setPointer in interface Pointer
Parameters:
p - other pointer to update the pointer in this object


Terrier 3.5. Copyright © 2004-2011 University of Glasgow