summaryrefslogtreecommitdiffstats
path: root/src/bm/asfstats.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bm/asfstats.cpp')
-rw-r--r--src/bm/asfstats.cpp33
1 files changed, 19 insertions, 14 deletions
diff --git a/src/bm/asfstats.cpp b/src/bm/asfstats.cpp
index 960e1c2..4074a77 100644
--- a/src/bm/asfstats.cpp
+++ b/src/bm/asfstats.cpp
@@ -124,9 +124,7 @@ Step 2: Sample the stable and smoothed RHs at fromTimestamp and toTimestamp and
// ### 2 B DOCUMENTED!
-void ASFStats::compute(
- const QList<ResultHistoryInfo *> &rhInfos, UnstableStats *usStats, int *regressed,
- int *unchanged, int *improved)
+void ASFStats::compute(const QList<ResultHistoryInfo *> &rhInfos, StatsInfo *statsInfo)
{
Q_ASSERT((fromTimestamp >= 0) && (fromTimestamp <= toTimestamp));
Q_ASSERT((diffTolerance >= 0.0) && (diffTolerance <= 100.0));
@@ -134,8 +132,15 @@ void ASFStats::compute(
Q_ASSERT((sfTolerance >= 0.0) && (sfTolerance <= 100.0));
Q_ASSERT((lfTolerance >= 0.0) && (lfTolerance <= 100.0));
- usStats->unstable.fill(false, rhInfos.size());
- *regressed = *unchanged = *improved = 0;
+ statsInfo->regressed.fill(false, rhInfos.size());
+ statsInfo->unchanged.fill(false, rhInfos.size());
+ statsInfo->improved.fill(false, rhInfos.size());
+ statsInfo->unstable.fill(false, rhInfos.size());
+ statsInfo->usZero.fill(false, rhInfos.size());
+ statsInfo->usLowFromPos.fill(false, rhInfos.size());
+ statsInfo->usLowSF.fill(false, rhInfos.size());
+ statsInfo->usLowLF.fill(false, rhInfos.size());
+ statsInfo->usHighMaxLD.fill(false, rhInfos.size());
for (int i = 0; i < rhInfos.size(); ++i) {
bool zerosFound = false;
@@ -162,29 +167,29 @@ void ASFStats::compute(
bool unstable = false;
if (zerosFound) {
unstable = true;
- ++(usStats->zeroCount);
+ statsInfo->usZero.setBit(i);
}
if (fromPos == -1) {
unstable = true;
- ++(usStats->lowFromPosCount);
+ statsInfo->usLowFromPos.setBit(i);
}
if (sf < sfTolerance) {
unstable = true;
- ++(usStats->lowSFCount);
+ statsInfo->usLowSF.setBit(i);
}
if (lf < lfTolerance) {
unstable = true;
- ++(usStats->lowLFCount);
+ statsInfo->usLowLF.setBit(i);
}
if (maxLD > maxLDTolerance) {
unstable = true;
- ++(usStats->highMaxLDCount);
+ statsInfo->usHighMaxLD.setBit(i);
}
if (unstable) {
// RH is unstable, so mark it as such ...
- usStats->unstable.setBit(i);
+ statsInfo->unstable.setBit(i);
} else {
// RH is stable, so sample the smoothed values at fromTimestamp and toTimestamp and
@@ -197,14 +202,14 @@ void ASFStats::compute(
const qreal v1 = rhInfos.at(i)->value(fromPos);
const qreal v2 = rhInfos.at(i)->value(toPos);
if ((100 * (qMax(v1, v2) / qMin(v1, v2) - 1)) <= diffTolerance) {
- ++(*unchanged);
+ statsInfo->unchanged.setBit(i);
} else {
const qreal diff =
BMMisc::lowerIsBetter(rhInfos.at(i)->metric()) ? (v1 - v2) : (v2 - v1);
if (diff < 0)
- ++(*regressed);
+ statsInfo->regressed.setBit(i);
else
- ++(*improved);
+ statsInfo->improved.setBit(i);
}
}
}