Skip to content
Extraits de code Groupes Projets
Valider f9c61514 rédigé par hieda_kyuko@hpr's avatar hieda_kyuko@hpr
Parcourir les fichiers

Get rid of the print statements

parent ad7886fa
Branches
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -3,6 +3,13 @@ package Frame; ...@@ -3,6 +3,13 @@ package Frame;
use strict; use strict;
use warnings; use warnings;
BEGIN
{
unshift @INC, '.';
}
use App::Log;
use Data::Dumper; use Data::Dumper;
sub debug_frame sub debug_frame
...@@ -14,11 +21,11 @@ sub debug_frame ...@@ -14,11 +21,11 @@ sub debug_frame
sub frame_info sub frame_info
{ {
my $frame = $_[0]; my $frame = $_[0];
print "Frame for line $frame->{'rosenmei'}:\n"; Log::d "Frame for line $frame->{'rosenmei'}:\n";
print ". $frame->{'eki_num'} stations\n"; Log::d ". $frame->{'eki_num'} stations\n";
print ". " . scalar @{ $frame->{'syubetsu'} } . " service types\n"; Log::d ". " . scalar @{ $frame->{'syubetsu'} } . " service types\n";
print ". " . scalar @{ $frame->{'dia'}->{'kudari'} } . " down services\n"; Log::d ". " . scalar @{ $frame->{'dia'}->{'kudari'} } . " down services\n";
print ". " . scalar @{ $frame->{'dia'}->{'nobori'} } . " up services\n"; Log::d ". " . scalar @{ $frame->{'dia'}->{'nobori'} } . " up services\n";
} }
1; 1;
...@@ -30,7 +30,7 @@ sub Raptor_simple ...@@ -30,7 +30,7 @@ sub Raptor_simple
my $from = MasterUtils::sta_from_id $master, $from_id; my $from = MasterUtils::sta_from_id $master, $from_id;
my $to = MasterUtils::sta_from_id $master, $to_id; my $to = MasterUtils::sta_from_id $master, $to_id;
print "Calculating fastest routes from $from->{'ekimei'} to $to->{'ekimei'} leaving at $dep_time with $MAX_LEGS maximum legs\n"; Log::i "Calculating fastest routes from $from->{'ekimei'} to $to->{'ekimei'} leaving at $dep_time with $MAX_LEGS maximum legs\n";
# From now on we are just blindly following the algorithm from the paper... # From now on we are just blindly following the algorithm from the paper...
# Use ~0 as a substitute to infty, not that travel times would exceed this anyway # Use ~0 as a substitute to infty, not that travel times would exceed this anyway
......
...@@ -281,18 +281,17 @@ foreach my $file (@trains) ...@@ -281,18 +281,17 @@ foreach my $file (@trains)
my $recce = new_recce (); my $recce = new_recce ();
my $train_path = $trains_path . $file; my $train_path = $trains_path . $file;
print 'Using file ' . $train_path . "\n"; Log::d 'Using file ' . $train_path . "\n";
open $dia_file, '<:encoding(UTF-8):via(File::BOM)', $train_path; open $dia_file, '<:encoding(UTF-8):via(File::BOM)', $train_path;
my $file_name = basename $file; my $file_name = basename $file;
my $basename = substr $file_name, 0, -5; my $basename = substr $file_name, 0, -5;
print "Route id will be $basename\n"; Log::d "Route id will be $basename\n";
read $dia_file, my $contents, -s $dia_file; read $dia_file, my $contents, -s $dia_file;
try { print $recce->read(\$contents) . ' bytes read.'; } try { Log::d ($recce->read(\$contents) . ' bytes read.'); }
catch ($e) { print "Malformation in .oud file.\n$e\n"; } catch ($e) { Log::w "Malformation in .oud file.\n$e\n"; }
print "\n";
# print $recce->show_progress(); # print $recce->show_progress();
...@@ -317,18 +316,17 @@ foreach my $file (@bus) ...@@ -317,18 +316,17 @@ foreach my $file (@bus)
my $recce = new_recce (); my $recce = new_recce ();
my $abus_path = $bus_path . $file; my $abus_path = $bus_path . $file;
print 'Using file ' . $abus_path . "\n"; Log::d 'Using file ' . $abus_path . "\n";
open $dia_file, '<:encoding(UTF-8):via(File::BOM)', $abus_path; open $dia_file, '<:encoding(UTF-8):via(File::BOM)', $abus_path;
my $file_name = basename $file; my $file_name = basename $file;
my $basename = substr $file_name, 0, -5; my $basename = substr $file_name, 0, -5;
print "Route id will be $basename\n"; Log::d "Route id will be $basename\n";
read $dia_file, my $contents, -s $dia_file; read $dia_file, my $contents, -s $dia_file;
try { print $recce->read(\$contents) . ' bytes read.'; } try { Log::d ($recce->read(\$contents) . ' bytes read.'); }
catch ($e) { print "Malformation in .oud file.\n$e\n"; } catch ($e) { Log::w "Malformation in .oud file.\n$e\n"; }
print "\n";
# print $recce->show_progress(); # print $recce->show_progress();
...@@ -402,7 +400,7 @@ foreach my $frame (values %{ $master{'rosen'} }) ...@@ -402,7 +400,7 @@ foreach my $frame (values %{ $master{'rosen'} })
if ($restart) { next; } if ($restart) { next; }
my $id = $frame->{'id'} . "_$index"; my $id = $frame->{'id'} . "_$index";
print "Adding station $ekimei to master frame with id $id\n"; Log::d "Adding station $ekimei to master frame with id $id\n";
$new_struct{'ekimei'} = $ekimei; $new_struct{'ekimei'} = $ekimei;
$new_struct{'found_in'} = $frame->{'id'}; $new_struct{'found_in'} = $frame->{'id'};
$new_struct{'found_as_train_stop'} = $is_train; $new_struct{'found_as_train_stop'} = $is_train;
...@@ -427,11 +425,11 @@ my $recce = Marpa::R2::Scanless::R->new( ...@@ -427,11 +425,11 @@ my $recce = Marpa::R2::Scanless::R->new(
); );
open my $tt_file, '<:encoding(UTF-8):via(File::BOM)', $tt_path; open my $tt_file, '<:encoding(UTF-8):via(File::BOM)', $tt_path;
print "Parsing transfer times\n"; Log::d "Parsing transfer times\n";
read $tt_file, my $tt_contents, -s $tt_file; read $tt_file, my $tt_contents, -s $tt_file;
try { print $recce->read(\$tt_contents) . ' bytes read.'; } try { Log::d ($recce->read(\$tt_contents) . ' bytes read.'); }
catch ($e) { print "Malformation in transfer_times file.\n$e\n"; } catch ($e) { Log::w "Malformation in transfer_times file.\n$e\n"; }
print "\n"; print "\n";
my $transfers = ${ $recce->value() }; my $transfers = ${ $recce->value() };
...@@ -439,7 +437,7 @@ foreach my $transfer (@$transfers) ...@@ -439,7 +437,7 @@ foreach my $transfer (@$transfers)
{ {
my $where = $transfer->{'where'}; my $where = $transfer->{'where'};
my $time = $transfer->{'time'}; my $time = $transfer->{'time'};
print "Transfer time is $time' between $where->[0] and $where->[1]\n"; Log::d "Transfer time is $time' between $where->[0] and $where->[1]\n";
$transfer->{'where'} = $transfer->{'where'} =
[ [
(MasterUtils::search_eki \%master, $where->[0]), (MasterUtils::search_eki \%master, $where->[0]),
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter