diff options
Diffstat (limited to 'subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java')
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java new file mode 100644 index 00000000..8ea6bb93 --- /dev/null +++ b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/VariableDeferredPConstraint.java | |||
@@ -0,0 +1,40 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2004-2010 Gabor Bergmann and Daniel Varro | ||
3 | * This program and the accompanying materials are made available under the | ||
4 | * terms of the Eclipse Public License v. 2.0 which is available at | ||
5 | * http://www.eclipse.org/legal/epl-v20.html. | ||
6 | * | ||
7 | * SPDX-License-Identifier: EPL-2.0 | ||
8 | *******************************************************************************/ | ||
9 | |||
10 | package tools.refinery.viatra.runtime.matchers.psystem; | ||
11 | |||
12 | import java.util.Set; | ||
13 | |||
14 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | ||
15 | import tools.refinery.viatra.runtime.matchers.planning.SubPlan; | ||
16 | |||
17 | /** | ||
18 | * A kind of deferred constraint that can only be checked when a set of deferring variables are all present in a plan. | ||
19 | * | ||
20 | * @author Gabor Bergmann | ||
21 | * | ||
22 | */ | ||
23 | public abstract class VariableDeferredPConstraint extends DeferredPConstraint { | ||
24 | |||
25 | public VariableDeferredPConstraint(PBody pBody, | ||
26 | Set<PVariable> affectedVariables) { | ||
27 | super(pBody, affectedVariables); | ||
28 | } | ||
29 | |||
30 | public abstract Set<PVariable> getDeferringVariables(); | ||
31 | |||
32 | /** | ||
33 | * Refine further if needed | ||
34 | */ | ||
35 | @Override | ||
36 | public boolean isReadyAt(SubPlan plan, IQueryMetaContext context) { | ||
37 | return plan.getVisibleVariables().containsAll(getDeferringVariables()); | ||
38 | } | ||
39 | |||
40 | } | ||