From 66d25ebe35306b9c9a33a5feab8061b33b28a03e Mon Sep 17 00:00:00 2001 From: Ralf Sieger Date: Wed, 4 Dec 2024 13:51:24 +0100 Subject: [PATCH] switched to Optional --- .../envdyn/api/entity/bn/BayesianNetwork.java | 3 ++- .../envdyn/api/entity/bn/DynamicBayesianNetwork.java | 3 ++- .../envdyn/api/tests/bn/BayesianModelTest.java | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java index 175a7b8..19a1e94 100644 --- a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java +++ b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/BayesianNetwork.java @@ -5,6 +5,7 @@ import java.util.LinkedHashSet; import java.util.List; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -162,7 +163,7 @@ public Double probability(List> inputs) { } @Override - public void init(ISeedProvider seedProvider) { + public void init(Optional seedProvider) { if (initialized) { return; } diff --git a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java index 6405f5d..29844fc 100644 --- a/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java +++ b/bundles/org.palladiosimulator.envdyn.api/src/org/palladiosimulator/envdyn/api/entity/bn/DynamicBayesianNetwork.java @@ -6,6 +6,7 @@ import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -214,7 +215,7 @@ public Double probability(Trajectory value) { } @Override - public void init(ISeedProvider seedProvider) { + public void init(Optional seedProvider) { if (initialized) { throw new RuntimeException("already initialized"); } diff --git a/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java b/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java index 02105dd..e33f779 100644 --- a/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java +++ b/tests/org.palladiosimulator.envdyn.api.tests/src/org/palladiosimulator/envdyn/api/tests/bn/BayesianModelTest.java @@ -1,5 +1,7 @@ package org.palladiosimulator.envdyn.api.tests.bn; +import java.util.Optional; + import org.eclipse.emf.ecore.resource.ResourceSet; import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; import org.junit.BeforeClass; @@ -15,7 +17,6 @@ import tools.mdsd.probdist.api.factory.ProbabilityDistributionFactory; import tools.mdsd.probdist.api.parser.DefaultParameterParser; import tools.mdsd.probdist.api.parser.ParameterParser; -import tools.mdsd.probdist.api.random.NoSeedProvider; import tools.mdsd.probdist.distributiontype.ProbabilityDistributionRepository; public class BayesianModelTest { @@ -41,7 +42,7 @@ public static void setUpModels() { IProbabilityDistributionRepositoryLookup probDistRepoLookup = new ProbabilityDistributionRepositoryLookup( distTypes); - defaultProbabilityDistributionFactory = new ProbabilityDistributionFactory(new NoSeedProvider()); + defaultProbabilityDistributionFactory = new ProbabilityDistributionFactory(Optional.empty()); IProbabilityDistributionRegistry probabilityDistributionRegistry = defaultProbabilityDistributionFactory; ParameterParser parameterParser = new DefaultParameterParser(); probabilityDistributionRegistry