/* compute SA */ static void induceSA(const unsigned char *T, int *SA, int *C, int *B, int n, int k, int cs) { int *b, i, j; int c0, c1; /* compute SAl */ if (C == B) getCounts(T, C, n, k, cs); getBuckets(C, B, k, 0); /* find starts of buckets */ j = n - 1; b = SA + B[c1 = chr(j)]; *b++ = ((0 < j) && (chr(j - 1) < c1)) ? ~j : j; for (i = 0; i < n; ++i) { j = SA[i], SA[i] = ~j; if (0 < j) { --j; if ((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } *b++ = ((0 < j) && (chr(j - 1) < c1)) ? ~j : j; } } /* compute SAs */ if (C == B) getCounts(T, C, n, k, cs); getBuckets(C, B, k, 1); /* find ends of buckets */ for (i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) { if (0 < (j = SA[i])) { --j; if ((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } *--b = ((j == 0) || (chr(j - 1) > c1)) ? ~j : j; } else SA[i] = ~j; } }
void AMDeadTimeButton::updateToolTip() { QString toolTip = ""; // Add the index, if we can display index information. if (canDisplayIndex()) toolTip.append(QString("%1").arg(index_)); // Add separator, if needed. if (canDisplayIndex() && isEnabled() && (canDisplayPercentage() || canDisplayCounts() || canDisplayCountRate())) toolTip.append(": "); // Add the counts information. if (countsMode_ == Percent && canDisplayPercentage()) toolTip.append(QString("%1%").arg(getPercent(), 0, 'f', 0)); else if (countsMode_ == Counts && canDisplayCounts()) toolTip.append(QString("%1 counts").arg(getCounts())); else if (countsMode_ == CountRate && canDisplayCountRate()) toolTip.append(QString("%1 counts/s").arg(getCountRate())); setToolTip(toolTip); }
void AMDeadTimeButton::updateColorState() { ColorState newState = AMToolButton::None; if (hasDeadTimeSources() || hasICRDataSource()) { // Identify the value used for color state comparison. double newValue = badReferencePoint_; if (countsMode_ == Percent && canDisplayPercentage()) newValue = getPercent(); else if (countsMode_ == Counts && canDisplayCounts()) newValue = getCounts(); else if (countsMode_ == CountRate && canDisplayCountRate()) newValue = getCountRate(); // Identify the new color state. if (newValue < goodReferencePoint_) newState = AMToolButton::Good; else if (newValue >= goodReferencePoint_ && newValue < badReferencePoint_) newState = AMToolButton::Neutral; else newState = AMToolButton::Bad; } setColorState(newState); }
/* sort all type LMS suffixes */ static void LMSsort1(const void *T, sais_index_type *SA, sais_index_type *C, sais_index_type *B, sais_index_type n, sais_index_type k, int cs) { sais_index_type bb, i, j; sais_index_type c0, c1; /* compute SAl */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 0); /* find starts of buckets */ j = n - 1; bb = B[c1 = chr(j)]; --j; SA[bb++] = (chr(j) < c1) ? ~j : j; for(i = 0; i < n; ++i) { if(0 < (j = SA[i])) { assert(chr(j) >= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = bb; bb = B[c1 = c0]; } assert(i < bb); --j; SA[bb] = (chr(j) < c1) ? ~j : j; ++bb; SA[i] = 0; } else if(j < 0) { SA[i] = ~j; } } /* compute SAs */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 1); /* find ends of buckets */ for(i = n - 1, bb = B[c1 = 0]; 0 <= i; --i) { if(0 < (j = SA[i])) { assert(chr(j) <= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = bb; bb = B[c1 = c0]; } assert((bb) <= i); --j; SA[--bb] = (chr(j) > c1) ? ~(j + 1) : j; SA[i] = 0; } } }
void LMSsort1(string_type T, sarray_type SA, bucketC_type C, bucketB_type B, index_type n, index_type k, bool recount) { typedef typename TextValueType<string_type>::value_type char_type; sarray_type b; index_type i, j; char_type c0, c1; /* compute SAl */ if(recount != false) { getCounts(T, C, n, k); } getBuckets(C, B, k, false); /* find starts of buckets */ j = n - 1; b = SA + B[c1 = T[j]]; --j; *b++ = (T[j] < c1) ? ~j : j; for(i = 0; i < n; ++i) { if(0 < (j = SA[i])) { assert(T[j] >= T[j + 1]); if((c0 = T[j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } assert(i < (b - SA)); --j; *b++ = (T[j] < c1) ? ~j : j; SA[i] = 0; } else if(j < 0) { SA[i] = ~j; } } /* compute SAs */ if(recount != false) { getCounts(T, C, n, k); } getBuckets(C, B, k, true); /* find ends of buckets */ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) { if(0 < (j = SA[i])) { assert(T[j] <= T[j + 1]); if((c0 = T[j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } assert((b - SA) <= i); --j; *--b = (T[j] > c1) ? ~(j + 1) : j; SA[i] = 0; } } }
/* sort all type LMS suffixes */ static void LMSsort1(const void *T, int *SA, int *C, int *B, int n, int k, int cs) { int *b, i, j; int c0, c1; /* compute SAl */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 0); /* find starts of buckets */ j = n - 1; b = SA + B[c1 = chr(j)]; --j; *b++ = (chr(j) < c1) ? ~j : j; for(i = 0; i < n; ++i) { if(0 < (j = SA[i])) { assert(chr(j) >= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } assert(i < (b - SA)); --j; *b++ = (chr(j) < c1) ? ~j : j; SA[i] = 0; } else if(j < 0) { SA[i] = ~j; } } /* compute SAs */ if(C == B) { getCounts(T, C, n, k, cs); } getBuckets(C, B, k, 1); /* find ends of buckets */ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) { if(0 < (j = SA[i])) { assert(chr(j) <= chr(j + 1)); if((c0 = chr(j)) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; } assert((b - SA) <= i); --j; *--b = (chr(j) > c1) ? ~(j + 1) : j; SA[i] = 0; } } }
void FanucAdapter::gatherDeviceData() { if (!mConnected) connect(); else { getPositions(); getAxisLoad(); getSpindleLoad(); getStatus(); getMessages(); getMacros(); getPMC(); getCounts(); getToolData(); } }
/* * find the suffix array SA of T[0..n-1] in {0..k-1}^n use a working * space (excluding T and SA) of at most 2n+O(1) for a constant alphabet */ static int sais_main(const unsigned char *T, seqint_t *SA, seqint_t fs, seqint_t n, seqint_t k, int cs) { seqint_t *C, *B, *RA; seqint_t j, c, m, p, q, plen, qlen, name; long int i; seqint_t c0, c1; seqint_t diff; /* stage 1: reduce the problem by at least 1/2 sort all the * S-substrings */ if (k <= fs) { C = SA + n; B = (k <= (fs - k)) ? C + k : C; } else if ((C = B = (seqint_t *) malloc(k * sizeof(seqint_t))) == NULL) return -2; getCounts(T, C, n, k, cs); getBuckets(C, B, k, 1); /* find ends of buckets */ for (i = 0; i < n; ++i) SA[i] = 0; for (i = n - 2, c = 0, c1 = chr(n - 1); 0 <= i; --i, c1 = c0) { if ((c0 = chr(i)) < (c1 + c)) c = 1; else if (c != 0) SA[--B[c1]] = i + 1, c = 0; } induceSA(T, SA, C, B, n, k, cs); if (fs < k) free(C); /* compact all the sorted substrings into the first m items of SA * 2*m must be not larger than n (proveable) */ for (i = 0, m = 0; i < n; ++i) { p = SA[i]; if ((0 < p) && (chr(p - 1) > (c0 = chr(p)))) { for (j = p + 1; (j < n) && (c0 == (c1 = chr(j))); ++j); if ((j < n) && (c0 < c1)) SA[m++] = p; } } for (i = m; i < n; ++i) SA[i] = 0; /* init the name array buffer */ /* store the length of all substrings */ for (i = n - 2, j = n, c = 0, c1 = chr(n - 1); 0 <= i; --i, c1 = c0) { if ((c0 = chr(i)) < (c1 + c)) c = 1; else if (c != 0) { SA[m + ((i + 1) >> 1)] = j - i - 1; j = i + 1; c = 0; } }
void NmdcHub::myInfo() { checkstate(); dcdebug("MyInfo %s...\n", getNick().c_str()); lastCounts = counts; string tmp1 = ";**\x1fU9"; string tmp2 = "+L9"; string tmp3 = "+G9"; string tmp4 = "+R9"; string tmp5 = "+N9"; string::size_type i; for(i = 0; i < 6; i++) { tmp1[i]++; } for(i = 0; i < 3; i++) { tmp2[i]++; tmp3[i]++; tmp4[i]++; tmp5[i]++; } char modeChar = '?'; if(SETTING(CONNECTION_TYPE) == SettingsManager::CONNECTION_ACTIVE) modeChar = 'A'; else if(SETTING(CONNECTION_TYPE) == SettingsManager::CONNECTION_PASSIVE) modeChar = 'P'; else if(SETTING(CONNECTION_TYPE) == SettingsManager::CONNECTION_SOCKS5) modeChar = '5'; string uMin = (SETTING(MIN_UPLOAD_SPEED) == 0) ? Util::emptyString : tmp5 + Util::toString(SETTING(MIN_UPLOAD_SPEED)); string minf = "$MyINFO $ALL " + toNmdc(checkNick(getNick())) + " " + toNmdc(Util::validateMessage(getDescription(), false)) + tmp1 + VERSIONSTRING + tmp2 + modeChar + tmp3 + getCounts() + tmp4 + Util::toString(SETTING(SLOTS)) + uMin + ">$ $" + SETTING(CONNECTION) + "\x01$" + toNmdc(Util::validateMessage(SETTING(EMAIL), false)) + '$' + ShareManager::getInstance()->getShareSizeString() + "$|"; if(minf != lastMyInfo) { send(minf); lastMyInfo = minf; } }
/* * potentially it is step can be done within the same loop in gating * TODO:MFI can be calculated here as well */ void nodeProperties::computeStats(){ fcStats["count"]=getCounts(); }