Accidentally checked this file in...removing it now.
[repair.git] / Repair / RepairInterpreter / normalizer.h
1 // converts constraints into disjunctive normal form
2
3 #ifndef NORMALIZER_H
4 #define NORMALIZER_H
5 #include "classlist.h"
6 #include<stdio.h>
7
8
9 class CoercePredicate {
10  public:
11   CoercePredicate(bool, Predicate *);
12   CoercePredicate(char *ts, char *lt, char *rs);
13   CoercePredicate(char *ts, char *lt, char *rt,char *rs);
14   Predicate * getpredicate();
15   bool getcoercebool();
16   bool isrule();
17   bool istuple();
18   char *gettriggerset();
19   char *getrelset();
20   char *getltype();
21   char *getrtype();
22
23  private:
24   char *triggerset;
25   bool tuple;
26   char *ltype;
27   char *rtype;
28   char *relset;
29   bool rule;
30   bool coercebool;
31   Predicate *predicate;
32 };
33
34
35
36 class CoerceSentence {
37  public:
38   CoerceSentence(CoercePredicate **pred, int numpredicates);
39   int getnumpredicates();
40   CoercePredicate *getpredicate(int i);
41   bool issatisfied(processobject *po, Hashtable *env);
42   int cost(processobject *po, Hashtable *env);
43   ~CoerceSentence();
44   
45  private:
46   CoercePredicate **predicates;
47   int numpreds;
48 };
49
50
51
52 // represents a statement in normal form
53 class SentenceArray {
54  public:
55   SentenceArray(CoerceSentence **sentences, int l);
56   int length;
57   CoerceSentence **sentences;
58 };
59
60
61 // represents a constraint in normal form
62 class NormalForm {
63  public:
64   NormalForm(Constraint *c);
65   CoerceSentence * closestmatch(WorkSet *,processobject *po,Hashtable *env);
66   int getnumsentences();
67   CoerceSentence *getsentence(int i);
68   NormalForm(Rule *r);
69   void fprint(FILE *f);
70  private:
71   Constraint *c; /*keep reference for quantifiers */
72   CoerceSentence **sentences;  // the number of sentences in this constraint
73   int length;
74 };
75
76
77 SentenceArray * computesentences(Statement *st,bool stat);
78 int costfunction(CoercePredicate *p);
79 char * gettype(char *label, char *set,AElementexpr *ae);
80 #endif