Terrier IR Platform
2.2.1

uk.ac.gla.terrier.structures.upgrading
Class ReverseFile

java.lang.Object
  extended by uk.ac.gla.terrier.structures.upgrading.ReverseFile

public class ReverseFile
extends java.lang.Object

This class provides some utilities for handling inverted files from the old terrier version. Concretely:
- Reverses an Inverted File byte to byte (the byte sequence remains the same) abcdefgh| ... --> hgfedcba | ...
- Converts an inverted file from the old terrier version (using OldBitFile) to this one (reading the contents of the file and writting the postings in the new format).
- Checks if two inverted files have the same information (this is, the same number of posting lists, with the same data in them).

Author:
Roi Blanco

Constructor Summary
ReverseFile()
           
 
Method Summary
static boolean checkArrays(int[][] one, int[][] two)
          Checks whether two int[][] arrays have the same elements
static void checkIF(java.lang.String invertedFile, java.lang.String lexiconFile)
          Checks if two inverted files contain the same information, without considering the termid or the order of the terms in the files.
static void main(java.lang.String[] args)
          Main class
static void reverse(java.lang.String output)
          Traverses an inverted file written with the old terrier version, and writes it in the new compressed format.
static int reverseByte(int byteIn)
          Reverses one byte.
static void reverseByteByByte(java.lang.String input, java.lang.String output)
          Reverses a file reading byte to byte
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReverseFile

public ReverseFile()
Method Detail

reverse

public static void reverse(java.lang.String output)
Traverses an inverted file written with the old terrier version, and writes it in the new compressed format.

Parameters:
output - String containing the name of the new inverted file (should replace the old one).

checkIF

public static void checkIF(java.lang.String invertedFile,
                           java.lang.String lexiconFile)
Checks if two inverted files contain the same information, without considering the termid or the order of the terms in the files.

Parameters:
invertedFile - String file name of the inverted file
lexiconFile - String file name of the lexicon file

checkArrays

public static boolean checkArrays(int[][] one,
                                  int[][] two)
Checks whether two int[][] arrays have the same elements

Parameters:
one - the first int[][] array
two - the second int[][] array
Returns:
true if the arrays match

reverseByteByByte

public static void reverseByteByByte(java.lang.String input,
                                     java.lang.String output)
Reverses a file reading byte to byte

Parameters:
input - String with the file to read
output - String output filenae

reverseByte

public static int reverseByte(int byteIn)
Reverses one byte.

Parameters:
byteIn - byte to reverse.
Returns:
byte reversed.

main

public static void main(java.lang.String[] args)
Main class

Parameters:
args - (see help)

Terrier IR Platform
2.2.1

Terrier Information Retrieval Platform 2.2.1. Copyright 2004-2008 University of Glasgow