greenstone.org greenstone wiki greenstone trac planet greenstone

Changeset 16196

Show
Ignore:
Timestamp:
2008-06-26 11:03:37 (5 months ago)
Author:
mdewsnip
Message:

A few variable name and code improvements.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gsdl/trunk/src/recpt/dynamicclassifieraction.cpp

    r16181 r16196  
    448448    text_t metadata_value = (*metadata_value_iterator).OID; 
    449449 
    450     // If we're not at the top-level we need to remove the current position from the metadata values 
     450    // We need to remove the current position from the metadata value to leave the child metadata value 
     451    text_t child_metadata_value = metadata_value; 
    451452    if (starts_with(metadata_value, classifier_node_metadata_value + "|")) 
    452453    { 
    453       metadata_value = substr(metadata_value.begin() + (classifier_node_metadata_value + "|").size(), metadata_value.end()); 
    454     } 
    455  
    456     // Is this metadata value hierarchical? 
    457     text_t::iterator hierarchy_split_position = findchar(metadata_value.begin(), metadata_value.end(), '|'); 
    458     if (hierarchy_split_position != metadata_value.end()) 
    459     { 
    460       // Yes, so use the first part of the hierarchy only 
    461       metadata_value = substr(metadata_value.begin(), hierarchy_split_position); 
    462     } 
    463  
    464     // Create a node for this metadata value if we haven't seen it before 
    465     if (child_classifier_nodes.find(metadata_value) == child_classifier_nodes.end()) 
    466     { 
    467       child_classifier_nodes[metadata_value] = 0; 
     454      child_metadata_value = substr(metadata_value.begin() + (classifier_node_metadata_value + "|").size(), metadata_value.end()); 
     455    } 
     456 
     457    // Determine the label for the child classifier node from the metadata value 
     458    text_tarray child_metadata_value_parts; 
     459    splitchar (child_metadata_value.begin(), child_metadata_value.end(), '|', child_metadata_value_parts); 
     460    text_t child_classifier_node_label = child_metadata_value_parts.front(); 
     461 
     462    // Create a node for this value if we haven't seen it before 
     463    if (child_classifier_nodes.find(child_classifier_node_label) == child_classifier_nodes.end()) 
     464    { 
     465      child_classifier_nodes[child_classifier_node_label] = 0; 
    468466    } 
    469467 
    470468    // Increment the occurrence count 
    471     child_classifier_nodes[metadata_value] += (*metadata_value_iterator).result_num; 
     469    child_classifier_nodes[child_classifier_node_label] += (*metadata_value_iterator).result_num; 
    472470 
    473471    metadata_value_iterator++;