本文整理匯總了Java中com.sri.ai.expresso.helper.Expressions.makeFromSyntaxTree方法的典型用法代碼示例。如果您正苦於以下問題:Java Expressions.makeFromSyntaxTree方法的具體用法?Java Expressions.makeFromSyntaxTree怎麽用?Java Expressions.makeFromSyntaxTree使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.sri.ai.expresso.helper.Expressions
的用法示例。
在下文中一共展示了Expressions.makeFromSyntaxTree方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: standardizeApartIntensionalSets
import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
public static IntensionalSet standardizeApartIntensionalSets(IntensionalSet intensionalSet, IntensionalSet fromOtherIntensionalSet, Context context) {
IntensionalSet result = intensionalSet;
IndexExpressionsSet intensionalSetIndexes = intensionalSet.getIndexExpressions();
IndexExpressionsSet fromOtherIntensionalSetIn = fromOtherIntensionalSet.getIndexExpressions();
List<Expression> overlappingIndexNames = new ArrayList<>();
for (Expression intensionalSetIndex : IndexExpressions.getIndices(intensionalSetIndexes)) {
if (IndexExpressions.indexExpressionsContainIndex(fromOtherIntensionalSetIn, intensionalSetIndex)) {
overlappingIndexNames.add(intensionalSetIndex);
}
}
if (overlappingIndexNames.size() > 0) {
Expression combinedExpression = And.make(intensionalSet, fromOtherIntensionalSet);
List<Expression> newIndexNames = new ArrayList<>();
for (Expression overlappingIndex : overlappingIndexNames) {
Expression newIndexName = Expressions.makeUniqueVariable(overlappingIndex.toString(), combinedExpression, context);
newIndexNames.add(newIndexName);
}
SyntaxTree resultSyntaxTree = result.getSyntaxTree();
for (int i = 0; i < newIndexNames.size(); i++) {
Expression replaced = overlappingIndexNames.get(i);
Expression replacement = newIndexNames.get(i);
resultSyntaxTree = resultSyntaxTree.replaceSubTreesAllOccurrences(replaced.getSyntaxTree(), replacement.getSyntaxTree());
}
result = (IntensionalSet) Expressions.makeFromSyntaxTree(resultSyntaxTree);
}
return result;
}
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:32,代碼來源:IntersectionIntensionalSetsSimplifier.java
示例2: getIndexExpression
import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
public static Expression getIndexExpression(Expression expression) {
Expression result = Expressions.makeFromSyntaxTree(expression.getSyntaxTree().getSubTree(0));
return result;
}
示例3: getBody
import com.sri.ai.expresso.helper.Expressions; //導入方法依賴的package包/類
public static Expression getBody(Expression expression) {
Expression result = Expressions.makeFromSyntaxTree(expression.getSyntaxTree().getSubTree(1));
return result;
}