X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FText%2FTradition%2FCollation%2FReading.pm;h=80f737c417777adc592d0ef6f20259a1dbc03d8b;hb=027d819cfec7c990f32bf810203481c9f7dc1f60;hp=1d700a6824aff248fe62375d197ed7d786a2434e;hpb=c3c7961291dc2703f5d532d004d301f1cc1db96e;p=scpubgit%2Fstemmatology.git diff --git a/lib/Text/Tradition/Collation/Reading.pm b/lib/Text/Tradition/Collation/Reading.pm index 1d700a6..80f737c 100644 --- a/lib/Text/Tradition/Collation/Reading.pm +++ b/lib/Text/Tradition/Collation/Reading.pm @@ -160,24 +160,50 @@ sub is_meta { return $self->is_start || $self->is_end || $self->is_lacuna || $self->is_ph; } -# Some syntactic sugar +=head1 Convenience methods + +=head2 related_readings + +Calls Collation's related_readings with $self as the first argument. + +=cut + sub related_readings { my $self = shift; return $self->collation->related_readings( $self, @_ ); } +=head2 predecessors + +Returns a list of Reading objects that immediately precede $self in the collation. + +=cut + sub predecessors { my $self = shift; my @pred = $self->collation->sequence->predecessors( $self->id ); return map { $self->collation->reading( $_ ) } @pred; } +=head2 successors + +Returns a list of Reading objects that immediately follow $self in the collation. + +=cut + sub successors { my $self = shift; my @succ = $self->collation->sequence->successors( $self->id ); return map { $self->collation->reading( $_ ) } @succ; } +=head2 set_identical( $other_reading) + +Backwards compatibility method, to add a transposition relationship +between $self and $other_reading. Don't use this. + +=cut + sub set_identical { my( $self, $other ) = @_; return $self->collation->add_relationship( $self, $other,