org.kit.furia
Class FuriaChanEngine

java.lang.Object
  extended by org.kit.furia.FuriaChanEngine

public class FuriaChanEngine
extends java.lang.Object

FuriaChanEngine holds the logic necessary to open fragmented programs insert them, and search them in the database.

Author:
Arnoldo Jose Muller Molina

Field Summary
protected  org.ajmm.obsearch.index.IndexShort<OBFragment> index
          OBsearch index of our database.
protected static java.lang.String IRINDEX_FOLDER
           
protected  IRIndexShort<OBFragment> mIndex
          Multi-set index.
protected static java.lang.String OBSEARCH_FOLDER
          Folder name where OB will reside.
 
Constructor Summary
FuriaChanEngine(java.io.File directory)
          Creates a FuriaChan object.
 
Method Summary
 void close()
           
protected  org.ajmm.obsearch.index.IndexShort<OBFragment> createIndex(java.io.File folder)
          A convenience method that creates an OBSearch index optimized for our distance function.
 void freeze()
          Freeze the index.
 byte getK()
           
 float getMSetScoreThreshold()
           
 short getN()
           
 short getR()
           
 float getSetScoreThreshold()
           
 void insert(java.io.File dir)
          Insert the given directory into Furia-chan We will ignore applications that have less than
 boolean isValidationMode()
           
static java.lang.String readString(java.io.File file)
          Reads a String from the given file.
 float search(java.io.File dir)
          Performs a search in the database and prints the result to the user.
 void setK(byte k)
           
 void setMSetScoreThreshold(float setScoreThreshold)
           
 void setN(short n)
           
 void setR(short r)
           
 void setSetScoreThreshold(float setScoreThreshold)
           
 void setValidate(boolean validationMode)
           
 void setValidationMode(boolean validationMode)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OBSEARCH_FOLDER

protected static java.lang.String OBSEARCH_FOLDER
Folder name where OB will reside.


IRINDEX_FOLDER

protected static java.lang.String IRINDEX_FOLDER

index

protected org.ajmm.obsearch.index.IndexShort<OBFragment> index
OBsearch index of our database.


mIndex

protected IRIndexShort<OBFragment> mIndex
Multi-set index. The information retrieval engine that calculates the similarity on documents or multi-sets of OBFragments.

Constructor Detail

FuriaChanEngine

public FuriaChanEngine(java.io.File directory)
                throws java.io.IOException,
                       com.sleepycat.je.DatabaseException,
                       org.ajmm.obsearch.exception.NotFrozenException,
                       java.lang.IllegalAccessException,
                       java.lang.InstantiationException,
                       org.ajmm.obsearch.exception.OBException
Creates a FuriaChan object. If the given directory does not exist, the directory will be created and two folders (one for OBSearch and one for Lucene) will be created beneath it. If the directory exists, then the corresponding OBSearch index and the IRIndex index will be loaded.

Parameters:
directory - the database directory that will be used.
Throws:
java.io.IOException - If directory does not exist and it cannot be created.
org.ajmm.obsearch.exception.OBException
java.lang.InstantiationException
java.lang.IllegalAccessException
org.ajmm.obsearch.exception.NotFrozenException
com.sleepycat.je.DatabaseException
Method Detail

isValidationMode

public boolean isValidationMode()

setValidate

public void setValidate(boolean validationMode)

close

public void close()
           throws IRException
Throws:
IRException

freeze

public void freeze()
            throws IRException
Freeze the index. After the index is frozen, matches can be performed.

Throws:
IRException - If there is an error in the freezing process.

insert

public void insert(java.io.File dir)
            throws java.io.IOException,
                   IRException
Insert the given directory into Furia-chan We will ignore applications that have less than

Parameters:
dir - The dir of an application or a directory of applications.
Throws:
java.io.IOException
IRException

search

public float search(java.io.File dir)
             throws java.io.IOException,
                    IRException
Performs a search in the database and prints the result to the user.

Parameters:
dir -
Returns:
The FuriaPrecision value (queries found in the top n results / total of queries)
Throws:
java.io.IOException
IRException

readString

public static java.lang.String readString(java.io.File file)
                                   throws java.io.IOException
Reads a String from the given file.

Parameters:
file - File to Read
Returns:
A String representation of the file
Throws:
java.io.IOException - If there is an IO error

createIndex

protected org.ajmm.obsearch.index.IndexShort<OBFragment> createIndex(java.io.File folder)
                                                              throws java.io.IOException,
                                                                     com.sleepycat.je.DatabaseException
A convenience method that creates an OBSearch index optimized for our distance function.

Parameters:
folder -
Returns:
an optimized index
Throws:
java.io.IOException
com.sleepycat.je.DatabaseException

setR

public void setR(short r)

setN

public void setN(short n)
          throws org.ajmm.obsearch.exception.OBException
Throws:
org.ajmm.obsearch.exception.OBException

setK

public void setK(byte k)

getK

public byte getK()

getR

public short getR()

getN

public short getN()

setValidationMode

public void setValidationMode(boolean validationMode)

getMSetScoreThreshold

public float getMSetScoreThreshold()

getSetScoreThreshold

public float getSetScoreThreshold()

setMSetScoreThreshold

public void setMSetScoreThreshold(float setScoreThreshold)

setSetScoreThreshold

public void setSetScoreThreshold(float setScoreThreshold)


Copyright © 2008 Arnoldo Jose Muller Molina. All Rights Reserved.