当前位置: 首页>>代码示例>>C++>>正文


C++ Formula::getNext方法代码示例

本文整理汇总了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());
	}
}
开发者ID:syeedibnfaiz,项目名称:Fotableau,代码行数:26,代码来源:fotableau.cpp

示例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;
}
开发者ID:syeedibnfaiz,项目名称:Fotableau,代码行数:101,代码来源:fotableau.cpp


注:本文中的Formula::getNext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。