net.obsearch.query
Class AbstractOBQuery<O>

java.lang.Object
  extended by net.obsearch.query.AbstractOBQuery<O>
Type Parameters:
O -
Direct Known Subclasses:
OBQueryByte, OBQueryDouble, OBQueryFloat, OBQueryInt, OBQueryLong, OBQueryShort

public abstract class AbstractOBQuery<O>
extends Object

Encapsulates functionality common to all queries.

Author:
amuller

Constructor Summary
AbstractOBQuery()
           
 
Method Summary
abstract  boolean add(long id, O object)
          Adds an object into the queue.
abstract  double ep(List<AbstractOBResult<O>> db)
          calculates the ep value of this query against the "DB" (all the objects of the DB sorted by distance to this query).
abstract  List<AbstractOBResult<O>> getSortedElements()
           
abstract  boolean isFull()
           
abstract  double recall(List<AbstractOBResult<O>> db)
          calculates the recall value of this query against the "DB" (all the objects of the DB sorted by distance to this query).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractOBQuery

public AbstractOBQuery()
Method Detail

add

public abstract boolean add(long id,
                            O object)
                     throws InstantiationException,
                            IllegalAccessException,
                            OBException
Adds an object into the queue. The underlying classes calculate the distance of the object and the query.

Parameters:
id - id number of the object to add.
object - object added.
Returns:
true if the range has changed after the add.
Throws:
InstantiationException
IllegalAccessException
OBException

getSortedElements

public abstract List<AbstractOBResult<O>> getSortedElements()
Returns:
a list of objects ordered from smallest distance to largest distance

ep

public abstract double ep(List<AbstractOBResult<O>> db)
calculates the ep value of this query against the "DB" (all the objects of the DB sorted by distance to this query).

Parameters:
db - all the objects of the DB sorted by distance to this query
Returns:
ep value

recall

public abstract double recall(List<AbstractOBResult<O>> db)
calculates the recall value of this query against the "DB" (all the objects of the DB sorted by distance to this query).

Parameters:
db - all the objects of the DB sorted by distance to this query
Returns:
ep value

isFull

public abstract boolean isFull()


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