void TR::DebugCounterGroup::accumulate() { // TODO: Note that this is O(k * n); we should be able to do this better with // a breadth-first visit from the leaves upward. ListIterator<TR::DebugCounter> li(&_counters); for (TR::DebugCounter *counter = li.getCurrent(); counter; counter = li.getNext()) counter->accumulate(); if (!_counters.isEmpty()) { ListIterator<TR::DebugCounterAggregation> li2(&_aggregations); for (TR::DebugCounterAggregation *aggregatedCounters = li2.getCurrent(); aggregatedCounters; aggregatedCounters = li2.getNext()) aggregatedCounters->accumulate(); } }
double li2(double x) { double pi, sum=0.0, term, top, z ; int k ; pi = acos(0.0)*2.0 ; if (x<=0.0) return pi*pi/6.0 ; if (x>=1.0) return 0 ; if (x<0.5) { return (-log(x)*log(1-x) + (pi*pi/6.0) -li2(1.0-x)) ; } z = 1-x ; top = 1.0 ; for (k=1; k<= 100; k++) { top *= z ; term = top/(double) (k*k) ; sum += term ; if (term <= 1.0e-20) break ; } return sum ; }
double dilog(double x) { return li2(x) ; }
void testpluginPlugin::getCatalog(QList<CatItem>* items) { items = items; CatItem me(itemPath); #ifdef TEST Q_ASSERT(items); CatItem cv("test://catalogTestVerb", testVerbStr, TEST_HASH); cv.setItemType(CatItem::VERB); items->append(cv); CatItem ci("test://catalogTestNounItem", testNounStr , TEST_HASH); CatItem c("testCatalogChildItem", "testChild", TEST_HASH); ci.addChild(c); items->append(ci); for(uint i=0; i < str_len;i++){ QString out_str = str_list[i][1]; CatItem it(out_str, out_str, TEST_HASH); it.setExternalWeight(MAX_EXTERNAL_WEIGHT, me); qDebug() << "test item path: " << it.getPath(); qDebug() << "test item name: " << it.getName(); items->append(it); } QFileInfo fileInfo("~/.oneline/custom_actions/Send_Email.oneline"); Q_ASSERT(fileInfo.exists()); QSettings s(fileInfo.absoluteFilePath(), QSettings::IniFormat); CatItem custI(&s); // CatItem custI("vTestCustomVerb", testCustomVerbStr, TEST_HASH); // custI.setCustomPluginValue(MIN_ARG_NUM_KEY,2); // custI.setCustomPluginInfo(VERB_ARG "1","built-in://long-text | body | %s"); // custI.setCustomPluginInfo(VERB_ARG "2","tag://email-address | recipient(s) | to %s "); // custI.setCustomPluginInfo(VERB_ARG "3","tag://email-address | recipient(s) | to %s "); // custI.setCustomPluginInfo(CUSTOM_ACTION_KEY,"test_action.sh"); #endif #ifdef TEST_GUI Q_ASSERT(items); CatItem ci("catalogTestItem", "testItem", TEST_HASH); ci.setExternalWeight(HIGH_EXTERNAL_WEIGHT,me); ci.addChild(CatItem("testCatalogChildItem", "testChild", TEST_HASH)); items->append(ci); for(uint i=0; i < str_len;i++){ QString out_str = str_list[i][1]; CatItem it(out_str, out_str, TEST_HASH); items->append(it); } CatItem ci0("AHighttestResultItem", "AHighcustom",TEST_HASH); ci0.setExternalWeight(HIGH_EXTERNAL_WEIGHT,me); items->append(ci0); CatItem ci1("AtestResultSource", "Acustom",TEST_HASH); ci1.setItemType(CatItem::TAG); CatItem childI1("AtestResultChild", "nps_child",TEST_HASH); ci1.addChild(childI1); items->append(childI1); items->append(ci1); CatItem ci2("XtestResultSource", "Xcustom",TEST_HASH); ci2.setItemType(CatItem::TAG); CatItem childI2("XtestResultChild", "wmv_child",TEST_HASH); ci2.addChild(childI2); items->append(childI2); items->append(ci2); CatItem ci3("UtestResultSource", "Ucustom",TEST_HASH); ci3.setItemType(CatItem::TAG); CatItem childI3("UtestResultChild", "pst_child",TEST_HASH); ci3.addChild(childI3); items->append(ci3); items->append(childI3); for(uint i=0; i < fill_len;i++){ QString out_str = fill_list[i][1]; CatItem it(out_str, out_str, TEST_HASH); items->append(it); } CatItem it("tag item"); it.setItemType(CatItem::OPERATION); it.setTakesAnykeys(true); for(int i=0; i< 20; i++){ CatItem it(QString::number(i)); ListItem li(it); for(int j=0; j< 30; j++){ CatItem it2(numAsStr(i)); ListItem li2(it2); li.setTotalWeight(abs(5000 - j*j*10 + i*i*i)); li.addChild(li2); if(j % 3 ==0){ tl.append(li2); } } if(i%5 ==0){ tl.append(li); } } #endif }