2 #include "DefaultGuidance3.h"
8 /* This class tells the analysis stuff */
10 1. Source for atoms if the set is too small - can be another set or function call (assumed to be no set)
11 2. Source for atoms if relation requires atom of this set - can be another set or function call (assumed to be no set)
12 3. Removal from set - where to insert objects from this set
13 4. Insertion into set - which subset to put objects in */
15 DefGuidance3::DefGuidance3(model *m) {
19 Source DefGuidance3::sourceforsetsize(char *set) {
20 DomainRelation *dr=globalmodel->getdomainrelation();
21 DomainSet *ds=dr->getset(set);
22 while(dr->getsuperset(ds)!=NULL)
23 ds=dr->getsuperset(ds);
24 if(equivalentstrings(ds->getname(),"blocks"))
25 return Source(copystr("freeblocks"));
28 Source DefGuidance3::sourceforrelation(char *set) {
29 DomainRelation *dr=globalmodel->getdomainrelation();
30 DomainSet *ds=dr->getset(set);
31 while(dr->getsuperset(ds)!=NULL)
32 ds=dr->getsuperset(ds);
33 if(equivalentstrings(ds->getname(),"blocks"))
34 return Source(copystr("freeblocks"));
38 char * DefGuidance3::removefromset(char * set) {
39 DomainRelation *dr=globalmodel->getdomainrelation();
40 DomainSet *ds=dr->getset(set);
41 if (equivalentstrings(set,"token"))
44 if (equivalentstrings(dr->getsuperset(ds)->getname(),"fatblocks"))
46 if (equivalentstrings(dr->getsuperset(ds)->getname(),"usedblocks"))
49 DomainSet *ss=dr->getsuperset(ds);
50 while(ss!=NULL&&ss->gettype()==DOMAINSET_PARTITION) {
51 for(int i=0;i<ss->getnumsubsets();i++) {
52 char *name=ss->getsubset(i);
53 if (!equivalentstrings(ds->getname(),name)&&
54 !equivalentstrings(ds->getname(),name)) {
57 while(ss->gettype()==DOMAINSET_PARTITION) {
58 char *name=ss->getsubset(0);
65 ss=dr->getsuperset(ss);
73 char * DefGuidance3::insertiontoset(char *set) {
74 if (equivalentstrings(set,"token"))
77 DomainRelation *dr=globalmodel->getdomainrelation();
78 DomainSet *ds=dr->getset(set);
79 while (ds->gettype()==DOMAINSET_PARTITION) {
80 ds=dr->getset(ds->getsubset(0));
81 /* have to look for subset; */