-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgensufftree.hh
61 lines (42 loc) · 1.22 KB
/
gensufftree.hh
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#ifndef gensufftree_hh
#define gensufftree_hh
#include <set>
#include <utility>
#include <vector>
#include <libstree.h>
#include "bottom.hh"
typedef std::pair<TStringIndex, TStringIndex> TLookupResult;
class GenSuffTree
{
private:
typedef std::vector<LST_String *> TConverter;
typedef std::set<TStringIndex> TLiveSet;
TConverter converter;
LST_STree *tree;
TLiveSet liveSet;
public:
GenSuffTree();
~GenSuffTree();
TStringIndex get_size() const;
TString get(TStringIndex i) const;
void add(const TString &s);
// may not be called on tree w/ less than 2 strings
TLookupResult lookup(TStringIndex i, TStringIndex j);
void del(TStringIndex i);
void dump();
private:
bool is_live(TStringIndex i) const;
// may not be called on tree w/ less than 2 strings
TLookupResult backtrack(LST_Node *node, TStringIndex depth,
TStringIndex exc);
// may not be called on tree w/ less than 2 strings
TStringIndex get_other(TStringIndex i) const;
// not implemented
GenSuffTree(const GenSuffTree &);
GenSuffTree &operator=(const GenSuffTree &);
};
inline bool GenSuffTree::is_live(TStringIndex i) const
{
return liveSet.find(i) != liveSet.end();
}
#endif