@@ -139,17 +139,6 @@ impl SimulationAgentLogic for PlanBasedSimulationLogic {
139139 ) ;
140140 }
141141
142- fn wakeup_time ( & self , now : u32 ) -> u32 {
143- match self
144- . basic_agent_delegate
145- . plan_element_at ( self . curr_plan_element )
146- . unwrap ( )
147- {
148- InternalPlanElement :: Activity ( a) => a. cmp_end_time ( now) ,
149- InternalPlanElement :: Leg ( _) => panic ! ( "Cannot wake up on a leg!" ) ,
150- }
151- }
152-
153142 fn state ( & self ) -> SimulationAgentState {
154143 match self . curr_plan_element % 2 {
155144 0 => SimulationAgentState :: ACTIVITY ,
@@ -158,6 +147,10 @@ impl SimulationAgentLogic for PlanBasedSimulationLogic {
158147 }
159148 }
160149
150+ fn is_wanting_to_arrive_on_current_link ( & self ) -> bool {
151+ self . peek_next_link_id ( ) . is_none ( )
152+ }
153+
161154 fn curr_link_id ( & self ) -> Option < & Id < Link > > {
162155 if self . state ( ) != SimulationAgentState :: LEG {
163156 return None ;
@@ -192,6 +185,17 @@ impl SimulationAgentLogic for PlanBasedSimulationLogic {
192185 . unwrap ( )
193186 . route_element_at ( next_i)
194187 }
188+
189+ fn wakeup_time ( & self , now : u32 ) -> u32 {
190+ match self
191+ . basic_agent_delegate
192+ . plan_element_at ( self . curr_plan_element )
193+ . unwrap ( )
194+ {
195+ InternalPlanElement :: Activity ( a) => a. cmp_end_time ( now) ,
196+ InternalPlanElement :: Leg ( _) => panic ! ( "Cannot wake up on a leg!" ) ,
197+ }
198+ }
195199}
196200
197201impl EndTime for PlanBasedSimulationLogic {
@@ -228,6 +232,22 @@ impl SimulationAgentLogic for AdaptivePlanBasedSimulationLogic {
228232 self . delegate . advance_plan ( ) ;
229233 }
230234
235+ fn state ( & self ) -> SimulationAgentState {
236+ self . delegate . state ( )
237+ }
238+
239+ fn is_wanting_to_arrive_on_current_link ( & self ) -> bool {
240+ self . delegate . is_wanting_to_arrive_on_current_link ( )
241+ }
242+
243+ fn curr_link_id ( & self ) -> Option < & Id < Link > > {
244+ self . delegate . curr_link_id ( )
245+ }
246+
247+ fn peek_next_link_id ( & self ) -> Option < & Id < Link > > {
248+ self . delegate . peek_next_link_id ( )
249+ }
250+
231251 fn wakeup_time ( & self , now : u32 ) -> u32 {
232252 let mut end = self . delegate . curr_act ( ) . cmp_end_time ( now) ;
233253 if let Some ( l) = self . delegate . next_leg ( ) {
@@ -240,18 +260,6 @@ impl SimulationAgentLogic for AdaptivePlanBasedSimulationLogic {
240260 }
241261 end
242262 }
243-
244- fn state ( & self ) -> SimulationAgentState {
245- self . delegate . state ( )
246- }
247-
248- fn curr_link_id ( & self ) -> Option < & Id < Link > > {
249- self . delegate . curr_link_id ( )
250- }
251-
252- fn peek_next_link_id ( & self ) -> Option < & Id < Link > > {
253- self . delegate . peek_next_link_id ( )
254- }
255263}
256264
257265impl EndTime for AdaptivePlanBasedSimulationLogic {
0 commit comments