BooleanConst::BooleanConst(bool _isTrue) :
Boolean(BOOLCONST),
- isTrue(_isTrue) {
+ istrue(_isTrue) {
}
BooleanVar::BooleanVar(VarType t) :
}
Boolean *BooleanConst::clone(CSolver *solver, CloneMap *map) {
- if (isTrue)
+ if (istrue)
return solver->getBooleanTrue();
else
return solver->getBooleanFalse();
public:
Boolean(ASTNodeType _type);
virtual ~Boolean() {}
- virtual Boolean *clone(CSolver *solver, CloneMap *map) { ASSERT(0); return NULL; }
+ virtual Boolean *clone(CSolver *solver, CloneMap *map) = 0;
+ virtual bool isTrue() {return false;}
+ virtual bool isFalse() {return false;}
Polarity polarity;
BooleanValue boolVal;
Vector<Boolean *> parents;
public:
BooleanConst(bool isTrue);
Boolean *clone(CSolver *solver, CloneMap *map);
- bool isTrue;
+ bool isTrue() {return istrue;}
+ bool isFalse() {return !istrue;}
+ bool istrue;
CMEMALLOC;
};
if (array[0]->type == LOGICOP && ((BooleanLogic *)array[0])->op==SATC_NOT) {
return ((BooleanLogic *) array[0])->inputs.get(0);
} else if (array[0]->type == BOOLCONST) {
- bool isTrue = ((BooleanConst *) array[0])->isTrue;
- return isTrue ? boolFalse : boolTrue;
+ return array[0]->isTrue() ? boolFalse : boolTrue;
}
break;
}
case SATC_XOR: {
for(uint i=0;i<2;i++) {
if (array[i]->type == BOOLCONST) {
- bool isTrue = ((BooleanConst *) array[i])->isTrue;
- if (isTrue) {
+ if (array[i]->isTrue()) {
newarray[0]=array[1-i];
return applyLogicalOperation(SATC_NOT, newarray, 1);
} else
for(uint i=0;i<asize;i++) {
Boolean *b=array[i];
if (b->type == BOOLCONST) {
- bool isTrue = ((BooleanConst *) b)->isTrue;
- if (isTrue)
+ if (b->isTrue())
return b;
else
continue;
for(uint i=0;i<asize;i++) {
Boolean *b=array[i];
if (b->type == BOOLCONST) {
- bool isTrue = ((BooleanConst *) b)->isTrue;
- if (isTrue)
+ if (b->isTrue())
continue;
else
return b;
}
case SATC_IMPLIES: {
if (array[0]->type == BOOLCONST) {
- BooleanConst *b=(BooleanConst *) array[0];
- if (b->isTrue) {
+ if (array[0]->isTrue()) {
return array[1];
} else {
return boolTrue;
}
} else if (array[1]->type == BOOLCONST) {
- BooleanConst *b=(BooleanConst *) array[0];
- if (b->isTrue) {
- return b;
+ if (array[1]->isTrue()) {
+ return array[1];
} else {
return applyLogicalOperation(SATC_NOT, array, 1);
}