-
Notifications
You must be signed in to change notification settings - Fork 0
/
Item.h
73 lines (64 loc) · 2.22 KB
/
Item.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef ITEM_H
#define ITEM_H
#include <map>
#include <set>
#include "Wrd.h"
#include "Edge.h"
#include "AnswerTree.h"
#include "CntxArray.h"
using namespace std;
class Term;
class Word;
//class ostream;
typedef set<Edge*, less<Edge*> > EdgeSet;
typedef EdgeSet::iterator EdgeSetIter;
typedef pair<EdgeSet,AnswerTreeMap> ItmGHeadInfo;
typedef map<Wrd, ItmGHeadInfo, less<Wrd> > HeadMap;
typedef map<int,HeadMap, less<int> > PosMap;
typedef HeadMap::iterator HeadIter;
typedef PosMap::iterator PosIter;
class Item
{
public:
Item( //const Wrd* hd,
const Term * _term, int _start, int _finish );
~Item();
int operator== (const Item& item) const;
int operator!= (const Item& item) const {return (!operator== (item)); }
friend ostream& operator<< ( ostream& os, const Item& item );
const Term * term() const { return term_; }
const Wrd* word() const { return word_; }
const Wrd*& word() { return word_; }
int start() const {return start_;}
int finish() const {return finish_;}
list<Edge*>& needme() {return needme_;}
list<Edge*>& ineed() {return ineed_;}
void check();
double prob() const {return prob_;}
double poutside() const {return poutside_;}
double storeP() const {return storeP_;}
double & prob() {return prob_;}
double & poutside() {return poutside_;}
double & storeP() {return storeP_;}
AnswerTreePair& stored(CntxArray& ca) { return atpFind(ca, stored_); }
PosMap& posAndheads() { return posAndheads_; }
private:
Item( const Item& );
Item& operator= (const Item&);
int start_;
int finish_;
const Term * term_;
const Wrd * word_;
list<Edge*> needme_; /* A list of rules requiring a term starting
* at start */
list<Edge*> ineed_; // needme = rules predicted by this (art) item
// ineed = rules that predict this (art) item
double prob_;
double poutside_;
double storeP_;
AnswerTreeMap stored_;
PosMap posAndheads_;
};
typedef list<Item*> Items;
typedef Item * Item_star;
#endif /* !ITEM_H */