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


C++ AbstractNode::getType方法代码示例

本文整理汇总了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);
}
开发者ID:anubhab91,项目名称:sat-cnf-converter,代码行数:32,代码来源:abstractnode.cpp

示例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;
}
开发者ID:anubhab91,项目名称:sat-cnf-converter,代码行数:16,代码来源:abstractnode.cpp

示例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;
}
开发者ID:anubhab91,项目名称:sat-cnf-converter,代码行数:16,代码来源:abstractnode.cpp


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