diff options
author | Kristóf Marussy <marussy@mit.bme.hu> | 2023-09-14 19:29:36 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 19:29:36 +0200 |
commit | 98ed3b6db5f4e51961a161050cc31c66015116e8 (patch) | |
tree | 8bfd6d9bc8d6ed23b9eb0f889dd40b6c24fe8f92 /subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java | |
parent | Merge pull request #38 from nagilooh/design-space-exploration (diff) | |
parent | Merge remote-tracking branch 'upstream/main' into partial-interpretation (diff) | |
download | refinery-98ed3b6db5f4e51961a161050cc31c66015116e8.tar.gz refinery-98ed3b6db5f4e51961a161050cc31c66015116e8.tar.zst refinery-98ed3b6db5f4e51961a161050cc31c66015116e8.zip |
Merge pull request #39 from kris7t/partial-interpretation
Implement partial interpretation based model generation
Diffstat (limited to 'subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java')
-rw-r--r-- | subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java new file mode 100644 index 00000000..eca8bc17 --- /dev/null +++ b/subprojects/viatra-runtime-rete/src/main/java/tools/refinery/viatra/runtime/rete/single/DefaultProductionNode.java | |||
@@ -0,0 +1,79 @@ | |||
1 | /******************************************************************************* | ||
2 | * Copyright (c) 2004-2008 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.rete.single; | ||
11 | |||
12 | import java.util.Iterator; | ||
13 | import java.util.Map; | ||
14 | |||
15 | import tools.refinery.viatra.runtime.matchers.context.IPosetComparator; | ||
16 | import tools.refinery.viatra.runtime.matchers.tuple.Tuple; | ||
17 | import tools.refinery.viatra.runtime.matchers.tuple.TupleMask; | ||
18 | import tools.refinery.viatra.runtime.rete.network.ProductionNode; | ||
19 | import tools.refinery.viatra.runtime.rete.network.ReteContainer; | ||
20 | import tools.refinery.viatra.runtime.rete.traceability.CompiledQuery; | ||
21 | import tools.refinery.viatra.runtime.rete.traceability.TraceInfo; | ||
22 | |||
23 | /** | ||
24 | * Default implementation of the Production node, based on UniquenessEnforcerNode | ||
25 | * | ||
26 | * @author Gabor Bergmann | ||
27 | * @noinstantiate This class is not intended to be instantiated by clients. | ||
28 | */ | ||
29 | public class DefaultProductionNode extends UniquenessEnforcerNode implements ProductionNode { | ||
30 | |||
31 | protected final Map<String, Integer> posMapping; | ||
32 | |||
33 | /** | ||
34 | * @since 1.6 | ||
35 | */ | ||
36 | public DefaultProductionNode(final ReteContainer reteContainer, final Map<String, Integer> posMapping, | ||
37 | final boolean deleteRederiveEvaluation) { | ||
38 | this(reteContainer, posMapping, deleteRederiveEvaluation, null, null, null); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * @since 1.6 | ||
43 | */ | ||
44 | public DefaultProductionNode(final ReteContainer reteContainer, final Map<String, Integer> posMapping, | ||
45 | final boolean deleteRederiveEvaluation, final TupleMask coreMask, final TupleMask posetMask, | ||
46 | final IPosetComparator posetComparator) { | ||
47 | super(reteContainer, posMapping.size(), deleteRederiveEvaluation, coreMask, posetMask, posetComparator); | ||
48 | this.posMapping = posMapping; | ||
49 | } | ||
50 | |||
51 | @Override | ||
52 | public Map<String, Integer> getPosMapping() { | ||
53 | return posMapping; | ||
54 | } | ||
55 | |||
56 | @Override | ||
57 | public Iterator<Tuple> iterator() { | ||
58 | return memory.iterator(); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | public void acceptPropagatedTraceInfo(final TraceInfo traceInfo) { | ||
63 | if (traceInfo.propagateToProductionNodeParentAlso()) { | ||
64 | super.acceptPropagatedTraceInfo(traceInfo); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | @Override | ||
69 | public String toString() { | ||
70 | for (final TraceInfo traceInfo : this.traceInfos) { | ||
71 | if (traceInfo instanceof CompiledQuery) { | ||
72 | final String patternName = ((CompiledQuery) traceInfo).getPatternName(); | ||
73 | return String.format(this.getClass().getName() + "<%s>=%s", patternName, super.toString()); | ||
74 | } | ||
75 | } | ||
76 | return super.toString(); | ||
77 | } | ||
78 | |||
79 | } | ||