# Don't list out every witness if we have more than half to list.
my $majority = int( scalar( @{$self->tradition->witnesses} ) / 2 ) + 1;
+ # But don't compress if there are only a few witnesses.
+ $majority = 4 if $majority < 4;
foreach my $node( $self->readings ) {
my $newlabels = {};
# We will visit each node, so we only look ahead.
my $label;
my @compressed_wits = ();
if( @{$newlabels->{$newdest}} < $majority ) {
- $label = join( ', ', @{$newlabels->{$newdest}} );
+ $label = join( ', ', sort( @{$newlabels->{$newdest}} ) );
} else {
## TODO FIX THIS HACK
my @aclabels;
push( @compressed_wits, $wit );
}
}
- $label = join( ', ', 'majority', @aclabels );
+ $label = join( ', ', 'majority', sort( @aclabels ) );
}
my $newpath =
foreach my $tn ( @$transposition_nodes ) {
my $id_xpath = sprintf( './g:data[@key="%s"]/text()',
$nodedata{'identical'} );
- $collation->reading( $node_id{ $tn->getAttribute( 'id' ) } )->
- set_identical( $collation->reading(
- $node_name{ $xpc->findvalue( $id_xpath, $tn ) } ) );
+ my $tn_reading = $collation->reading( $node_id{ $tn->getAttribute( 'id' ) } );
+ my $main_reading = $collation->reading( $node_name{ $xpc->findvalue( $id_xpath, $tn ) } );
+ if( $collation->linear ) {
+ $tn_reading->set_identical( $main_reading );
+ } else {
+ $collation->merge_readings( $main_reading, $tn_reading );
+ }
}
# Find the beginning and end nodes of the graph. The beginning node