當前位置: 首頁>>代碼示例>>Java>>正文


Java Expressions.makeFromSyntaxTree方法代碼示例

本文整理匯總了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;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:5,代碼來源:ThereExists.java

示例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;
}
 
開發者ID:aic-sri-international,項目名稱:aic-expresso,代碼行數:5,代碼來源:ThereExists.java


注:本文中的com.sri.ai.expresso.helper.Expressions.makeFromSyntaxTree方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。