const vector< shared_ptr<Manipulation> >& DividedHighwayMerger::findWayManipulations( shared_ptr<const OsmMap> map, const vector<long>& wids) { _result.clear(); _map = map; for (size_t i = 0; i < wids.size(); i++) { if (Log::getInstance().isInfoEnabled()) { printf("DividedHighwayMerger::findAllManipulations() %d \r", (int)_result.size()); fflush(stdout); } // evaluate the way to see if it is a divided highway candidate and add it to _result. _findMatches(wids[i]); } if (Log::getInstance().isInfoEnabled()) { printf("\n"); } // return the result return _result; }
std::vector<size_t> RabinKarp::all(std::string text, std::string pattern) { return _findMatches(text, pattern, false); }
size_t RabinKarp::match(std::string text, std::string pattern) { std::vector<size_t> matches = _findMatches(text, pattern, true); return matches.size() > 0 ? matches[0] : std::string::npos; }