本文整理汇总了Java中ap.parser.IExpression.toString方法的典型用法代码示例。如果您正苦于以下问题:Java IExpression.toString方法的具体用法?Java IExpression.toString怎么用?Java IExpression.toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ap.parser.IExpression
的用法示例。
在下文中一共展示了IExpression.toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getName
import ap.parser.IExpression; //导入方法依赖的package包/类
private static String getName(IExpression var) {
if (var instanceof IAtom) {
return ((IAtom) var).pred().name();
} else if (var instanceof IConstant) {
return var.toString();
} else if (var instanceof IFunApp) {
String fullStr = ((IFunApp) var).fun().toString();
return fullStr.substring(0, fullStr.indexOf('/'));
}
throw new IllegalArgumentException("The given parameter is no variable or function");
}
示例2: getName
import ap.parser.IExpression; //导入方法依赖的package包/类
private String getName(IExpression input) {
if (input instanceof IAtom || input instanceof IConstant) {
return input.toString();
} else if (input instanceof IBinFormula) {
return ((IBinFormula) input).j().toString();
} else if (input instanceof IFormulaITE || input instanceof ITermITE) {
// in princess ite representation is the complete formula which we do not want here
return "ite";
} else if (input instanceof IIntFormula) {
return ((IIntFormula) input).rel().toString();
} else if (input instanceof INot) {
// in princess not representation is the complete formula which we do not want here
return "not";
} else if (input instanceof IFunApp) {
return ((IFunApp) input).fun().name();
} else if (input instanceof IPlus) {
// in princess plus representation is the complete formula which we do not want here
return "+";
} else if (input instanceof ITimes) {
// in princess times representation is the complete formula which we do not want here
return "*";
} else if (input instanceof IEpsilon) {
// in princess epsilon representation is the complete formula which we do not want here
return "eps";
} else {
throw new AssertionError("Unhandled type " + input.getClass());
}
}