本文整理汇总了C++中Formula::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ Formula::getType方法的具体用法?C++ Formula::getType怎么用?C++ Formula::getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Formula
的用法示例。
在下文中一共展示了Formula::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: equalTo
bool equalTo( const Formula & f) const
{
return f->getType() == this->getType() &&
_op1->equalTo(((BinaryConjective *)f.get())->getOperand1())
&&
_op2->equalTo(((BinaryConjective *)f.get())->getOperand2());
}
示例2: 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());
}
}
示例3: orEClicked
void MainWindow::orEClicked()
{
QList<QGraphicsItem *> selected_list = scene->selectedItems();
Node* selected = (Node*)(selected_list.at(0));
selected->setRule("orE");
selected->update();
int rect_x;
int rect_y;
bool ok;
while(1){
QString tekst = QInputDialog::getText(this, tr("QInputDialog::getText()"),
tr("Unesite formulu:"), QLineEdit::Normal,
QDir::home().dirName(), &ok);
if (ok && !tekst.isEmpty()){
qDebug() << "radi";
}
std::string formula = tekst.toUtf8().constData();
formula += " ;";
std::ostringstream stream;
qDebug() << QString::fromStdString(formula);
YY_BUFFER_STATE buffer = yy_scan_string(formula.c_str());
if(yyparse() == 1){
qDebug() << "Pa to ti ne radi";
}
if(parsed_formula->getType() == BaseFormula::T_OR){
break;
}
}
std::ostringstream stream;
parsed_formula->printFormula(stream);
qreal rect_width = stream.str().length()*PARAMETER;
qreal rect_height = 20;
rect_x = selected->getx() - 20 - depth/2;
rect_y = selected->gety() - 20 - depth/2;
QVector<Formula> assumptions = selected->getAssumptions();
assumptions.push_back(parsed_formula);
Node* item3 = new Node( parsed_formula, rect_width, rect_height, rect_x, rect_y, selected_list.at(0), assumptions);
scene->addNode(item3);
Formula op1 = ((Or*)parsed_formula.get())->getOperand1();
Formula op2 = ((Or*)parsed_formula.get())->getOperand2();
rect_x = selected->getx() + 25 + depth/2;
rect_y = selected->gety() - 20 - depth/2;
assumptions.push_back(op1);
assumptions.push_back(op2);
op1->printFormula(stream);
rect_width = stream.str().length()*PARAMETER;
Node* item1 = new Node( selected->getFormula(), rect_width, rect_height, rect_x, rect_y, selected_list.at(0), assumptions);
scene->addNode(item1);
rect_x = selected->getx() + 50 + depth/2;
rect_y = selected->gety() - 20 - depth/2;
op2->printFormula(stream);
rect_width = stream.str().length()*PARAMETER;
Node* item2 = new Node(selected->getFormula(), rect_width, rect_height, rect_x, rect_y, selected_list.at(0), assumptions);
scene->addNode(item2);
}