6 BooleanIterator::BooleanIterator(CSolver * _solver) :
7 solverit(_solver->getConstraints()) {
11 BooleanIterator::~BooleanIterator() {
15 bool BooleanIterator::hasNext() {
16 return boolean.getSize() != 0;
19 void BooleanIterator::updateNext() {
20 if (boolean.getSize() != 0) {
26 if (boolean.getSize() == 0) {
27 if (solverit->hasNext()) {
28 Boolean *b=solverit->next().getBoolean();
29 if (discovered.add(b)) {
37 Boolean *topboolean=boolean.last();
38 uint topindex=index.last();
39 switch(topboolean->type) {
46 BooleanLogic * logicop=(BooleanLogic*) topboolean;
47 uint size=logicop->inputs.getSize();
51 index.push(topindex+1);
52 Boolean *newchild=logicop->inputs.get(topindex).getBoolean();
53 if (discovered.add(newchild)) {
54 boolean.push(newchild);
65 Boolean * BooleanIterator::next() {
66 Boolean * b = boolean.last();
71 ElementIterator::ElementIterator(CSolver *_solver) :
78 ElementIterator::~ElementIterator() {
81 bool ElementIterator::hasNext() {
82 return element.getSize() != 0;
85 void ElementIterator::updateNext() {
86 if (element.getSize() != 0) {
92 if (element.getSize() == 0) {
94 if (baseindex == base->inputs.getSize()) {
98 Element * e = base->inputs.get(baseindex);
100 if (discovered.add(e)) {
108 Boolean *b=bit.next();
109 if (b->type == PREDICATEOP) {
110 base = (BooleanPredicate *)b;
118 Element *topelement=element.last();
119 uint topindex=index.last();
120 switch(topelement->type) {
124 case ELEMFUNCRETURN: {
125 ElementFunction * func=(ElementFunction*) topelement;
126 uint size=func->inputs.getSize();
127 if (topindex == size)
130 index.push(topindex+1);
131 Element *newchild=func->inputs.get(topindex);
132 if (discovered.add(newchild)) {
133 element.push(newchild);
144 Element * ElementIterator::next() {
145 Element * e = element.last();