diff options
Diffstat (limited to 'subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java')
-rw-r--r-- | subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java new file mode 100644 index 00000000..ae2c4632 --- /dev/null +++ b/subprojects/viatra-runtime/src/main/java/tools/refinery/viatra/runtime/matchers/psystem/PConstraint.java | |||
@@ -0,0 +1,70 @@ | |||
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.Comparator; | ||
13 | import java.util.Map; | ||
14 | import java.util.Set; | ||
15 | |||
16 | import tools.refinery.viatra.runtime.matchers.context.IQueryMetaContext; | ||
17 | import tools.refinery.viatra.runtime.matchers.psystem.analysis.QueryAnalyzer; | ||
18 | |||
19 | /** | ||
20 | * @author Gabor Bergmann | ||
21 | * | ||
22 | */ | ||
23 | public interface PConstraint extends PTraceable { | ||
24 | |||
25 | /** | ||
26 | * @since 2.1 | ||
27 | * @return the query body this constraint belongs to | ||
28 | */ | ||
29 | public PBody getBody(); | ||
30 | |||
31 | /** | ||
32 | * All variables affected by this constraint. | ||
33 | */ | ||
34 | public Set<PVariable> getAffectedVariables(); | ||
35 | |||
36 | /** | ||
37 | * The set of variables whose potential values can be enumerated (once all non-deduced variables have known values). | ||
38 | */ | ||
39 | public Set<PVariable> getDeducedVariables(); | ||
40 | |||
41 | /** | ||
42 | * A (preferably minimal) cover of known functional dependencies between variables. | ||
43 | * @noreference Use {@link QueryAnalyzer} instead to properly handle dependencies of pattern calls. | ||
44 | * @return non-trivial functional dependencies in the form of {variables} --> {variables}, where dependencies with the same lhs are unified. | ||
45 | */ | ||
46 | public Map<Set<PVariable>,Set<PVariable>> getFunctionalDependencies(IQueryMetaContext context); | ||
47 | |||
48 | public void replaceVariable(PVariable obsolete, PVariable replacement); | ||
49 | |||
50 | public void delete(); | ||
51 | |||
52 | public void checkSanity(); | ||
53 | |||
54 | /** | ||
55 | * Returns an integer ID that is guaranteed to increase strictly monotonously for constraints within a pBody. | ||
56 | */ | ||
57 | public abstract int getMonotonousID(); | ||
58 | |||
59 | |||
60 | /** | ||
61 | * A comparator that orders constraints by their {@link #getMonotonousID() monotonous identifiers}. Should only used | ||
62 | * for tiebreaking in other comparators. | ||
63 | * | ||
64 | * @since 2.0 | ||
65 | */ | ||
66 | public static final Comparator<PConstraint> COMPARE_BY_MONOTONOUS_ID = (arg0, arg1) -> arg0.getMonotonousID() - arg1.getMonotonousID(); | ||
67 | |||
68 | |||
69 | |||
70 | } | ||