本文整理汇总了C++中Formula::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ Formula::getNext方法的具体用法?C++ Formula::getNext怎么用?C++ Formula::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formula
的用法示例。
在下文中一共展示了Formula::getNext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
/*
* 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());
}
}
示例2: expand
//.........这里部分代码省略.........
Formula *f1 = f->getAlpha1();
Formula *f2 = f->getAlpha2();
q.push(f1);
q.push(f2);
return expand(q, depth, tabCount);
}
else if (f->isBeta()) {
//printf("Applying beta rule for..");
//f->print();
//puts("");
this->printTab(tabCount+2);
printf("|beta (%d)\n", i + 1);
Formula *f1 = f->getBeta1();
Formula *f2 = f->getBeta2();
queue<Formula*> q2(q);
q.push(f1);
q2.push(f2);
return expand(q, depth, tabCount-4) && expand(q2, depth, tabCount+4);
}
else if (f->isGamma()) {
//printf("Applying gamma rule for..");
//f->print();
//puts("");
this->printTab(tabCount+2);
printf("|gamma (%d)\n", i + 1);
depth--;
Formula *cpy = NULL;
if (depth > 0) {
cpy = new Formula(*f);
//printf("\n\ncopy formula1======\n");
//cpy->print();
}
Term *newVar = new Term(Term::VAR, NULL);
Formula *newFormula;
newFormula = f->getGamma(newVar);
//printf("got this..");
//newFormula->print();
//puts("");
q.push(newFormula);
if (cpy != NULL) {
q.push(cpy);
//printf("\n\ncopy formula2======\n");
//cpy->print();
}
return expand(q, depth, tabCount);
}
else if (f->isDelta()) {
//printf("Applying delta rule for..");
//f->print();
//puts("");
this->printTab(tabCount + 2);
printf("delta (%d)\n", i + 1);
Formula *newFormula;
newFormula = f->getDelta();
//printf("got this..");
//newFormula->print();
//puts("");
q.push(newFormula);
return expand(q, depth, tabCount);
}
else if (f->isNegated()) {
if (f->getNext()->isAtomic()) {
q.push(f);
}
else if(f->getNext()->isNegated()) {
//printf("Applying alpha rule for..");
//f->print();
//puts("");
this->printTab(tabCount + 2);
printf("alpha (%d)\n", i + 1);
q.push(f->getNext()->getNext());
return expand(q, depth, tabCount);
}
}
}
bool b = this->isClosed(q, tabCount);
//if (b) printf("A closed branch..\n");
//else printf("An open branch..\n");
//if (b) this->print(q, tabCount);
return b;
}