diff options
Diffstat (limited to 'subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/rete/network/RefineryNodeFactoryExtensions.java')
-rw-r--r-- | subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/rete/network/RefineryNodeFactoryExtensions.java | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/rete/network/RefineryNodeFactoryExtensions.java b/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/rete/network/RefineryNodeFactoryExtensions.java deleted file mode 100644 index 82b63a55..00000000 --- a/subprojects/store-query-viatra/src/main/java/tools/refinery/store/query/viatra/internal/rete/network/RefineryNodeFactoryExtensions.java +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | /* | ||
2 | * SPDX-FileCopyrightText: 2023 The Refinery Authors <https://refinery.tools/> | ||
3 | * | ||
4 | * SPDX-License-Identifier: EPL-2.0 | ||
5 | */ | ||
6 | package tools.refinery.store.query.viatra.internal.rete.network; | ||
7 | |||
8 | import org.eclipse.viatra.query.runtime.rete.network.ReteContainer; | ||
9 | import org.eclipse.viatra.query.runtime.rete.network.Supplier; | ||
10 | import org.eclipse.viatra.query.runtime.rete.recipes.ReteNodeRecipe; | ||
11 | import org.eclipse.viatra.query.runtime.rete.traceability.TraceInfo; | ||
12 | import org.jetbrains.annotations.Nullable; | ||
13 | import tools.refinery.store.query.viatra.internal.rete.recipe.RepresentativeElectionRecipe; | ||
14 | |||
15 | public class RefineryNodeFactoryExtensions { | ||
16 | @Nullable | ||
17 | public Supplier createNode(ReteContainer reteContainer, ReteNodeRecipe recipe, TraceInfo... traces) { | ||
18 | var result = instantiateNode(reteContainer, recipe); | ||
19 | if (result == null) { | ||
20 | return null; | ||
21 | } | ||
22 | for (var traceInfo : traces) { | ||
23 | result.assignTraceInfo(traceInfo); | ||
24 | } | ||
25 | return result; | ||
26 | } | ||
27 | |||
28 | @Nullable | ||
29 | private Supplier instantiateNode(ReteContainer reteContainer, ReteNodeRecipe recipe) { | ||
30 | if (recipe instanceof RepresentativeElectionRecipe representativeElectionRecipe) { | ||
31 | return instantiateRepresentativeElectionNode(reteContainer, representativeElectionRecipe); | ||
32 | } | ||
33 | return null; | ||
34 | } | ||
35 | |||
36 | private Supplier instantiateRepresentativeElectionNode(ReteContainer reteContainer, | ||
37 | RepresentativeElectionRecipe recipe) { | ||
38 | RepresentativeElectionAlgorithm.Factory algorithmFactory = switch (recipe.getConnectivity()) { | ||
39 | case STRONG -> StronglyConnectedComponentAlgorithm::new; | ||
40 | case WEAK -> WeaklyConnectedComponentAlgorithm::new; | ||
41 | }; | ||
42 | return new RepresentativeElectionNode(reteContainer, algorithmFactory); | ||
43 | } | ||
44 | } | ||