Changeset 14173

Show
Ignore:
Timestamp:
12.06.2007 09:06:35 (12 years ago)
Author:
mdewsnip
Message:

Changed all function calls from &function($self, ...) to $self->function(...) to allow inheritance.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/classify/GenericList.pm

    r14084 r14173  
    253253            # This means that length() and substr() work properly 
    254254            # We need to be careful to convert classifier node title values back to UTF-8, however 
    255             my $metadata_value_unicode_string = &convert_utf8_string_to_unicode_string($metadata_value); 
     255            my $metadata_value_unicode_string = $self->convert_utf8_string_to_unicode_string($metadata_value); 
    256256 
    257257            # Add the metadata value into the list for this combination of metadata group and section 
     
    286286 
    287287    # Recursively create the classification hierarchy, one level for each metadata group 
    288     &add_level($self, \@metadata_groups, \@OIDs, \%classifier_node); 
     288    $self->add_level(\@metadata_groups, \@OIDs, \%classifier_node); 
    289289    return \%classifier_node; 
    290290} 
     
    325325    if ($partition_type_within_level =~ /^per_letter$/i) { 
    326326    # Generate one hlist for each letter 
    327     my @sortedmetavalues = &sort_metadata_values_array($self, keys(%metavaluetoOIDhash)); 
     327    my @sortedmetavalues = $self->sort_metadata_values_array(keys(%metavaluetoOIDhash)); 
    328328    my %metavaluetoOIDsubhash = (); 
    329329 
     
    334334        # Is this the start of a new partition? 
    335335        if ($metavaluepartition ne $lastpartition) { 
    336         &add_hlist_partition($self, \@metadata_groups, $classifier_node, $lastpartition, \%metavaluetoOIDsubhash); 
     336        $self->add_hlist_partition(\@metadata_groups, $classifier_node, $lastpartition, \%metavaluetoOIDsubhash); 
    337337        %metavaluetoOIDsubhash = (); 
    338338        $lastpartition = $metavaluepartition; 
     
    343343 
    344344    # Don't forget to add the last partition 
    345     &add_hlist_partition($self, \@metadata_groups, $classifier_node, $lastpartition, \%metavaluetoOIDsubhash); 
     345    $self->add_hlist_partition(\@metadata_groups, $classifier_node, $lastpartition, \%metavaluetoOIDsubhash); 
    346346 
    347347    # The partitions are stored in an HList 
     
    353353    my $partition_size_within_level = $self->{$metadata_group . ".partition_size_within_level"}; 
    354354    if ($partition_type_within_level =~ /^constant_size$/i && scalar(keys %metavaluetoOIDhash) > $partition_size_within_level) { 
    355         my @sortedmetavalues = &sort_metadata_values_array($self, keys(%metavaluetoOIDhash)); 
     355        my @sortedmetavalues = $self->sort_metadata_values_array(keys(%metavaluetoOIDhash)); 
    356356        my $itemsdone = 0; 
    357357        my %metavaluetoOIDsubhash = (); 
     
    365365        # Is this the start of a new partition? 
    366366        if ($itemsinpartition == 1) { 
    367             $partitionstart = &generate_partition_start($metavalue, $lastpartitionend, $self->{"partition_name_length"}); 
     367            $partitionstart = $self->generate_partition_start($metavalue, $lastpartitionend, $self->{"partition_name_length"}); 
    368368        } 
    369369 
    370370        # Is this the end of the partition? 
    371371        if ($itemsinpartition == $partition_size_within_level || $itemsdone == @sortedmetavalues) { 
    372             my $partitionend = &generate_partition_end($metavalue, $partitionstart, $self->{"partition_name_length"}); 
     372            my $partitionend = $self->generate_partition_end($metavalue, $partitionstart, $self->{"partition_name_length"}); 
    373373            my $partitionname = $partitionstart; 
    374374            if ($partitionend ne $partitionstart) { 
     
    376376            } 
    377377 
    378             &add_hlist_partition($self, \@metadata_groups, $classifier_node, $partitionname, \%metavaluetoOIDsubhash); 
     378            $self->add_hlist_partition(\@metadata_groups, $classifier_node, $partitionname, \%metavaluetoOIDsubhash); 
    379379            %metavaluetoOIDsubhash = (); 
    380380            $lastpartitionend = $partitionend; 
     
    388388    # Otherwise just add all the values to a VList 
    389389    else { 
    390         &add_vlist($self, \@metadata_groups, $classifier_node, \%metavaluetoOIDhash); 
     390        $self->add_vlist(\@metadata_groups, $classifier_node, \%metavaluetoOIDhash); 
    391391    } 
    392392    } 
     
    396396sub convert_utf8_string_to_unicode_string 
    397397{ 
     398    my $self = shift(@_); 
    398399    my $utf8_string = shift(@_); 
    399400 
     
    408409sub convert_unicode_string_to_utf8_string 
    409410{ 
     411    my $self = shift(@_); 
    410412    my $unicode_string = shift(@_); 
    411413 
     
    420422sub generate_partition_start 
    421423{ 
     424    my $self = shift(@_); 
    422425    my $metavalue = shift(@_); 
    423426    my $lastpartitionend = shift(@_); 
     
    443446sub generate_partition_end 
    444447{ 
     448    my $self = shift(@_); 
    445449    my $metavalue = shift(@_); 
    446450    my $partitionstart = shift(@_); 
     
    476480 
    477481    # Create an hlist partition 
    478     my %child_classifier_node = ( 'Title' => &convert_unicode_string_to_utf8_string($partitionname), 
     482    my %child_classifier_node = ( 'Title' => $self->convert_unicode_string_to_utf8_string($partitionname), 
    479483                  'childtype' => "VList", 
    480484                  'contains' => [] ); 
    481485 
    482486    # Add the children to the hlist partition 
    483     &add_vlist($self, \@metadata_groups, \%child_classifier_node, \%metavaluetoOIDhash); 
     487    $self->add_vlist(\@metadata_groups, \%child_classifier_node, \%metavaluetoOIDhash); 
    484488    push(@{$classifier_node->{'contains'}}, \%child_classifier_node); 
    485489} 
     
    497501 
    498502    # Create an entry in the vlist for each value 
    499     foreach my $metavalue (&sort_metadata_values_array($self, keys(%metavaluetoOIDhash))) { 
     503    foreach my $metavalue ($self->sort_metadata_values_array(keys(%metavaluetoOIDhash))) { 
    500504    my @OIDs = @{$metavaluetoOIDhash{$metavalue}}; 
    501505 
     
    519523    # Otherwise create a sublist (bookshelf) for the metadata value 
    520524    else { 
    521         my %child_classifier_node = ( 'Title' => &convert_unicode_string_to_utf8_string($metavalue), 
     525        my %child_classifier_node = ( 'Title' => $self->convert_unicode_string_to_utf8_string($metavalue), 
    522526                      'childtype' => "VList", 
    523527                      'contains' => [] ); 
     
    527531        my $next_metadata_group = $metadata_groups[0]; 
    528532        $child_classifier_node{'childtype'} = $self->{$next_metadata_group . ".list_type"}; 
    529         &add_level($self, \@metadata_groups, \@OIDs, \%child_classifier_node); 
     533        $self->add_level(\@metadata_groups, \@OIDs, \%child_classifier_node); 
    530534        } 
    531535        # Otherwise just add the documents as children of this list