本文整理汇总了C++中AbstractNode::getType方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractNode::getType方法的具体用法?C++ AbstractNode::getType怎么用?C++ AbstractNode::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractNode
的用法示例。
在下文中一共展示了AbstractNode::getType方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isDisjunctionOfComplexConjunctions
bool AbstractNode::isDisjunctionOfComplexConjunctions()
{
if(AbstractNode::TYPE_OPERATION_OR != getType())
return false; //not a disjunction
int numOperations = 0;
ChainIterator<AbstractNode*> *iterator = children->getIterator();
while(true == iterator->hasNext()) {
AbstractNode *child = iterator->next(); //Get an element which might be conjunction
//Disjunction contains elements which are not parts of conjunction
if(!((AbstractNode::TYPE_VARIABLE == child->getType()) ||
(AbstractNode::TYPE_OPERATION_AND == child->getType()) ||
(AbstractNode::TYPE_OPERATION_NOT == child->getType()))) {
return false;
}
if(AbstractNode::TYPE_OPERATION_AND == child->getType()) {
if(child->getChildren()->getSize() > 1)
numOperations++;
}
if(AbstractNode::TYPE_OPERATION_NOT == child->getType()) {
AbstractNode *grandChild = child->getChildren()->getFirstElement();
if(AbstractNode::TYPE_VARIABLE != grandChild->getType()) {
return false; //Contains complex NOT operation
}
}
}
return (numOperations > 0);
}
示例2: consistsFromSimpleElements
bool AbstractNode::consistsFromSimpleElements()
{
ChainIterator<AbstractNode*> *iterator = children->getIterator();
while(true == iterator->hasNext()) {
AbstractNode *child = iterator->next();
if(AbstractNode::TYPE_VARIABLE == child->getType())
continue;
if(AbstractNode::TYPE_OPERATION_NOT == child->getType()) {
AbstractNode *notChild = child->getChildren()->getFirstElement();
if(AbstractNode::TYPE_VARIABLE == notChild->getType())
continue;
}
return false;
}
return true;
}
示例3: isSingleVariable
bool AbstractNode::isSingleVariable(){
if(!(AbstractNode::TYPE_VARIABLE == getType() ||
AbstractNode::TYPE_OPERATION_NOT == getType()))
return false;
AbstractNode *var = NULL;
if(AbstractNode::TYPE_VARIABLE == getType()) {
var = this;
} else if(AbstractNode::TYPE_OPERATION_NOT == getType()) {
var = children->getFirstElement();
}
if(AbstractNode::TYPE_VARIABLE == var->getType())
return true;
return false;
}