From 4efec693df043c0507bdf2829db2759d13dcc78c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krist=C3=B3f=20Marussy?= Date: Fri, 28 Jun 2024 18:01:40 +0200 Subject: [PATCH] refactor(reasoning): fix Sonar warnings --- .../reasoning/internal/ReasoningBuilderImpl.java | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java index 87122b1d1..250082c2a 100644 --- a/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java +++ b/subprojects/store-reasoning/src/main/java/tools/refinery/store/reasoning/internal/ReasoningBuilderImpl.java @@ -5,6 +5,10 @@ */ package tools.refinery.store.reasoning.internal; +import tools.refinery.logic.dnf.Dnf; +import tools.refinery.logic.dnf.FunctionalQuery; +import tools.refinery.logic.dnf.Query; +import tools.refinery.logic.dnf.RelationalQuery; import tools.refinery.store.adapter.AbstractModelAdapterBuilder; import tools.refinery.store.dse.transition.DesignSpaceExplorationBuilder; import tools.refinery.store.dse.transition.objectives.Objective; @@ -12,11 +16,8 @@ import tools.refinery.store.model.ModelStore; import tools.refinery.store.model.ModelStoreBuilder; import tools.refinery.store.query.ModelQueryBuilder; -import tools.refinery.logic.dnf.Dnf; -import tools.refinery.logic.dnf.FunctionalQuery; -import tools.refinery.logic.dnf.Query; -import tools.refinery.logic.dnf.RelationalQuery; import tools.refinery.store.reasoning.ReasoningBuilder; +import tools.refinery.store.reasoning.ReasoningStoreAdapter; import tools.refinery.store.reasoning.interpretation.PartialInterpretation; import tools.refinery.store.reasoning.lifting.DnfLifter; import tools.refinery.store.reasoning.literal.Concreteness; @@ -34,7 +35,7 @@ import java.util.*; -public class ReasoningBuilderImpl extends AbstractModelAdapterBuilder +public class ReasoningBuilderImpl extends AbstractModelAdapterBuilder implements ReasoningBuilder { private final DnfLifter lifter = new DnfLifter(); private final PartialQueryRewriter queryRewriter = new PartialQueryRewriter(lifter); @@ -143,7 +144,7 @@ private void doConfigure(ModelStoreBuilder storeBuilder, PartialRelationTranslat } @Override - public ReasoningStoreAdapterImpl doBuild(ModelStore store) { + public ReasoningStoreAdapter doBuild(ModelStore store) { return new ReasoningStoreAdapterImpl(store, requiredInterpretations, Collections.unmodifiableMap(symbolInterpreters), Collections.unmodifiableMap(symbolRefiners), getStorageRefiners(store), Collections.unmodifiableList(initializers)); @@ -151,7 +152,7 @@ public ReasoningStoreAdapterImpl doBuild(ModelStore store) { private Map> getStorageRefiners(ModelStore store) { var symbols = store.getSymbols(); - var storageRefiners = new LinkedHashMap>(symbols.size()); + var storageRefiners = HashMap.>newHashMap(symbols.size()); for (var symbol : symbols) { var refiner = registeredStorageRefiners.remove(symbol); if (refiner == null) {