net.obsearch.index.utils
Class IndexSmokeTUtil<O extends OBShort>

java.lang.Object
  extended by net.obsearch.index.utils.IndexSmokeTUtil<O>
Direct Known Subclasses:
IndexSmokeTUtilApprox

public class IndexSmokeTUtil<O extends OBShort>
extends Object

Main class that performs all sorts of tests on the indexes. Objects are inserted deleted verified for existence. Searches are always compared against sequential search.

Since:
0.7
Author:
Arnoldo Jose Muller Molina

Field Summary
protected  OBFactory<O> factory
           
static int maxSliceSize
           
 
Constructor Summary
IndexSmokeTUtil(OBFactory<O> factory)
          Creates a new smoke tester.
 
Method Summary
protected  String debug(Iterator<OBResultShort<O>> it, Index<O> index)
          Prints debug info for the given priority queue.
protected  String debug(OBPriorityQueueShort<O> q, Index<O> index)
           
 void initIndex(IndexShort<O> index)
          Initialize the index.
static boolean isIn(int x, int[] j)
          if x is in j.
static String parseLine(String line)
          Parse a line in the slices file.
 void search(IndexShort<O> index, short range, short k)
          Perform all the searches with
 void searchSequential(long max, O o, OBPriorityQueueShort<O> result, IndexShort<O> index, short range)
          Sequential search.
static boolean shouldProcessSlice(OBSlice x)
          We only process slices of this size.
 void tIndex(IndexShort<O> index)
          Test method for Creates a database, fills it with data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected OBFactory<O extends OBShort> factory

maxSliceSize

public static int maxSliceSize
Constructor Detail

IndexSmokeTUtil

public IndexSmokeTUtil(OBFactory<O> factory)
                throws IOException
Creates a new smoke tester. Loads test properties.

Throws:
IOException - If the properties file cannot be found.
Method Detail

initIndex

public void initIndex(IndexShort<O> index)
               throws Exception
Initialize the index.

Parameters:
index - Index to be initialized.
Throws:
Exception - If something goes wrong.

tIndex

public void tIndex(IndexShort<O> index)
            throws Exception
Test method for Creates a database, fills it with data. Performs several queries and compares the result with the sequential search.

Parameters:
index - The index that will be tested
Throws:
If - something goes wrong.
Exception

search

public void search(IndexShort<O> index,
                   short range,
                   short k)
            throws Exception
Perform all the searches with

Parameters:
x - the index that will be used
range -
k -
Throws:
Exception

debug

protected String debug(OBPriorityQueueShort<O> q,
                       Index<O> index)
                throws IllegalIdException,
                       OBException,
                       InstantiationException,
                       IllegalAccessException
Throws:
IllegalIdException
OBException
InstantiationException
IllegalAccessException

debug

protected String debug(Iterator<OBResultShort<O>> it,
                       Index<O> index)
                throws IllegalIdException,
                       OBException,
                       InstantiationException,
                       IllegalAccessException
Prints debug info for the given priority queue.

Returns:
Throws:
IllegalAccessException
InstantiationException
OBException
IllegalIdException

isIn

public static boolean isIn(int x,
                           int[] j)
if x is in j.

Parameters:
x - item to search.
j - array to search.
Returns:
true if x is in j.

shouldProcessSlice

public static boolean shouldProcessSlice(OBSlice x)
                                  throws Exception
We only process slices of this size.

Parameters:
x - Slice
Returns:
true if the slice is within the size we want.
Throws:
Exception - If something goes wrong.

parseLine

public static String parseLine(String line)
Parse a line in the slices file.

Parameters:
line - A line in the file
Returns:
null if the line is a comment or a String if the line is a valid tree representation

searchSequential

public void searchSequential(long max,
                             O o,
                             OBPriorityQueueShort<O> result,
                             IndexShort<O> index,
                             short range)
                      throws Exception
Sequential search.

Parameters:
max - Search all the ids in the database until max
o - The object to search
result - The queue were the results are stored
index - the index to search
range - The range to employ
Throws:
Exception - If something goes really bad.


Copyright © 2007-2011 Arnoldo Jose Muller Molina. All Rights Reserved.