gStore/Query/ResultFilter.h

43 lines
1.1 KiB
C
Raw Normal View History

2016-09-18 20:01:57 +08:00
/*=============================================================================
# Filename: ResultFilter.h
# Author: Jiaqi, Chen
# Mail: chenjiaqi93@163.com
# Last Modified: 2016-05-03 15:36
# Description:
=============================================================================*/
#ifndef _QUERY_RESULTFILTER_H
#define _QUERY_RESULTFILTER_H
#include "BasicQuery.h"
2016-09-18 20:01:57 +08:00
#include "SPARQLquery.h"
#include "../Util/Util.h"
class ResultFilter
{
private:
static const int MAX_SIZE = 1048576;
inline int hash(unsigned int x)
2016-09-18 20:01:57 +08:00
{
x = (x + 0x7ed55d16) + (x << 12);
x = (x ^ 0xc761c23c) ^ (x >> 19);
x = (x + 0x165667b1) + (x << 5);
x = (x + 0xd3a2646c) ^ (x << 9);
x = (x + 0xfd7046c5) + (x << 3);
x = (x ^ 0xb55a4f09) ^ (x >> 16);
return x & (MAX_SIZE - 1);
2016-09-18 20:01:57 +08:00
}
//var valid hash_table
std::map<std::string, pair<int, std::vector<int> > > result_filter;
2016-09-18 20:01:57 +08:00
public:
void addVar(std::string var);
void changeResultHashTable(SPARQLquery &query, int value);
void candFilterWithResultHashTable(BasicQuery &basicquery);
2016-09-18 20:01:57 +08:00
};
#endif // _QUERY_RESULTFILTER_H