/** * Returns a canonical expression that is fully contained by the symbolScope and that is equivalent * to the specified expression. Returns null if unable to to find a canonical. */ @VisibleForTesting Expression getScopedCanonical(Expression expression, Predicate<Symbol> symbolScope) { Expression canonicalIndex = canonicalMap.get(expression); if (canonicalIndex == null) { return null; } return getCanonical(filter(equalitySets.get(canonicalIndex), symbolToExpressionPredicate(symbolScope))); }
Expression matchingCanonical = getCanonical(scopeExpressions); if (scopeExpressions.size() >= 2) { for (Expression expression : filter(scopeExpressions, not(equalTo(matchingCanonical)))) { Expression complementCanonical = getCanonical(scopeComplementExpressions); if (scopeComplementExpressions.size() >= 2) { for (Expression expression : filter(scopeComplementExpressions, not(equalTo(complementCanonical)))) { connectingExpressions.addAll(scopeStraddlingExpressions); connectingExpressions = ImmutableList.copyOf(filter(connectingExpressions, Predicates.notNull())); Expression connectingCanonical = getCanonical(connectingExpressions); if (connectingCanonical != null) { for (Expression expression : filter(connectingExpressions, not(equalTo(connectingCanonical)))) {
/** * Returns a canonical expression that is fully contained by the symbolScope and that is equivalent * to the specified expression. Returns null if unable to to find a canonical. */ @VisibleForTesting Expression getScopedCanonical(Expression expression, Predicate<Symbol> symbolScope) { Expression canonicalIndex = canonicalMap.get(expression); if (canonicalIndex == null) { return null; } return getCanonical(filter(equalitySets.get(canonicalIndex), symbolToExpressionPredicate(symbolScope))); }
Expression matchingCanonical = getCanonical(scopeExpressions); if (scopeExpressions.size() >= 2) { for (Expression expression : filter(scopeExpressions, not(equalTo(matchingCanonical)))) { Expression complementCanonical = getCanonical(scopeComplementExpressions); if (scopeComplementExpressions.size() >= 2) { for (Expression expression : filter(scopeComplementExpressions, not(equalTo(complementCanonical)))) { connectingExpressions.addAll(scopeStraddlingExpressions); connectingExpressions = ImmutableList.copyOf(filter(connectingExpressions, Predicates.notNull())); Expression connectingCanonical = getCanonical(connectingExpressions); if (connectingCanonical != null) { for (Expression expression : filter(connectingExpressions, not(equalTo(connectingCanonical)))) {