ArticleSearch::Results ArticleSearch::search(const std::string& expr) { Results ret; // TODO: implement title-cache #if 0 if (titles.empty()) { for (File::const_iterator it = articleFile.begin(); it != articleFile.end(); ++it) { if (article.isMainArticle() && article.getLibraryMimeType() == zim::Dirent::zimMimeTextHtml && article.getNamespace() == 'A') { titles.push_back(article.getTitle()); } } } #endif for (File::const_iterator it = articleFile.begin(); it != articleFile.end(); ++it) { std::string title = it->getTitle(); if (title.find(expr) != std::string::npos) ret.push_back(*it); } return ret; }
Results* ParentClause::evaluateS1WildS2Wild(string firstArgSyn, string secondArgSyn) { Results* resultsObj = new Results(); if(firstArgSyn == secondArgSyn) { return resultsObj; } if (firstArgType != stringconst::ARG_ASSIGN) { //first arg type can only be while //get all while statements set<Statement*> whileStmts = stmtTable->getWhileStmts(); if (secondArgType == stringconst::ARG_ASSIGN) { //for each while statement, get the children, add resultsObj = addParentPairToResult(whileStmts, ASSIGN_STMT_); } else if (secondArgType == stringconst::ARG_WHILE) { resultsObj = addParentPairToResult(whileStmts, WHILE_STMT_); } else { assert(secondArgType == stringconst::ARG_STATEMENT); resultsObj = addParentPairToResult(whileStmts, NULL_); } } if (resultsObj->isClausePassed()) { resultsObj->setNumOfSyn(2); resultsObj->setFirstClauseSyn(firstArgSyn); resultsObj->setSecondClauseSyn(secondArgSyn); } return resultsObj; }
void buildStats() { HGram::iterator iter; resultsData.tfMatrix = arma::zeros<arma::mat>(results.size(), _gramTable.size()); // Initialize the resultsData.dfVector.set_size(_gramTable.size()); resultsData.ctfVector.set_size(_gramTable.size()); int tmpTermID = -1; for( iter = _gramTable.begin(); iter != _gramTable.end(); iter++ ) { double gramCount = 0; ++tmpTermID; Gram* gram = *iter->first; GramCounts* gramCounts = *iter->second; gram->internal_termID = tmpTermID; terms.push_back(gram->term); if( resultsData.queryStems.find(gram->term) != resultsData.queryStems.end() ) resultsData.queryStemIndex[gram->term] = tmpTermID; resultsData.ctfVector(tmpTermID) = environment.stemCount(gram->term); resultsData.dfVector(tmpTermID) = environment.documentStemCount(gram->term); size_t c, r; for( r = 0, c = 0; r < results.size() && c < gramCounts->counts.size(); r++ ) { if( gramCounts->counts[c].first == r ) { resultsData.tfMatrix(r, tmpTermID) = gramCounts->counts[c].second; c++; } } } _gramTable.clear(); }
Results* ParentClause::evaluateS1FixedS2Fixed(string firstArgSyn, string secondArgSyn) { Results* resultsObj = new Results(); bool isClauseTrue = this->isParent(firstArgSyn, secondArgSyn); resultsObj->setClausePassed(isClauseTrue); resultsObj->setNumOfSyn(0); return resultsObj; }
void WriteResults (Results &results) { Results::Dictionary& results_dict = results.GetDictionary(); m_time_set_bp_main.WriteAverageAndStandardDeviation(results); results_dict.Add ("memory-change-create-target", "Memory increase that occurs due to creating the target.", m_memory_change_create_target.GetDeltaValue().GetResult(NULL, NULL)); results_dict.Add ("memory-change-break-main", "Memory increase that occurs due to setting a breakpoint at main by name.", m_memory_change_break_main.GetDeltaValue().GetResult(NULL, NULL)); m_time_create_target.WriteAverageAndStandardDeviation(results); m_expr_first_evaluate.WriteAverageAndStandardDeviation(results); m_expr_frame_zero.WriteAverageAndStandardDeviation(results); m_expr_frame_non_zero.WriteAverageAndStandardDeviation(results); results_dict.Add ("memory-total-break-main", "The total memory that the current process is using after setting the first breakpoint.", m_memory_total.GetStopValue().GetResult(NULL, NULL)); results_dict.AddDouble("time-launch-stop-main", "The time it takes to launch the process and stop at main.", m_time_launch_stop_main.GetDeltaValue()); results_dict.AddDouble("time-total", "The time it takes to create the target, set breakpoint at main, launch clang and hit the breakpoint at main.", m_time_total.GetDeltaValue()); results.Write(GetResultFilePath()); }
void DiagnosticDispatcher::HandleDiagnostic(clang::DiagnosticsEngine::Level diagnosticLevel, const clang::Diagnostic &diagnosticInfo) { clang::DiagnosticConsumer::HandleDiagnostic(diagnosticLevel, diagnosticInfo); clang::SourceLocation location = diagnosticInfo.getLocation(); clang::SourceManager *sourceManager = &diagnosticInfo.getSourceManager(); llvm::StringRef filename = sourceManager->getFilename(location); int line = sourceManager->getPresumedLineNumber(location); int column = sourceManager->getPresumedColumnNumber(location); clang::SmallString<100> diagnosticMessage; diagnosticInfo.FormatDiagnostic(diagnosticMessage); Violation violation(nullptr, filename.str(), line, column, 0, 0, diagnosticMessage.str().str()); Results *results = Results::getInstance(); if (_isCheckerCustomer) { results->addCheckerBug(violation); } else { if (diagnosticLevel == clang::DiagnosticsEngine::Warning) { results->addWarning(violation); } if (diagnosticLevel == clang::DiagnosticsEngine::Error || diagnosticLevel == clang::DiagnosticsEngine::Fatal) { results->addError(violation); } } }
void SendStatistics(SearchParams const & params, m2::RectD const & viewport, Results const & res) { size_t const kMaxNumResultsToSend = 10; size_t const numResultsToSend = min(kMaxNumResultsToSend, res.GetCount()); string resultString = strings::to_string(numResultsToSend); for (size_t i = 0; i < numResultsToSend; ++i) resultString.append("\t" + res.GetResult(i).ToStringForStats()); string posX, posY; if (params.IsValidPosition()) { posX = strings::to_string(MercatorBounds::LonToX(params.m_lon)); posY = strings::to_string(MercatorBounds::LatToY(params.m_lat)); } alohalytics::TStringMap const stats = { {"posX", posX}, {"posY", posY}, {"viewportMinX", strings::to_string(viewport.minX())}, {"viewportMinY", strings::to_string(viewport.minY())}, {"viewportMaxX", strings::to_string(viewport.maxX())}, {"viewportMaxY", strings::to_string(viewport.maxY())}, {"query", params.m_query}, {"locale", params.m_inputLocale}, {"results", resultString}, }; alohalytics::LogEvent("searchEmitResultsAndCoords", stats); }
Test::Results TestDefaultParameters::test(string key, Options options) { Plugin::FeatureSet f[2]; int rate = 44100; Results r; float **data = 0; size_t channels = 0; size_t count = 100; for (int run = 0; run < 2; ++run) { auto_ptr<Plugin> p(load(key, rate)); if (p->getParameterDescriptors().empty()) return r; if (run == 1) { Plugin::ParameterList pl = p->getParameterDescriptors(); for (int i = 0; i < (int)pl.size(); ++i) { if (p->getParameter(pl[i].identifier) != pl[i].defaultValue) { if (options & Verbose) { cout << "Parameter: " << pl[i].identifier << endl; cout << "Expected: " << pl[i].defaultValue << endl; cout << "Actual: " << p->getParameter(pl[i].identifier) << endl; } r.push_back(error("Not all parameters have their default values when queried directly after construction")); } p->setParameter(pl[i].identifier, pl[i].defaultValue); } } if (!initAdapted(p.get(), channels, _step, _step, r)) return r; if (!data) data = createTestAudio(channels, _step, count); for (size_t i = 0; i < count; ++i) { #ifdef __GNUC__ float *ptr[channels]; #else float **ptr = (float **)alloca(channels * sizeof(float)); #endif size_t idx = i * _step; for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; RealTime timestamp = RealTime::frame2RealTime(idx, rate); Plugin::FeatureSet fs = p->process(ptr, timestamp); appendFeatures(f[run], fs); } Plugin::FeatureSet fs = p->getRemainingFeatures(); appendFeatures(f[run], fs); } if (data) destroyTestAudio(data, channels); if (!(f[0] == f[1])) { string message = "Explicitly setting parameters to their supposed default values changes the results"; Result res; if (options & NonDeterministic) res = note(message); else res = error(message); if (options & Verbose) dumpDiff(res, f[0], f[1]); r.push_back(res); } else { r.push_back(success()); } return r; }
void writeSummary(ostream &out, Results &results) { out << "Summary: TotalFiles=" << results.numberOfFiles() << " "; out << "FilesWithViolations=" << results.numberOfFilesWithViolations() << " "; out << "P1=" << results.numberOfViolationsWithPriority(1) << " "; out << "P2=" << results.numberOfViolationsWithPriority(2) << " "; out << "P3=" << results.numberOfViolationsWithPriority(3) << " "; }
// Test augument-type combinations of Follows (1, a) where a is unfixed void FollowsClauseTest::testIsFollows2() { FollowsClause fol = *new FollowsClause(); // Test Follows(1, a) where a is an assign type fol.setFirstArg("1"); fol.setSecondArg("a"); fol.setFirstArgFixed(true); fol.setSecondArgFixed(false); fol.setFirstArgType(stringconst::ARG_ASSIGN); fol.setSecondArgType(stringconst::ARG_ASSIGN); Results r = fol.evaluate(); string res1 = "1"; string res2 = "2"; string res3 = "3"; CPPUNIT_ASSERT(r.isClausePassed()); CPPUNIT_ASSERT(r.getSinglesResults().at(0) == res2); // Test Follows(2, a) where a is an assign type fol.setFirstArg("2"); fol.setSecondArg("a"); fol.setFirstArgType(stringconst::ARG_STATEMENT); fol.setSecondArgType(stringconst::ARG_ASSIGN); Results r1 = fol.evaluate(); CPPUNIT_ASSERT(r1.isClausePassed()); CPPUNIT_ASSERT(r1.getSinglesResults().at(0) == res3); // Test Follows(2, a) where a is an assign type fol.setFirstArg("3"); fol.setSecondArg("a"); fol.setFirstArgType(stringconst::ARG_STATEMENT); fol.setSecondArgType(stringconst::ARG_ASSIGN); Results r2 = fol.evaluate(); CPPUNIT_ASSERT(!r2.isClausePassed()); // Test Follows(2,_) where _ is a generic type fol.setFirstArg("2"); fol.setSecondArg("_"); fol.setFirstArgType(stringconst::ARG_STATEMENT); fol.setSecondArgType(stringconst::ARG_GENERIC); Results r3 = fol.evaluate(); CPPUNIT_ASSERT(r3.isClausePassed()); return ; }
QueryRunner::Results QueryRunner::run(WMI::Connection& connection, const_iterator begin, const_iterator end) { Results results; for (const_iterator it = begin; it != end; ++it) results.push_back(run(connection, *it)); return results; }
void MainWindow::on_Search_clicked() { remove("/home/baigoo365/Proj_2/index.txt"); session sess("http://www.boost.org/"); sess.stringsearch(s); Results results; results.setModal(true); results.exec(); }
void Tester_68k::sampleSwap() { Results* oObj; MemoryBlock* oSampleMem; oObj = new Results("SWAP D1"); oObj->setN(); oObj->setRegD(1, 0x87561234); oObj->setCycleCount(4); }
void Tester_68k::sampleRts() { Results* oObj; MemoryBlock* oSampleMem; oObj = new Results("RTS"); oObj->setRegA(7, 0x2004); oObj->setRegIRD(0x4e71); oObj->setCycleCount(16); }
// Case: Uses(1,v) - stmt fixed, var wild Results UsesClause::evaluateStmtFixedVarWild() { Results res = Results(); // set synonyms if(this->getSecondArgType() == ARG_GENERIC) { res.setNumOfSyn(0); } else { res.setNumOfSyn(1); res.setFirstClauseSyn(this->getSecondArg()); } // get relevant stmts string firstArgType = this->getFirstArgType(); set<Statement*>::iterator stmtIter; set<Statement*> stmtSet; if(firstArgType == ARG_WHILE) { // only while stmts stmtSet = stmtTable->getWhileStmts(); } else if(firstArgType == ARG_ASSIGN) { // only assign stmts stmtSet = stmtTable->getAssgStmts(); } else { // all types of stmts stmtSet = stmtTable->getAllStmts(); } int stmtNum = lexical_cast<int>(this->getFirstArg()); // check stmts for(stmtIter=stmtSet.begin(); stmtIter!=stmtSet.end(); stmtIter++) { // current stmt Statement* currentStmt = *stmtIter; if(currentStmt->getStmtNum() == stmtNum) { // get set of variables current stmt uses Statement::UsesSet currentUses = currentStmt->getUses(); // check if stmt uses any variable if(currentUses.size() != 0) { res.setClausePassed(true); if(this->getSecondArgType() != ARG_GENERIC) { // add all pairs into results Statement::UsesSet::iterator setIter; for(setIter=currentUses.begin(); setIter!=currentUses.end(); setIter++) { res.addSingleResult(*setIter); } } } } } vector<string> temp1 = res.getSinglesResults(); vector<pair<string,string>> temp2 = res.getPairResults(); Utils::removeVectorDupes(temp1); Utils::removeVectorDupes(temp2); res.setSingleResult(temp1); res.setPairResult(temp2); return res; }
ResultsNotifier::ResultsNotifier(Results& target) : CollectionNotifier(target.get_realm()) , m_target_results(&target) , m_target_is_in_table_order(target.is_in_table_order()) { Query q = target.get_query(); set_table(*q.get_table()); m_query_handover = Realm::Internal::get_shared_group(*get_realm()).export_for_handover(q, MutableSourcePayload::Move); SortDescriptor::generate_patch(target.get_sort(), m_sort_handover); }
Test::Results TestLengthyConstructor::test(string key, Options) { time_t t0 = time(0); auto_ptr<Plugin> p(load(key)); time_t t1 = time(0); Results r; if (t1 - t0 > 1) r.push_back(warning("Constructor takes some time to run: work should be deferred to initialise?")); return r; }
FeaturesMULT::FeaturesMULT(vector<string>& frames, string type) { cv::TickMeter timeLocal; timeLocal.reset(); timeLocal.start(); int max_num_threads = omp_get_max_threads(); allHist.clear(); int id = 0; int jump = frames.size() / max_num_threads; if(type == "thr") { vector<thread> threads; for(int i=0; i<max_num_threads; i++) { if(i==max_num_threads-1) threads.push_back(thread(&FeaturesMULT::computeHist, this, std::ref(frames), id, (int)frames.size())); else threads.push_back(thread(&FeaturesMULT::computeHist, this, std::ref(frames), id, id+jump)); id+=jump; } for(int i=0; i<max_num_threads; i++) threads[i].join(); } else if(type == "omp") { int max_num_threads = omp_get_max_threads(); int framesPerThread = frames.size() / max_num_threads; omp_set_num_threads(max_num_threads); int id = 0; #pragma omp parallel for for(int i=0; i<max_num_threads; i++) { computeHistOMP(frames, i*framesPerThread, (i*framesPerThread)+framesPerThread); //cout << i*framesPerThread << "," << (i*framesPerThread)+framesPerThread << endl; //id+=framesPerThread; } } timeLocal.stop(); Results *result; result = Results::getInstance(); result->setFeatExtractionParallelPart(timeLocal.getTimeSec()); sort(allHist.begin(), allHist.end(), sortfunction1); }
int main(int argc, char** argv) { Years years; Years::Record* record_year; Results results; Results::Record* record_result; Stat stat_table; Clubs clubs; string path; if (argc > 1) { path = argv[1]; } else { path = "./data"; } ResultsDB::init(path); if (!years.open()) return EXIT_FAILURE; while ((record_year = years.next()) != NULL) { results.open(record_year->file_results); while ((record_result = results.next()) != NULL) { stat_table.add(record_result); } results.close(); } years.close(); vector<Stat::Record*>* v = stat_table.get_sorted_vector_by_default(); vector<Stat::Record*>::const_iterator iter; int place = 0; for (iter = v->begin(); iter != v->end(); ++iter) { place++; int w = ((*iter)->w1 + (*iter)->w2); int d = ((*iter)->d1 + (*iter)->d2); int l = ((*iter)->l1 + (*iter)->l2); int f = ((*iter)->f1 + (*iter)->f2); int a = ((*iter)->a1 + (*iter)->a2); cout << place << " " << clubs.get_latest_club_name((*iter)->team_id) << " " << (w + d + l) << " " << w << " " << d << " " << l << " " << f << ":" << a << " " << (2 * w + d) << " " << (*iter)->unknown << "?" << endl; } return (EXIT_SUCCESS); }
Results* ParentClause::evaluateS1WildS2Fixed(string firstArgSyn, string secondArgSyn) { Results* resultsObj = new Results(); int stmt1 = getParent(atoi(secondArgSyn.c_str())); if (stmt1 != -1) { resultsObj->setClausePassed(true); resultsObj->setNumOfSyn(1); resultsObj->setFirstClauseSyn(firstArgSyn); resultsObj->addSingleResult(boost::lexical_cast<string>(stmt1)); } return resultsObj; }
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PatternTable::Results PatternTable::matches(const Key &key) const { Results res; Rows::const_iterator it; for ( it = _rows.begin(); it != _rows.end(); ++it ) { if ( Core::wildcmp(it->first.first, key.first) && Core::wildcmp(it->first.second, key.second) ) res.push_back(it->second); } return res; }
// Test augument-type combinations of Follows (a, 1) where a is unfixed void FollowsClauseTest::testIsFollows3() { FollowsClause fol = *new FollowsClause(); // Test Follows(a, 1) where a is an assign type fol.setFirstArg("a"); fol.setSecondArg("2"); fol.setFirstArgFixed(false); fol.setSecondArgFixed(true); fol.setFirstArgType(stringconst::ARG_STATEMENT); fol.setSecondArgType(stringconst::ARG_ASSIGN); Results r = fol.evaluate(); string res1 = "1"; string res2 = "2"; string res3 = "3"; CPPUNIT_ASSERT(r.isClausePassed()); CPPUNIT_ASSERT(r.getSinglesResults().at(0) == res1); // Test Follows(a, 1) where a is an assign type fol.setFirstArg("a"); fol.setSecondArg("1"); fol.setFirstArgType(stringconst::ARG_STATEMENT); fol.setSecondArgType(stringconst::ARG_ASSIGN); Results r2 = fol.evaluate(); CPPUNIT_ASSERT(!r2.isClausePassed()); // Test Follows(_,3) where _ is a generic type fol.setFirstArg("_"); fol.setSecondArg("3"); fol.setFirstArgType(stringconst::ARG_GENERIC); fol.setSecondArgType(stringconst::ARG_STATEMENT); Results r3 = fol.evaluate(); /* cout << "singles Result size: " << r3.getSinglesResults().size() << endl; vector<string> resultSet = r3.getSinglesResults(); for (size_t i = 0; i < resultSet.size(); i++) { cout << "result: " << resultSet.at(i) << "!"; } */ CPPUNIT_ASSERT(r3.isClausePassed()); return ; }
void writeSummary(std::ostream &out, Results &results) { out << "<summary>"; writeSummaryProperty(out, "number of files", results.numberOfFiles()); writeSummaryProperty(out, "files with violations", results.numberOfFilesWithViolations()); writeSummaryProperty(out, "number of priority 1 violations", results.numberOfViolationsWithPriority(1)); writeSummaryProperty(out, "number of priority 2 violations", results.numberOfViolationsWithPriority(2)); writeSummaryProperty(out, "number of priority 3 violations", results.numberOfViolationsWithPriority(3)); out << "</summary>"; }
Results* ParentClause::evaluateS1FixedS2Wild(string firstArgSyn, string secondArgSyn, string secondArgType) { Results* resultsObj = new Results(); set<int> children = getChildren(firstArgSyn, secondArgType); if (!children.empty()) { resultsObj->setClausePassed(true); resultsObj->setNumOfSyn(1); resultsObj->setFirstClauseSyn(secondArgSyn); for (set<int>::iterator it = children.begin(); it != children.end(); ++it) { resultsObj->addSingleResult(boost::lexical_cast<string>(*it)); } } return resultsObj; }
int main() { Results results; string directory; ifstream inf("results.csv"); inf >> results; do{ cout << "Please enter a directory: "; cin >> directory; results.print(directory); } while (directory != "Done"); return 0; }
void writeSummary(std::ostream &out, Results &results) { writeKey(out, "summary"); out << "{"; writeKeyValue(out, "numberOfFiles", results.numberOfFiles()); writeKeyValue(out, "numberOfFilesWithViolations", results.numberOfFilesWithViolations()); writeKey(out, "numberOfViolationsWithPriority"); out << "["; writePriority(out, results, 1); out << ","; writePriority(out, results, 2); out << ","; writePriority(out, results, 3); out << "]},"; }
Test::Results TestDefaultProgram::test(string key, Options options) { Plugin::FeatureSet f[2]; int rate = 44100; Results r; float **data = 0; size_t channels = 0; size_t count = 100; for (int run = 0; run < 2; ++run) { auto_ptr<Plugin> p(load(key, rate)); if (p->getPrograms().empty()) return r; if (run == 1) { p->selectProgram(p->getCurrentProgram()); } if (!initAdapted(p.get(), channels, _step, _step, r)) return r; if (!data) data = createTestAudio(channels, _step, count); for (size_t i = 0; i < count; ++i) { #ifdef __GNUC__ float *ptr[channels]; #else float **ptr = (float **)alloca(channels * sizeof(float)); #endif size_t idx = i * _step; for (size_t c = 0; c < channels; ++c) ptr[c] = data[c] + idx; RealTime timestamp = RealTime::frame2RealTime(idx, rate); Plugin::FeatureSet fs = p->process(ptr, timestamp); appendFeatures(f[run], fs); } Plugin::FeatureSet fs = p->getRemainingFeatures(); appendFeatures(f[run], fs); } if (data) destroyTestAudio(data, channels); if (!(f[0] == f[1])) { string message = "Explicitly setting current program to its supposed current value changes the results"; Result res; if (options & NonDeterministic) res = note(message); else res = error(message); if (options & Verbose) dumpDiff(res, f[0], f[1]); r.push_back(res); } else { r.push_back(success()); } return r; }
void WriteResultsReport(ostream& report, const Results& counts) { size_t total = counts.Total(); report << fixed << setprecision(2); report << "Success -- CCS generated," << counts.Success << "," << 100.0 * counts.Success / total << '%' << endl; report << "Failed -- Below SNR threshold," << counts.PoorSNR << "," << 100.0 * counts.PoorSNR / total << '%' << endl; report << "Failed -- No usable subreads," << counts.NoSubreads << "," << 100.0 * counts.NoSubreads / total << '%' << endl; report << "Failed -- Insert size too small," << counts.TooShort << "," << 100.0 * counts.TooShort / total << '%' << endl; report << "Failed -- Not enough full passes," << counts.TooFewPasses << "," << 100.0 * counts.TooFewPasses / total << '%' << endl; report << "Failed -- Too many unusable subreads," << counts.TooManyUnusable << "," << 100.0 * counts.TooManyUnusable / total << '%' << endl; report << "Failed -- CCS did not converge," << counts.NonConvergent << "," << 100.0 * counts.NonConvergent / total << '%' << endl; report << "Failed -- CCS below minimum predicted accuracy," << counts.PoorQuality << "," << 100.0 * counts.PoorQuality / total << '%' << endl; report << "Failed -- Unknown error during processing," << counts.ExceptionThrown << "," << 100.0 * counts.ExceptionThrown / total << '%' << endl; }
void writePriority(std::ostream &out, Results &results, int priority) { out << "{"; writeKeyValue(out, "priority", priority); writeKeyValue(out, "number", results.numberOfViolationsWithPriority(priority), true); out << "}"; }
// ---------------------------------------------------------------------- void SimulationTaskLocalizationEvaluation:: run( SimulationController& sc ) throw( std::runtime_error ) { require_world( sc ); HeaderInfo header; Results results; header.collect_information( sc, *this ); results.collect_information( sc, *this ); print( header, results ); print_ps( sc, header ); write_out( sc, header, results ); }