本文整理汇总了Java中com.sri.ai.util.Util.zipWith方法的典型用法代码示例。如果您正苦于以下问题:Java Util.zipWith方法的具体用法?Java Util.zipWith怎么用?Java Util.zipWith使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sri.ai.util.Util
的用法示例。
在下文中一共展示了Util.zipWith方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: UnificationStepSolver
import com.sri.ai.util.Util; //导入方法依赖的package包/类
public UnificationStepSolver(Expression expression1, Expression expression2) {
if (expression1.equals(expression2)) { // Check for simple literal equality up front.
precomputedResult = new StepSolver.Solution<Boolean>(Boolean.TRUE);
}
else if (Expressions.isFunctionApplicationWithArguments(expression1) &&
Expressions.isFunctionApplicationWithArguments(expression2) &&
expression1.numberOfArguments() == expression2.numberOfArguments() &&
expression1.getFunctor().equals(expression2.getFunctor())) {
unificationEqualitiesToTest = Util.zipWith(
(matchingArgFrom1, matchingArgFrom2) -> Equality.make(matchingArgFrom1, matchingArgFrom2),
expression1.getArguments(), expression2.getArguments());
}
else if (Expressions.isSymbol(expression1) && Expressions.isSymbol(expression2)) {
unificationEqualitiesToTest = Arrays.asList(Equality.make(expression1, expression2));
}
else {
precomputedResult = new StepSolver.Solution<Boolean>(Boolean.FALSE);
}
if (unificationEqualitiesToTest != null) {
unknownSolutionIndexesForUnificationEqualities =
IntStream.range(0, unificationEqualitiesToTest.size())
.boxed()
.collect(Collectors.toList());
}
}
示例2: listOfDisequalitiesOfSubExpressions
import com.sri.ai.util.Util; //导入方法依赖的package包/类
public static List<Expression> listOfDisequalitiesOfSubExpressions(
Expression expression1, Expression expression2) {
List<Expression> conditionsForSubExpressionsToBeDistinct = Util
.zipWith(MAKE_PAIR_DISEQUALITY, Util.listFrom(expression1
.getImmediateSubExpressionsIterator()), Util
.listFrom(expression2
.getImmediateSubExpressionsIterator()));
return conditionsForSubExpressionsToBeDistinct;
}
示例3: listOfEqualitiesOfSubExpressions
import com.sri.ai.util.Util; //导入方法依赖的package包/类
public static List<Expression> listOfEqualitiesOfSubExpressions(
Expression expression1, Expression expression2) {
List<Expression> conditionsForSubExpressionsToBeEqual =
Util.zipWith(
MAKE_PAIR_EQUALITY,
Util.listFrom(expression1.getImmediateSubExpressionsIterator()),
Util.listFrom(expression2.getImmediateSubExpressionsIterator()));
return conditionsForSubExpressionsToBeEqual;
}
示例4: simplify
import com.sri.ai.util.Util; //导入方法依赖的package包/类
public static Expression simplify(Expression expression, Context context) {
Expression result = expression;
if (Equality.isEquality(expression) && expression.numberOfArguments() == 2) {
Expression leftHS = expression.get(0);
Expression rightHS = expression.get(1);
// If we have: (t_1,...,t_n) = (r_1,...,r_n)
if (Tuple.isTuple(leftHS) && Tuple.isTuple(rightHS) && leftHS.numberOfArguments() == rightHS.numberOfArguments()) {
// Then we want to rewrite it as:
// t_1 = r_1 and ... and t_n = r_n
List<Expression> conjuncts = Util.zipWith((tn, rn) -> Equality.make(tn, rn), leftHS.getArguments(), rightHS.getArguments());
result = And.make(conjuncts);
}
}
return result;
}
示例5: simplify
import com.sri.ai.util.Util; //导入方法依赖的package包/类
public static Expression simplify(Expression expression, Context context) {
Expression result = expression;
if (Disequality.isDisequality(expression) && expression.numberOfArguments() == 2) {
Expression leftHS = expression.get(0);
Expression rightHS = expression.get(1);
// If we have: (t_1,...,t_n) != (r_1,...,r_n)
if (Tuple.isTuple(leftHS) && Tuple.isTuple(rightHS) && leftHS.numberOfArguments() == rightHS.numberOfArguments()) {
// Then we want to rewrite it as:
// t_1 != r_1 or ... or t_n != r_n
List<Expression> disjuncts = Util.zipWith((tn, rn) -> Disequality.make(tn, rn), leftHS.getArguments(), rightHS.getArguments());
result = Or.make(disjuncts);
}
}
return result;
}