/procedures/meta/comments

Module to parse a route whose source step is an EQUALS step.

 2 module PARSE_EQUALS_STEP

Method to parse a route whose source step is an EQUALS step.

 5   def parse_route_from_equals_step( route_id )

Design note: The method used for validating the number of input and output routes for each step type.

If the EQUALS step does not have two inbound routes ...

 9     if step_inbound_routes( route_source_step_id( route_id ) ).size != 2

... log the step as has having an unexpected number of inbound routes.

 12       logger.error "EQUALS step with name #{route_source_step_name( route_id )} has #{step_inbound_routes( route_source_step_id( route_id ) ).size} inbound routes."

The appearance of inbound routes in first or second place has no meaning beyond the order they are delivered from the data store.

Otherwise, the EQUALS step does have two inbound routes.

 16     else

We get the ID of the first inbound route ...

 19       first_inbound_route_id = step_first_inbound_route( route_source_step_id( route_id ) )

... and we get the ID of the second inbound route.

 22       second_inbound_route_id = step_second_inbound_route( route_source_step_id( route_id ) )

If both inbound routes to the source step have been parsed ...

 25       if route_parsed_attribute( first_inbound_route_id ) == true and route_parsed_attribute( second_inbound_route_id ) == true

... we update the route parsed attribute to true.

 28         update_route_hash( route_id, nil, nil, true, nil, nil )

Referring to the design notes for arithmetic steps ...

... if either inbound route to the source step has a status of 'UNTRAVERSABLE' ...

 33         if route_is_untraversable?( first_inbound_route_id ) or route_is_untraversable?( second_inbound_route_id )

... we set the status of this route to 'UNTRAVERSABLE' ...

... tainting the roads off the bridge as closed if the bridge is closed.

 37           update_route_hash( route_id, nil, 'UNTRAVERSABLE', nil, nil, nil )

Otherwise, neither inbound route to the source step has a status of 'UNTRAVERSABLE' ...

 40         else

... if the actualisation count of the first inbound route is equal to the actualisation count of the second inbound route ...

 43           if route_actualisation_count( first_inbound_route_id ) == route_actualisation_count( second_inbound_route_id )

... we set the status of this route to 'TRUE'.

 46             update_route_hash( route_id, nil, 'TRUE', nil, nil, nil )

Otherwise, the actualisation count of the first inbound route is not equal to the actualisation count of the second inbound route ...

 49           else

... and we set the status of this route to 'FALSE'.

 52             update_route_hash( route_id, nil, 'FALSE', nil, nil, nil )
 53           end
 54         end

Otherwise, one or both of the inbound routes have not been parsed and this route will be parsed on a later pass.

 57       end
 58     end
 59   end
 60 end