<commit_before>#ifndef IMPORTER_MINORTIMESCALCULATOR_HPP
#define IMPORTER_MINORTIMESCALCULATOR_HPP

class MinorTimesCalculator {
private:
    Nodestore *m_nodestore;
    DbAdapter *m_adapter;
    bool m_isupdate;
    bool m_showerrors;

protected:
    MinorTimesCalculator(Nodestore *nodestore, DbAdapter *adapter, bool isUpdate): m_nodestore(nodestore), m_adapter(adapter), m_isupdate(isUpdate), m_showerrors(false) {}

public:
    std::vector<time_t> *forWay(const Osmium::OSM::WayNodeList &nodes, time_t from, time_t to) {
        std::vector<time_t> *minor_times = new std::vector<time_t>();

        for(Osmium::OSM::WayNodeList::const_iterator nodeit = nodes.begin(); nodeit != nodes.end(); nodeit++) {
            osm_object_id_t id = nodeit->ref();

            bool found = false;
            Nodestore::timemap *tmap = m_nodestore->lookup(id, found);
            if(!found) {
                continue;
            }

            Nodestore::timemap_cit lower = tmap->lower_bound(from);
            Nodestore::timemap_cit upper = to == 0 ? tmap->end() : tmap->upper_bound(to);
            for(Nodestore::timemap_cit it = lower; it != upper; it++) {
                minor_times->push_back(it->first);
            }
        }

        std::sort(minor_times->begin(), minor_times->end());
        std::unique(minor_times->begin(), minor_times->end());

        return minor_times;
    }

    std::vector<time_t> *forWay(const Osmium::OSM::WayNodeList &nodes, time_t from) {
        return forWay(nodes, from, 0);
    }
};

class ImportMinorTimesCalculator : public MinorTimesCalculator {
public:<commit_msg>erase duplicate minor times from vector, fixes #4<commit_after>#ifndef IMPORTER_MINORTIMESCALCULATOR_HPP
#define IMPORTER_MINORTIMESCALCULATOR_HPP

class MinorTimesCalculator {
private:
    Nodestore *m_nodestore;
    DbAdapter *m_adapter;
    bool m_isupdate;
    bool m_showerrors;

protected:
    MinorTimesCalculator(Nodestore *nodestore, DbAdapter *adapter, bool isUpdate): m_nodestore(nodestore), m_adapter(adapter), m_isupdate(isUpdate), m_showerrors(false) {}

public:
    std::vector<time_t> *forWay(const Osmium::OSM::WayNodeList &nodes, time_t from, time_t to) {
        std::vector<time_t> *minor_times = new std::vector<time_t>();

        for(Osmium::OSM::WayNodeList::const_iterator nodeit = nodes.begin(); nodeit != nodes.end(); nodeit++) {
            osm_object_id_t id = nodeit->ref();

            bool found = false;
            Nodestore::timemap *tmap = m_nodestore->lookup(id, found);
            if(!found) {
                continue;
            }

            Nodestore::timemap_cit lower = tmap->lower_bound(from);
            Nodestore::timemap_cit upper = to == 0 ? tmap->end() : tmap->upper_bound(to);
            for(Nodestore::timemap_cit it = lower; it != upper; it++) {
                minor_times->push_back(it->first);
            }
        }

        std::sort(minor_times->begin(), minor_times->end());
        minor_times->erase(std::unique(minor_times->begin(), minor_times->end()), minor_times->end());

        return minor_times;
    }

    std::vector<time_t> *forWay(const Osmium::OSM::WayNodeList &nodes, time_t from) {
        return forWay(nodes, from, 0);
    }
};

class ImportMinorTimesCalculator : public MinorTimesCalculator {
public:
{'fraction_non_alphanumeric': 0.13, 'fraction_numerical': 0.0015151515151515152, 'mean_word_length': 3.326343381389253, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '1536165', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1095, 'n_words': 195}