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