<commit_before>/**
 *
 * FaZend.com, Fully Automated Zend Framework
 * RQDQL.com, Requirements Definition and Query Language
 *
 * Redistribution and use in source and binary forms, with or 
 * without modification, are PROHIBITED without prior written 
 * permission from the author. This product may NOT be used 
 * anywhere and on any computer except the server platform of 
 * FaZend.com. located at www.fazend.com. If you received this 
 * code occasionally and without intent to use it, please report 
 * this incident to the author by email: <EMAIL>
 *
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) rqdql.com, 2010
 * @version $Id: UseCase.h 1641 2010-04-16 07:56:07Z <EMAIL> $
 *
 * This file is included ONLY from Front.h
 */

void Links::fillNode(pugi::xml_node& n) {
    using namespace pugi;

    typedef vector<rqdql::Logger::Link> Links;
    Links v = rqdql::Logger::getInstance().getLinks();
    
    map<int, int> links;
    for (Links::const_iterator i = v.begin(); i != v.end(); ++i) {
        for (vector<int>::const_iterator k = (*i).getLeftLines().begin(); k != (*i).getLeftLines().end(); ++k) {
            for (vector<int>::const_iterator j = (*i).getRightLines().begin(); j != (*i).getRightLines().end(); ++j) {
                links[*k] = *j;
            }
        }
    }

    pugi::xml_node x = n.append_child();
    x.set_name("crosses");
    for (map<int, int>::const_iterator i = links.begin(); i != links.end(); ++i) {
        pugi::xml_node l = x.append_child();
        l.set_name("link");
        l.append_child().set_name("left");
        l.child("left").append_child(pugi::node_pcdata).set_value((boost::format("%d") % (*i).first).str().c_str());
        l.append_child().set_name("right");
        l.child("right").append_child(pugi::node_pcdata).set_value((boost::format("%d") % (*i).second).str().c_str());
    }

    x = n.append_child();
    x.set_name("locations");

    /**
     * @todo Totally ineffective implementation now!!
     */

    vector<string> types = proxy::Proxy::getInstance().getTypeNames();
    for (vector<string>::const_iterator i = types.begin(); i != types.end(); ++i) {
        vector<int> lines = rqdql::Logger::getInstance().getLinesFor(proxy::Proxy::getInstance().getType(*i));
        if (lines.empty()) {
            continue;
        }

        pugi::xml_node t = x.append_child();
        t.set_name("loc");
        t.append_attribute("name").set_value((*i).c_str());
        for (vector<int>::const_iterator j = lines.begin(); j != lines.end(); ++j) {
            pugi::xml_node loc = t.append_child();
            loc.set_name("line");
            loc.append_child(pugi::node_pcdata).set_value(
                (boost::format("%d") % (*j)).str().c_str()
            );
        }
    }

    vector<string> useCases = proxy::Proxy::getInstance().getAllUseCaseNames();
    for (vector<string>::const_iterator i = useCases.begin(); i != useCases.end(); ++i) {
        vector<int> lines = rqdql::Logger::getInstance().getLinesFor(proxy::Proxy::getInstance().getUseCase(*i));
        if (lines.empty()) {
            continue;
        }

        pugi::xml_node t = x.append_child();
        t.set_name("loc");
        t.append_attribute("name").set_value((*i).c_str());
        for (vector<int>::const_iterator j = lines.begin(); j != lines.end(); ++j) {
            pugi::xml_node loc = t.append_child();
            loc.set_name("line");
            loc.append_child(pugi::node_pcdata).set_value(
                (boost::format("%d") % (*j)).str().c_str()
            );
        }
    }
}


