From 4a74fe254037d155883e5397c60aad34fe847292 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 25 Apr 2015 22:13:17 +0200 Subject: add is_unscheduled accessor --- lib/Travel/Status/DE/IRIS/Result.pm | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'lib/Travel/Status/DE/IRIS/Result.pm') diff --git a/lib/Travel/Status/DE/IRIS/Result.pm b/lib/Travel/Status/DE/IRIS/Result.pm index 80319b5..82659b3 100644 --- a/lib/Travel/Status/DE/IRIS/Result.pm +++ b/lib/Travel/Status/DE/IRIS/Result.pm @@ -95,11 +95,12 @@ my %translation = ( ); Travel::Status::DE::IRIS::Result->mk_ro_accessors( - qw(arrival classes date datetime delay departure is_cancelled is_transfer is_wing - line_no train_no_transfer old_train_id old_train_no platform raw_id - realtime_xml route_start route_end sched_arrival sched_departure - sched_platform sched_route_start sched_route_end start stop_no time - train_id train_no transfer type unknown_t unknown_o wing_id) + qw(arrival classes date datetime delay departure is_cancelled is_transfer + is_unscheduled is_wing line_no train_no_transfer old_train_id + old_train_no platform raw_id realtime_xml route_start route_end + sched_arrival sched_departure sched_platform sched_route_start + sched_route_end start stop_no time train_id train_no transfer type + unknown_t unknown_o wing_id) ); sub new { @@ -326,6 +327,12 @@ sub set_tl { return $self; } +sub set_unscheduled { + my ( $self, $unscheduled ) = @_; + + $self->{is_unscheduled} = $unscheduled; +} + sub add_arrival_wingref { my ( $self, $ref ) = @_; @@ -821,6 +828,14 @@ the results and indicates it by setting B to a true value. In case of a transfer, B and B are set to the "new" value, the old ones are available in B and B. +=item $result->is_unscheduled + +True if the train does not appear in the requested plans. This can happen +because of two reasons: Either the scheduled time and the actual time are so +far apart that it should've arrived/departed long ago, or it really is an +unscheduled train. In that case, it can be a replacement or an additional +train. There is no logic to distinguish these cases yet. + =item $result->is_wing Returns true if this result is a wing, false otherwise. -- cgit v1.2.3