info.ephyra.answerselection.filters
Class CacheResultsFilter

java.lang.Object
  extended by info.ephyra.answerselection.filters.Filter
      extended by info.ephyra.answerselection.filters.CacheResultsFilter

public class CacheResultsFilter
extends Filter

Caches the results along with the query string of the first result. If the query string is the same in a subsequent call, the cached results are returned, otherwise the cache is updated.

This class extends the class Filter.

Version:
2008-02-10
Author:
Guido Sautter, Nico Schlaefer

Field Summary
private  java.lang.String lastQuery
           
private  Result[] lastQueryResults
           
 
Constructor Summary
CacheResultsFilter()
           
 
Method Summary
 Result[] apply(Result[] results)
          Resets the result array to a previous state if the query string matches.
private  void cache(java.lang.String query, Result[] results)
           
private  Result[] cacheLookup(java.lang.String query)
           
 
Methods inherited from class info.ephyra.answerselection.filters.Filter
apply
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lastQuery

private java.lang.String lastQuery

lastQueryResults

private Result[] lastQueryResults
Constructor Detail

CacheResultsFilter

public CacheResultsFilter()
Method Detail

apply

public Result[] apply(Result[] results)
Resets the result array to a previous state if the query string matches.

Overrides:
apply in class Filter
Parameters:
results - array of Result objects
Returns:
modified array of Result objects

cache

private void cache(java.lang.String query,
                   Result[] results)

cacheLookup

private Result[] cacheLookup(java.lang.String query)