1 package org.opentrafficsim.water.network.infra;
2
3 import org.djunits.value.vdouble.scalar.Duration;
4 import org.djunits.value.vdouble.scalar.Length;
5 import org.opentrafficsim.core.dsol.OTSDEVSSimulatorInterface;
6 import org.opentrafficsim.water.network.Waterway;
7 import org.opentrafficsim.water.network.WaterwayLocation;
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 public class MovableBridge extends FixedBridge implements OperatedObstacle
25 {
26
27 private static final long serialVersionUID = 1L;
28
29
30 private OTSDEVSSimulatorInterface simulator;
31
32
33 private int operationHoursPerDay;
34
35
36 private int operationDaysPerWeek;
37
38
39 private Length maxHeightClosed;
40
41
42 private Length maxHeightOpened;
43
44
45 private Duration waitingTime;
46
47
48
49
50
51
52
53
54
55
56 public MovableBridge(final OTSDEVSSimulatorInterface simulator, final String name, final WaterwayLocation waterwayLocation,
57 final int operationHoursPerDay, final int operationDaysPerWeek, final Length maxHeightClosed,
58 final Length maxHeightOpened)
59 {
60 super(name, waterwayLocation, maxHeightOpened);
61 this.simulator = simulator;
62 this.operationHoursPerDay = operationHoursPerDay;
63 this.operationDaysPerWeek = operationDaysPerWeek;
64 this.maxHeightClosed = maxHeightClosed;
65 this.maxHeightOpened = maxHeightOpened;
66
67
68
69
70
71
72 }
73
74
75
76
77
78
79
80
81
82
83
84 @SuppressWarnings("checkstyle:parameternumber")
85 public MovableBridge(final OTSDEVSSimulatorInterface simulator, final String name, final Waterway waterway,
86 final Length distance, final int operationHoursPerDay, final int operationDaysPerWeek, final Length maxHeightClosed,
87 final Length maxHeightOpened)
88 {
89 this(simulator, name, new WaterwayLocation(waterway, distance), operationHoursPerDay, operationDaysPerWeek,
90 maxHeightClosed, maxHeightOpened);
91 }
92
93
94
95
96 public final Duration estimateOpeningDelay()
97 {
98 return this.waitingTime;
99 }
100
101
102
103
104 public final Duration drawOpeningDelay()
105 {
106 return this.waitingTime;
107 }
108
109
110 @Override
111 public final int getOperationHoursPerDay()
112 {
113 return this.operationHoursPerDay;
114 }
115
116
117 @Override
118 public final int getOperationDaysPerWeek()
119 {
120 return this.operationDaysPerWeek;
121 }
122
123
124
125
126 public final Length getMaxHeightClosed()
127 {
128 return this.maxHeightClosed;
129 }
130
131
132
133
134 public final Length getMaxHeightOpened()
135 {
136 return this.maxHeightOpened;
137 }
138
139
140 @Override
141 public final OTSDEVSSimulatorInterface getSimulator()
142 {
143 return this.simulator;
144 }
145
146
147 @Override
148 @SuppressWarnings("checkstyle:designforextension")
149 public String toString()
150 {
151 return "Movable Bridge " + this.getName() + " at " + this.getWaterwayLocation();
152 }
153
154 }