<commit_msg>WHAT attribute added to locations<commit_after>/**
 *
 * FaZend.com, Fully Automated Zend Framework
 * RQDQL.com, Requirements Definition and Query Language
 *
 * Redistribution and use in source and binary forms, with or 
 * without modification, are PROHIBITED without prior written 
 * permission from the author. This product may NOT be used 
 * anywhere and on any computer except the server platform of 
 * FaZend.com. located at www.fazend.com. If you received this 
 * code occasionally and without intent to use it, please report 
 * this incident to the author by email: <EMAIL>
 *
 * @author <NAME> <<EMAIL>>
 * @copyright Copyright (c) rqdql.com, 2010
 * @version $Id: UseCase.h 1641 2010-04-16 07:56:07Z <EMAIL> $
 *
 * This file is included ONLY from Front.h
 */

void Links::fillNode(pugi::xml_node& n) {
    using namespace pugi;

    typedef vector<rqdql::Logger::Link> Links;
    Links v = rqdql::Logger::getInstance().getLinks();
    
    map<int, int> links;
    for (Links::const_iterator i = v.begin(); i != v.end(); ++i) {
        for (vector<int>::const_iterator k = (*i).getLeftLines().begin(); k != (*i).getLeftLines().end(); ++k) {
            for (vector<int>::const_iterator j = (*i).getRightLines().begin(); j != (*i).getRightLines().end(); ++j) {
                links[*k] = *j;
            }
        }
    }

    pugi::xml_node x = n.append_child();
    x.set_name("crosses");
    for (map<int, int>::const_iterator i = links.begin(); i != links.end(); ++i) {
        pugi::xml_node l = x.append_child();
        l.set_name("link");
        l.append_child().set_name("left");
        l.child("left").append_child(pugi::node_pcdata).set_value((boost::format("%d") % (*i).first).str().c_str());
        l.append_child().set_name("right");
        l.child("right").append_child(pugi::node_pcdata).set_value((boost::format("%d") % (*i).second).str().c_str());
    }

    x = n.append_child();
    x.set_name("locations");

    /**
     * @todo Totally ineffective implementation now!!
     */

    vector<string> types = proxy::Proxy::getInstance().getTypeNames();
    for (vector<string>::const_iterator i = types.begin(); i != types.end(); ++i) {
        vector<int> lines = rqdql::Logger::getInstance().getLinesFor(proxy::Proxy::getInstance().getType(*i));
        if (lines.empty()) {
            continue;
        }

        pugi::xml_node t = x.append_child();
        t.set_name("loc");
        t.append_attribute("name").set_value((*i).c_str());
        t.append_attribute("what").set_value("type");
        for (vector<int>::const_iterator j = lines.begin(); j != lines.end(); ++j) {
            pugi::xml_node loc = t.append_child();
            loc.set_name("line");
            loc.append_child(pugi::node_pcdata).set_value(
                (boost::format("%d") % (*j)).str().c_str()
            );
        }
    }

    vector<string> useCases = proxy::Proxy::getInstance().getAllUseCaseNames();
    for (vector<string>::const_iterator i = useCases.begin(); i != useCases.end(); ++i) {
        vector<int> lines = rqdql::Logger::getInstance().getLinesFor(proxy::Proxy::getInstance().getUseCase(*i));
        if (lines.empty()) {
            continue;
        }

        pugi::xml_node t = x.append_child();
        t.set_name("loc");
        t.append_attribute("name").set_value((*i).c_str());
        t.append_attribute("what").set_value("uc");
        for (vector<int>::const_iterator j = lines.begin(); j != lines.end(); ++j) {
            pugi::xml_node loc = t.append_child();
            loc.set_name("line");
            loc.append_child(pugi::node_pcdata).set_value(
                (boost::format("%d") % (*j)).str().c_str()
            );
        }
    }
}



{'fraction_non_alphanumeric': 0.1818431157432803, 'fraction_numerical': 0.006034009873834339, 'mean_word_length': 2.9315363881401617, 'pattern_counts': {'":': 0, '<': 39, '<?xml version=': 0, '>': 39, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 14}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3505543', 'n_tokens_mistral': 2416, 'n_tokens_neox': 2325, 'n_words': 476}