mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: BinaryPredicate -> AndPredicate
This commit is contained in:
+1
-1
@@ -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));
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -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;
|
||||
|
||||
|
||||
+3
-12
@@ -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() {
|
||||
Reference in New Issue
Block a user