X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FCollation.pm;h=1b98dd05a47448cec5cd861110d7a6038830975d;hb=027d819cfec7c990f32bf810203481c9f7dc1f60;hp=0692c7c14f6bc466a6e640b2ada3f35133c3a39c;hpb=c3c7961291dc2703f5d532d004d301f1cc1db96e;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Collation.pm b/lib/Text/Tradition/Collation.pm index 0692c7c..1b98dd0 100644 --- a/lib/Text/Tradition/Collation.pm +++ b/lib/Text/Tradition/Collation.pm @@ -549,7 +549,7 @@ sub as_dot { foreach my $edge ( @edges ) { # Do we need to output this edge? if( $used{$edge->[0]} && $used{$edge->[1]} ) { - my $label = $self->path_display_label( $self->path_witnesses( $edge ) ); + my $label = $self->_path_display_label( $self->path_witnesses( $edge ) ); my $variables = { %edge_attrs, 'label' => $label }; # Account for the rank gap if necessary if( $self->reading( $edge->[1] )->has_rank @@ -574,13 +574,13 @@ sub as_dot { } # Add substitute start and end edges if necessary foreach my $node ( keys %substart ) { - my $witstr = $self->path_display_label ( $self->reading_witnesses( $self->reading( $node ) ) ); + my $witstr = $self->_path_display_label ( $self->reading_witnesses( $self->reading( $node ) ) ); my $variables = { %edge_attrs, 'label' => $witstr }; my $varopts = _dot_attr_string( $variables ); $dot .= "\t\"#SUBSTART#\" -> \"$node\" $varopts;"; } foreach my $node ( keys %subend ) { - my $witstr = $self->path_display_label ( $self->reading_witnesses( $self->reading( $node ) ) ); + my $witstr = $self->_path_display_label ( $self->reading_witnesses( $self->reading( $node ) ) ); my $variables = { %edge_attrs, 'label' => $witstr }; my $varopts = _dot_attr_string( $variables ); $dot .= "\t\"$node\" -> \"#SUBEND#\" $varopts;"; @@ -604,6 +604,13 @@ sub _dot_attr_string { return( '[ ' . join( ', ', @attrs ) . ' ]' ); } +=head2 path_witnesses( $edge ) + +Returns the list of sigils whose witnesses are associated with the given edge. +The edge can be passed as either an array or an arrayref of ( $source, $target ). + +=cut + sub path_witnesses { my( $self, @edge ) = @_; # If edge is an arrayref, cope. @@ -615,7 +622,7 @@ sub path_witnesses { return @wits; } -sub path_display_label { +sub _path_display_label { my $self = shift; my @wits = sort @_; my $maj = scalar( $self->tradition->witnesses ) * 0.6; @@ -806,7 +813,7 @@ sub as_graphml { } # Add the relationship graph to the XML - $self->relations->as_graphml( $graphml_ns, $root, \%node_hash, + $self->relations->_as_graphml( $graphml_ns, $root, \%node_hash, $node_data_keys{'id'}, \%edge_data_keys ); # Save and return the thing @@ -1411,16 +1418,16 @@ is( $c->common_successor( 'n21', 'n26' )->id, sub common_predecessor { my $self = shift; my( $r1, $r2 ) = $self->_objectify_args( @_ ); - return $self->common_in_path( $r1, $r2, 'predecessors' ); + return $self->_common_in_path( $r1, $r2, 'predecessors' ); } sub common_successor { my $self = shift; my( $r1, $r2 ) = $self->_objectify_args( @_ ); - return $self->common_in_path( $r1, $r2, 'successors' ); + return $self->_common_in_path( $r1, $r2, 'successors' ); } -sub common_in_path { +sub _common_in_path { my( $self, $r1, $r2, $dir ) = @_; my $iter = $r1->rank > $r2->rank ? $r1->rank : $r2->rank; $iter = $self->end->rank - $iter if $dir eq 'successors'; @@ -1455,10 +1462,12 @@ sub throw { no Moose; __PACKAGE__->meta->make_immutable; -=head1 BUGS / TODO +=head1 LICENSE -=over +This package is free software and is provided "as is" without express +or implied warranty. You can redistribute it and/or modify it under +the same terms as Perl itself. -=item * Get rid of $backup in reading_sequence +=head1 AUTHOR -=back +Tara L Andrews Eaurum@cpan.orgE