1
2
3
4 package org.opentrafficsim.water.demand;
5
6 import java.io.Serializable;
7 import java.util.HashSet;
8 import java.util.Set;
9
10 import org.opentrafficsim.water.Dynamic;
11 import org.opentrafficsim.water.network.WaterwayLocation;
12 import org.opentrafficsim.water.transport.ShipType;
13
14 import nl.tudelft.simulation.dsol.simulators.DEVSSimulatorInterface;
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31 public class OtherDemand implements Dynamic, Serializable
32 {
33
34 private static final long serialVersionUID = 1L;
35
36
37 private DEVSSimulatorInterface.TimeDoubleUnit simulator;
38
39
40 private Set<OtherDemandCell> otherDemandSet = new HashSet<OtherDemandCell>();
41
42
43
44
45 public OtherDemand(final DEVSSimulatorInterface.TimeDoubleUnit simulator)
46 {
47 super();
48 this.simulator = simulator;
49 }
50
51
52
53
54 public final Set<OtherDemandCell> getOtherDemandSet()
55 {
56 return this.otherDemandSet;
57 }
58
59
60
61
62
63 public final void addDemand(final OtherDemandCell otherDemandCell)
64 {
65 this.otherDemandSet.add(otherDemandCell);
66 }
67
68
69
70
71
72
73
74
75 public final void addDemand(final WaterwayLocation origin, final WaterwayLocation destination, final int annualMoves,
76 final ShipType shipType)
77 {
78 OtherDemandCell otherDemandCell = new OtherDemandCell(origin, destination, annualMoves, shipType);
79 addDemand(otherDemandCell);
80 }
81
82
83
84
85
86
87
88
89
90 public class OtherDemandCell
91 {
92
93 private WaterwayLocation origin;
94
95
96 private WaterwayLocation destination;
97
98
99 private int annualMoves;
100
101
102 private ShipType shipType;
103
104
105
106
107
108
109
110 public OtherDemandCell(final WaterwayLocation origin, final WaterwayLocation destination, final int annualMoves,
111 final ShipType shipType)
112 {
113 this.origin = origin;
114 this.destination = destination;
115 this.annualMoves = annualMoves;
116 this.shipType = shipType;
117 }
118
119
120
121
122 public final WaterwayLocation getOrigin()
123 {
124 return this.origin;
125 }
126
127
128
129
130 public final WaterwayLocation getDestination()
131 {
132 return this.destination;
133 }
134
135
136
137
138 public final int getAnnualMoves()
139 {
140 return this.annualMoves;
141 }
142
143
144
145
146 public final ShipType getShipType()
147 {
148 return this.shipType;
149 }
150
151 }
152
153
154 @Override
155 public final DEVSSimulatorInterface.TimeDoubleUnit getSimulator()
156 {
157 return this.simulator;
158 }
159 }