本文整理汇总了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;
}
示例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;
}
示例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;
}