diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java index 72a5792ac9ad..a95810201ee8 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/compiler/PatternCompiler.java @@ -521,7 +521,7 @@ public class PatternCompiler { if (handler.getPredicate()==null) { handler.setPredicate(predicate); } else { - handler.setPredicate(new BinaryPredicate(handler.getPredicate(), predicate, false)); + handler.setPredicate(new AndPredicate(handler.getPredicate(), predicate)); } } } \ No newline at end of file diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java index 0a5c054ca29a..01fc89353e6f 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/handlers/MatchingHandler.java @@ -24,7 +24,7 @@ import com.intellij.structuralsearch.impl.matcher.CompiledPattern; import com.intellij.structuralsearch.impl.matcher.MatchContext; import com.intellij.structuralsearch.impl.matcher.MatchResultImpl; import com.intellij.structuralsearch.impl.matcher.filters.DefaultFilter; -import com.intellij.structuralsearch.impl.matcher.predicates.BinaryPredicate; +import com.intellij.structuralsearch.impl.matcher.predicates.AndPredicate; import com.intellij.structuralsearch.impl.matcher.predicates.MatchPredicate; import com.intellij.structuralsearch.impl.matcher.predicates.NotPredicate; import com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate; @@ -132,8 +132,8 @@ public abstract class MatchingHandler { if (start==null) return null; if (start instanceof RegExpPredicate) return start; - if(start instanceof BinaryPredicate) { - BinaryPredicate binary = (BinaryPredicate)start; + if(start instanceof AndPredicate) { + AndPredicate binary = (AndPredicate)start; final MatchPredicate result = findRegExpPredicate(binary.getFirst()); if (result!=null) return result; diff --git a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AndPredicate.java similarity index 71% rename from platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java rename to platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AndPredicate.java index 107cbbabb702..76773b55bcaa 100644 --- a/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/BinaryPredicate.java +++ b/platform/structuralsearch/source/com/intellij/structuralsearch/impl/matcher/predicates/AndPredicate.java @@ -18,15 +18,13 @@ package com.intellij.structuralsearch.impl.matcher.predicates; import com.intellij.psi.PsiElement; import com.intellij.structuralsearch.impl.matcher.MatchContext; -public final class BinaryPredicate extends MatchPredicate { +public final class AndPredicate extends MatchPredicate { private final MatchPredicate first; private final MatchPredicate second; - private final boolean or; - public BinaryPredicate(MatchPredicate first, MatchPredicate second, boolean or) { + public AndPredicate(MatchPredicate first, MatchPredicate second) { this.first = first; this.second = second; - this.or = or; } @Override @@ -36,14 +34,7 @@ public final class BinaryPredicate extends MatchPredicate { @Override public boolean match(PsiElement patternNode, PsiElement matchedNode, int start, int end, MatchContext context) { - if (or) { - return first.match(patternNode, matchedNode, start, end, context) || - second.match(patternNode, matchedNode, start, end, context); - } - else { - return first.match(patternNode, matchedNode, start, end, context) && - second.match(patternNode, matchedNode, start, end, context); - } + return first.match(patternNode, matchedNode, start, end, context) && second.match(patternNode, matchedNode, start, end, context); } public MatchPredicate getFirst() {