Exemplo n.º 1
0
Formula* Formula::getAlpha1()
{
	if (this->isCompound()) {
		return this->formula1;
	}
	else if (this->nextFormula->getCntv() == '|') {
		Formula *next = this->nextFormula;
		return new Formula(next->getLeft());
	}
	else {
		Formula *next = this->nextFormula;
		return next->getLeft();
	}
}
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());
	}
}