diff options
| author | Zoltan Ujhelyi | 2017-06-28 09:04:54 +0000 |
|---|---|---|
| committer | Zoltan Ujhelyi | 2017-07-03 06:48:14 +0000 |
| commit | 12e528ca5bafeb799cd193d05388697303c1d2b0 (patch) | |
| tree | e95f5ef507ca52d0cf7253ee3aa76fa4f25f19e7 | |
| parent | 16aec8923395024c5e0b42761c7578632c934e33 (diff) | |
| download | org.eclipse.viatra-12e528ca5bafeb799cd193d05388697303c1d2b0.tar.gz org.eclipse.viatra-12e528ca5bafeb799cd193d05388697303c1d2b0.tar.xz org.eclipse.viatra-12e528ca5bafeb799cd193d05388697303c1d2b0.zip | |
[469149] Refactored check operations to have context access
Change-Id: I21072780dd3e8a42b03f4cd12281e1f94c59d924
Signed-off-by: Zoltan Ujhelyi <ujhelyiz@incquerylabs.com>
17 files changed, 178 insertions, 32 deletions
diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/AggregatorCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/AggregatorCheck.java index b15ce07c9..d17b49d18 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/AggregatorCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/AggregatorCheck.java @@ -30,6 +30,7 @@ import com.google.common.collect.Lists; * * @author Balázs Grill * @since 1.4 + * @noextend This class is not intended to be subclassed by clients. */ public class AggregatorCheck extends CheckOperation{ @@ -55,8 +56,16 @@ public class AggregatorCheck extends CheckOperation{ call = helper.createCall(context); } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { Object result = call.aggregate(aggregator.getAggregator().getOperator(), aggregator.getAggregatedColumn(), frame); return result == null ? false : Objects.equals(frame.getValue(position), result); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java index a0b33d357..024db7143 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/BinaryTransitiveClosureCheck.java @@ -32,6 +32,7 @@ import com.google.common.collect.Lists; * parameters of the same model type. * * @author Zoltan Ujhelyi + * @noextend This class is not intended to be subclassed by clients. * */ public class BinaryTransitiveClosureCheck extends CheckOperation{ @@ -66,8 +67,16 @@ public class BinaryTransitiveClosureCheck extends CheckOperation{ call = helper.createCall(context); } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { Object targetValue = frame.get(targetPosition); Queue<Object> sourcesToEvaluate = new LinkedList<>(); sourcesToEvaluate.add(frame.get(sourcePosition)); diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckConstant.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckConstant.java index 56580ae3a..b45f528ae 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckConstant.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckConstant.java @@ -14,6 +14,7 @@ import java.util.List; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.collect.Lists; @@ -22,7 +23,7 @@ import com.google.common.collect.Lists; * operations should be executed as early as possible during plan execution. * * @author Marton Bur - * + * @noextend This class is not intended to be subclassed by clients. */ public class CheckConstant extends CheckOperation { @@ -34,8 +35,16 @@ public class CheckConstant extends CheckOperation { this.value = value; } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { return frame.get(position).equals(value); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckOperation.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckOperation.java index 828264a25..4df0a43dd 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckOperation.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckOperation.java @@ -17,6 +17,8 @@ import org.eclipse.viatra.query.runtime.localsearch.operations.ISearchOperation; /** * Abstract base class for search operations that check only the already set variables. + * + * @noextend This class is not intended to be subclassed by clients. */ public abstract class CheckOperation implements ISearchOperation { @@ -37,16 +39,14 @@ public abstract class CheckOperation implements ISearchOperation { @Override public boolean execute(MatchingFrame frame, ISearchContext context) throws LocalSearchException { - executed = executed ? false : check(frame); + executed = executed ? false : check(frame, context); return executed; } /** * Executes the checking operation - * - * @param frame - * @return + * @since 1.7 */ - protected abstract boolean check(MatchingFrame frame) throws LocalSearchException; + protected abstract boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException; } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckPositivePatternCall.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckPositivePatternCall.java index de0056a7c..c679f0656 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckPositivePatternCall.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CheckPositivePatternCall.java @@ -24,7 +24,7 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; /** * @author Grill Balázs * @since 1.4 - * + * @noextend This class is not intended to be subclassed by clients. */ public class CheckPositivePatternCall extends CheckOperation { @@ -38,9 +38,17 @@ public class CheckPositivePatternCall extends CheckOperation { } /** - * @since 1.5 + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead */ + @Deprecated public boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + /** + * @since 1.5 + */ + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { return call.has(frame); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ContainmentCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ContainmentCheck.java index be5d96a90..69c10816d 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ContainmentCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ContainmentCheck.java @@ -17,11 +17,13 @@ import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.collect.Lists; /** * A simple operation that checks whether a {@link EStructuralFeature} connects two selected variables. + * @noextend This class is not intended to be subclassed by clients. */ public class ContainmentCheck extends CheckOperation { @@ -35,8 +37,16 @@ public class ContainmentCheck extends CheckOperation { this.transitive = transitive; } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { try { EObject child = (EObject) frame.getValue(childPosition); EObject container = (EObject)frame.getValue(containerPosition); diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CountCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CountCheck.java index 158495abf..158cc16ff 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CountCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/CountCheck.java @@ -27,6 +27,7 @@ import com.google.common.collect.Lists; * Calculates the count of matches for a called matcher * * @author Zoltan Ujhelyi + * @noextend This class is not intended to be subclassed by clients. */ public class CountCheck extends CheckOperation{ @@ -49,8 +50,16 @@ public class CountCheck extends CheckOperation{ call = helper.createCall(context); } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { int count = call.count(frame); return ((Integer)frame.getValue(position)) == count; } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionCheck.java index 86640c1da..c7ba87ce5 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionCheck.java @@ -16,6 +16,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import org.eclipse.viatra.query.runtime.localsearch.operations.MatchingFrameValueProvider; import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; @@ -24,7 +25,7 @@ import com.google.common.collect.Lists; /** * @author Zoltan Ujhelyi - * + * @noextend This class is not intended to be subclassed by clients. */ public class ExpressionCheck extends CheckOperation { @@ -37,8 +38,16 @@ public class ExpressionCheck extends CheckOperation { this.nameMap = nameMap; } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { try { boolean result = (Boolean) evaluator.evaluateExpression(new MatchingFrameValueProvider(frame, nameMap)); return result; diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionEvalCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionEvalCheck.java index 5a758129e..41ef609b5 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionEvalCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/ExpressionEvalCheck.java @@ -16,6 +16,7 @@ import java.util.Map; import org.apache.log4j.Logger; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import org.eclipse.viatra.query.runtime.localsearch.operations.MatchingFrameValueProvider; import org.eclipse.viatra.query.runtime.matchers.psystem.IExpressionEvaluator; import org.eclipse.viatra.query.runtime.util.ViatraQueryLoggingUtil; @@ -25,7 +26,7 @@ import com.google.common.collect.Lists; /** * @author Grill Balázs * @since 1.3 - * + * @noextend This class is not intended to be subclassed by clients. */ public class ExpressionEvalCheck extends CheckOperation { @@ -47,8 +48,16 @@ public class ExpressionEvalCheck extends CheckOperation { return variables; } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { try { Object result = evaluator.evaluateExpression(new MatchingFrameValueProvider(frame, nameMap)); if (result != null) { diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/FrameInitializationCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/FrameInitializationCheck.java index 5a14f6f94..ba2172e15 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/FrameInitializationCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/FrameInitializationCheck.java @@ -16,6 +16,7 @@ import java.util.List; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; /** * Initializes the {@link MatchingFrame} with the given key array. Can fail if non-equal @@ -23,15 +24,13 @@ import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchExcept * * @author Grill Balázs * @since 1.3 + * @noextend This class is not intended to be subclassed by clients. * */ public class FrameInitializationCheck extends CheckOperation { private final int[] parameterKeys; - /** - * - */ public FrameInitializationCheck(int[] parameterKeys) { this.parameterKeys = Arrays.copyOf(parameterKeys, parameterKeys.length); } @@ -41,8 +40,16 @@ public class FrameInitializationCheck extends CheckOperation { return Collections.emptyList(); } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { return frame.setKeys(this.parameterKeys); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InequalityCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InequalityCheck.java index 96bc1ae16..3dcc73483 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InequalityCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InequalityCheck.java @@ -14,12 +14,13 @@ import java.util.List; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.collect.Lists; /** * @author Zoltan Ujhelyi - * + * @noextend This class is not intended to be subclassed by clients. */ public class InequalityCheck extends CheckOperation { @@ -31,8 +32,16 @@ public class InequalityCheck extends CheckOperation { this.targetLocation = targetLocation; } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { Object source = frame.getValue(sourceLocation); Object target = frame.getValue(targetLocation); if (source == null) { diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfClassCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfClassCheck.java index d73d72a34..738e2f120 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfClassCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfClassCheck.java @@ -15,13 +15,15 @@ import java.util.List; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EObject; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; +import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; /** * @author Zoltan Ujhelyi - * + * @noextend This class is not intended to be subclassed by clients. */ public class InstanceOfClassCheck extends CheckOperation { @@ -34,8 +36,16 @@ public class InstanceOfClassCheck extends CheckOperation { } + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated + protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + @Override - protected boolean check(MatchingFrame frame) { + protected boolean check(MatchingFrame frame, ISearchContext context) { Preconditions.checkNotNull(frame.getValue(position), "Invalid plan, variable %s unbound", position); if (frame.getValue(position) instanceof EObject) { return clazz.isSuperTypeOf(((EObject) frame.getValue(position)).eClass()); diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfDataTypeCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfDataTypeCheck.java index 13d2f7858..407e7f948 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfDataTypeCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfDataTypeCheck.java @@ -14,13 +14,15 @@ import java.util.List; import org.eclipse.emf.ecore.EDataType; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; +import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; /** * @author Zoltan Ujhelyi - * + * @noextend This class is not intended to be subclassed by clients. */ public class InstanceOfDataTypeCheck extends CheckOperation { @@ -33,8 +35,16 @@ public class InstanceOfDataTypeCheck extends CheckOperation { } + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated + protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + @Override - protected boolean check(MatchingFrame frame) { + protected boolean check(MatchingFrame frame, ISearchContext context) { Preconditions.checkNotNull(frame.getValue(position), "Invalid plan, variable %s unbound", position); return dataType.isInstance(frame.getValue(position)); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfJavaClassCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfJavaClassCheck.java index f5ee86045..c06c772a5 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfJavaClassCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/InstanceOfJavaClassCheck.java @@ -13,6 +13,8 @@ package org.eclipse.viatra.query.runtime.localsearch.operations.check; import java.util.List; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; +import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; @@ -20,6 +22,7 @@ import com.google.common.collect.Lists; /** * @author Zoltan Ujhelyi * @since 1.4 + * @noextend This class is not intended to be subclassed by clients. */ public class InstanceOfJavaClassCheck extends CheckOperation { @@ -32,8 +35,16 @@ public class InstanceOfJavaClassCheck extends CheckOperation { } + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated + protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + @Override - protected boolean check(MatchingFrame frame) { + protected boolean check(MatchingFrame frame, ISearchContext context) { Preconditions.checkNotNull(frame.getValue(position), "Invalid plan, variable %s unbound", position); return clazz.isInstance(frame.getValue(position)); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/NACOperation.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/NACOperation.java index ce91b1719..b50dabf53 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/NACOperation.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/NACOperation.java @@ -23,7 +23,7 @@ import org.eclipse.viatra.query.runtime.matchers.psystem.queries.PParameter; /** * @author Zoltan Ujhelyi - * + * @noextend This class is not intended to be subclassed by clients. */ public class NACOperation extends CheckOperation { @@ -44,8 +44,15 @@ public class NACOperation extends CheckOperation { call = helper.createCall(context); } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame,ISearchContext)} instead + */ protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { return !call.has(frame); } diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/StructuralFeatureCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/StructuralFeatureCheck.java index 61a7d171a..5c6653702 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/StructuralFeatureCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/StructuralFeatureCheck.java @@ -17,12 +17,14 @@ import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import com.google.common.base.Preconditions; import com.google.common.collect.Lists; /** * A simple operation that checks whether a {@link EStructuralFeature} connects two selected variables. + * @noextend This class is not intended to be subclassed by clients. */ public class StructuralFeatureCheck extends CheckOperation { @@ -36,8 +38,16 @@ public class StructuralFeatureCheck extends CheckOperation { this.feature = feature; } - @Override + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + + @Override + protected boolean check(MatchingFrame frame, ISearchContext context) throws LocalSearchException { Preconditions.checkNotNull(frame.getValue(sourcePosition), "Invalid plan, variable %s unbound", sourcePosition); Preconditions.checkNotNull(frame.getValue(targetPosition), "Invalid plan, variable %s unbound", targetPosition); try { diff --git a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/nobase/ScopeCheck.java b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/nobase/ScopeCheck.java index e74b04498..68b581504 100644 --- a/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/nobase/ScopeCheck.java +++ b/query/plugins/org.eclipse.viatra.query.runtime.localsearch/src/org/eclipse/viatra/query/runtime/localsearch/operations/check/nobase/ScopeCheck.java @@ -17,6 +17,8 @@ import org.eclipse.emf.ecore.util.EcoreUtil; import org.eclipse.viatra.query.runtime.base.api.filters.IBaseIndexObjectFilter; import org.eclipse.viatra.query.runtime.emf.EMFScope; import org.eclipse.viatra.query.runtime.localsearch.MatchingFrame; +import org.eclipse.viatra.query.runtime.localsearch.exceptions.LocalSearchException; +import org.eclipse.viatra.query.runtime.localsearch.matcher.ISearchContext; import org.eclipse.viatra.query.runtime.localsearch.operations.check.CheckOperation; import com.google.common.base.Preconditions; @@ -39,8 +41,16 @@ public class ScopeCheck extends CheckOperation { } + /** + * @deprecated Use {@link #check(MatchingFrame, ISearchContext)} instead + */ + @Deprecated + protected boolean check(MatchingFrame frame) throws LocalSearchException { + return check(frame, null); + } + @Override - protected boolean check(MatchingFrame frame) { + protected boolean check(MatchingFrame frame, ISearchContext context) { Preconditions.checkNotNull(frame.getValue(position), "Invalid plan, variable %s unbound", position); Object value = frame.getValue(position); if(value instanceof EObject){ |
