Exemplo n.º 1
0
bool Formula::isAlpha()
{
	if (this->isCompound() && this->cntv == '&') {
		return true;
	}
	else if (this->isNegated()) {
		Formula *next = this->getNext();
		if (next->isCompound() && (next->getCntv()=='|' || next->getCntv()=='>')) {
			return true;
		}
		else return false;
	}
	else return false;
}
Exemplo n.º 2
0
/*
* Special Copy Constructor
* Only pointers to free vars are retained
* Used for copying gamma formulas
*/
Formula::Formula(Formula &f)
{
	this->type = f.getType();
	this->cntv = f.getCntv();
	if (f.isAtomic()) {		
		TermList *list = new TermList();
		this->copy(f.getPredicate()->getTermList(), list);
		this->predicate = new Predicate(f.getPredicate()->getName(), list);
	}
	else if (f.isNegated()) {		
		this->nextFormula = new Formula(*f.getNext());
	}
	else if (f.isQuantified()) {
		this->qVar = new Term(*f.getQVar());		
		this->nextFormula = new Formula(*f.getNext());
	}
	else if (f.isCompound()) {
		this->formula1 = new Formula(*f.getLeft());
		this->formula2 = new Formula(*f.getRight());
	}
}