本文整理匯總了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());
}
}