-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtree.h
46 lines (35 loc) · 868 Bytes
/
tree.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef TREE_H
#define TREE_H
#include <QString>
#include "crawler.h"
struct FileWordPositionWrapper
{
FileWordPositionWrapper(FileWordNode *start, FileWordNode *end);
FileWordNode *start;
FileWordNode *end;
};
class Tree
{
public:
static const short BST_TREE = 1;
static const short TRIE_TREE = 2;
static const short TST_TREE = 3;
Tree();
virtual void add(QString word, FileWordNode *pos_in_file) = 0;
virtual FileWordPositionWrapper search(QString word) = 0;
virtual QStringList listAllWords() = 0;
};
class TreeObject
{
private:
TreeObject();
public:
Tree *tree;
static TreeObject &getInstance();
void initTree(const short tree_type);
QStringList listAllWords();
Tree *getTree();
QStringList searchWord(QString word);
QStringList searchQuery(QString query);
};
#endif // TREE_H