1 | package de.uka.ipd.sdq.probespec.framework.probes.example; |
2 | |
3 | import java.util.HashMap; |
4 | import java.util.Map; |
5 | |
6 | /** |
7 | * Represents a simple simulation context for demonstration purposes. |
8 | * <p> |
9 | * The simulation context holds the current simulation time as well as available |
10 | * active resources. |
11 | * |
12 | * @author pmerkle |
13 | * |
14 | */ |
15 | public class SimpleSimulationContext { |
16 | |
17 | private double simulatedTime; |
18 | |
19 | /** Maps "resource name" -> resource */ |
20 | private Map<String, ASimpleActiveResource> activeResourceMap; |
21 | |
22 | public SimpleSimulationContext() { |
23 | this.activeResourceMap = new HashMap<String, ASimpleActiveResource>(); |
24 | } |
25 | |
26 | public double getSimulatedTime() { |
27 | return simulatedTime; |
28 | } |
29 | |
30 | public void setSimulatedTime(double simulatedTime) { |
31 | this.simulatedTime = simulatedTime; |
32 | } |
33 | |
34 | public void addActiveResource(String name, ASimpleActiveResource resource) { |
35 | activeResourceMap.put(name, resource); |
36 | } |
37 | |
38 | public ASimpleActiveResource getActiveResource(String name) { |
39 | return activeResourceMap.get(name); |
40 | } |
41 | |
42 | } |