~mixxxdevelopers/mixxx/features_search

« back to all changes in this revision

Viewing changes to mixxx/lib/clucene-2.3.3.4/src/core/CLucene/search/CachingSpanFilter.h

  • Committer: RJ Ryan
  • Date: 2011-05-27 23:54:08 UTC
  • Revision ID: rryan@mit.edu-20110527235408-kepzw0zdxdhngsqr
Add clucene-2.3.3.4 to lib/

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*------------------------------------------------------------------------------
 
2
 * Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team
 
3
 * 
 
4
 * Distributable under the terms of either the Apache License (Version 2.0) or 
 
5
 * the GNU Lesser General Public License, as specified in the COPYING file.
 
6
 ------------------------------------------------------------------------------*/
 
7
#ifndef _lucene_search_CachingSpanFilter_
 
8
#define _lucene_search_CachingSpanFilter_
 
9
 
 
10
#include "SpanFilter.h"
 
11
 
 
12
CL_NS_DEF(search)
 
13
 
 
14
/**
 
15
 * Wraps another SpanFilter's result and caches it.  The purpose is to allow
 
16
 * filters to simply filter, and then wrap with this class to add caching.
 
17
 */
 
18
class  CachingSpanFilter : public SpanFilter 
 
19
{
 
20
        struct Internal;
 
21
        Internal* _internal;
 
22
 
 
23
protected:
 
24
    SpanFilter *        filter;
 
25
    bool                deleteFilter;
 
26
 
 
27
protected:
 
28
    CachingSpanFilter( const CachingSpanFilter& copy );
 
29
 
 
30
public:
 
31
    /**
 
32
     * @param filter Filter to cache results of
 
33
     */
 
34
    CachingSpanFilter( SpanFilter * filter, bool deleteFilter=true );
 
35
 
 
36
    virtual ~CachingSpanFilter();
 
37
 
 
38
    virtual Filter* clone() const;
 
39
 
 
40
    virtual CL_NS(util)::BitSet* bits( CL_NS(index)::IndexReader * reader );
 
41
 
 
42
    virtual SpanFilterResult * bitSpans( CL_NS(index)::IndexReader * reader );
 
43
 
 
44
    virtual TCHAR* toString();
 
45
 
 
46
private:
 
47
    SpanFilterResult * getCachedResult( CL_NS(index)::IndexReader * reader );
 
48
 
 
49
//     public boolean equals(Object o) {
 
50
//       if (!(o instanceof CachingSpanFilter)) return false;
 
51
//       return this.filter.equals(((CachingSpanFilter)o).filter);
 
52
//     }
 
53
//   
 
54
//     public int hashCode() {
 
55
//       return filter.hashCode() ^ 0x1117BF25;
 
56
//     }
 
57
};
 
58
 
 
59
CL_NS_END
 
60
#endif // _lucene_search_CachingSpanFilter_