diff --git a/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java b/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java index 16eab6c..2093291 100644 --- a/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java +++ b/AlgebraicDataflowArchitectureModel/src/simulator/Simulator.java @@ -26,12 +26,14 @@ import models.dataFlowModel.DataTransferChannel; import models.dataFlowModel.DataTransferChannel.IResourceStateAccessor; import simulator.Event.IResourceStateValueProvider; +import simulator.interfaces.INativeInitializer; import simulator.interfaces.INativeReceiver; public class Simulator { private DataTransferModel model; private SystemState curState; private List systemReceivers = new ArrayList<>(); + private List systemInitializers = new ArrayList<>(); private Map> nativeReceivers = new HashMap<>(); private Map nativeChannelReceivers = new HashMap<>(); @@ -63,6 +65,9 @@ for (Channel channel: model.getChannels()) { curState.addChannel((DataTransferChannel) channel); } + for (INativeInitializer initializer: systemInitializers) { + initializer.onInitFromModel(curState); + } return curState; } @@ -100,6 +105,10 @@ systemReceivers.add(receiver); } + public void addSystemInitializer(INativeInitializer initializer) { + systemInitializers.add(initializer); + } + public void addNativeReceiver(INativeReceiver receiver, DataTransferChannel channel) { nativeChannelReceivers.put(channel, receiver); } @@ -117,6 +126,10 @@ systemReceivers.remove(receiver); } + public void removeSystemInitializer(INativeInitializer initializer) { + systemInitializers.remove(initializer); + } + public void removeNativeReceiver(DataTransferChannel channel) { nativeChannelReceivers.remove(channel); }