Formula* Formula::getBeta2() { if (this->isCompound()) { return this->formula2; } else if (this->nextFormula->getCntv() == '&') { Formula *next = this->nextFormula; return new Formula(next->getRight()); } else { Formula *next = this->nextFormula; return next->getRight(); } }
Formula* Formula::getAlpha2() { if (this->isCompound()) { return this->formula2; } else { Formula *next = this->nextFormula; return new Formula(next->getRight()); } }
/* * 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()); } }