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


C++ Sentence::getTypeCode方法代码示例

本文整理汇总了C++中Sentence::getTypeCode方法的典型用法代码示例。如果您正苦于以下问题:C++ Sentence::getTypeCode方法的具体用法?C++ Sentence::getTypeCode怎么用?C++ Sentence::getTypeCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sentence的用法示例。


在下文中一共展示了Sentence::getTypeCode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: isPELCNFLiteral

bool isPELCNFLiteral(const Sentence& sentence) {
    if (sentence.getTypeCode() == Atom::TypeCode
            || sentence.getTypeCode() == BoolLit::TypeCode
            || sentence.getTypeCode() == LiquidOp::TypeCode) {
        return true;
    }
    if (sentence.getTypeCode() == Negation::TypeCode) {
        const Negation& neg = static_cast<const Negation&>(sentence);

        // TODO: necessary to check for double negation?
        if (neg.sentence()->getTypeCode() == Negation::TypeCode) return false;
        return isPELCNFLiteral(*neg.sentence());
    }
    if (sentence.getTypeCode() == DiamondOp::TypeCode) {
        const DiamondOp& dia = static_cast<const DiamondOp&>(sentence);
        if (       dia.sentence()->getTypeCode()    == Atom::TypeCode
                || dia.sentence()->getTypeCode()    == BoolLit::TypeCode
                || dia.sentence()->getTypeCode()    == LiquidOp::TypeCode) {  // TODO add liquidop
            return true;
        }
        return false;
    }
    if (sentence.getTypeCode() == Conjunction::TypeCode) {
        const Conjunction& con = static_cast<const Conjunction&>(sentence);
        if ((con.left()->getTypeCode() == Atom::TypeCode
                || con.left()->getTypeCode() == BoolLit::TypeCode)
              && (con.right()->getTypeCode() == Atom::TypeCode
                || con.right()->getTypeCode() == BoolLit::TypeCode)) {
            return true;
        }
        return false;
    }

    return false;
}
开发者ID:selmanj,项目名称:repel,代码行数:35,代码来源:Sentence.cpp

示例2: isSimpleLiteral

bool isSimpleLiteral(const Sentence& lit) {
    if (lit.getTypeCode() == Atom::TypeCode) return true;
    if (lit.getTypeCode() == Negation::TypeCode) {
        const Negation& neg = static_cast<const Negation&>(lit);
        if (neg.sentence()->getTypeCode() == Atom::TypeCode) return true;
    }
    return false;
}
开发者ID:selmanj,项目名称:repel,代码行数:8,代码来源:Sentence.cpp

示例3: isDisjunctionOfPELCNFLiterals

bool isDisjunctionOfPELCNFLiterals(const Sentence& s) {
    if (s.getTypeCode() != Disjunction::TypeCode) return false;
    const Disjunction& dis = static_cast<const Disjunction&>(s);

    if ((isPELCNFLiteral(*dis.left()) || isDisjunctionOfPELCNFLiterals(*dis.left()))
            && (isPELCNFLiteral(*dis.right()) || isDisjunctionOfPELCNFLiterals(*dis.right()))) {
        return true;
    }
    return false;
}
开发者ID:selmanj,项目名称:repel,代码行数:10,代码来源:Sentence.cpp


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