summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasplin <qt-info@nokia.com>2010-05-12 09:33:05 +0200
committerjasplin <qt-info@nokia.com>2010-05-12 09:33:05 +0200
commit72cb555cc27ef37ce8d8a810d0554ba2610d1f25 (patch)
treef84e237cec0986f0300f2f3dac2795adcf7012fa
parent417f2f91bb7dd10dff951f7f1bc3d6e25d85fed2 (diff)
Fixed bug.
-rw-r--r--src/bm/resulthistoryinfo.cpp28
-rw-r--r--src/bm/resulthistoryinfo.h4
2 files changed, 12 insertions, 20 deletions
diff --git a/src/bm/resulthistoryinfo.cpp b/src/bm/resulthistoryinfo.cpp
index c8bc2ca..d5dd4e5 100644
--- a/src/bm/resulthistoryinfo.cpp
+++ b/src/bm/resulthistoryinfo.cpp
@@ -133,21 +133,11 @@ bool ResultHistoryInfo::equal(int i, int j, int diffTolerance) const
// ### 2 B DOCUMENTED!
void ResultHistoryInfo::startSubsequence(
- int pos, qreal diffTolerance, QMap<int, int> *uniqueLevels, qreal *minLevel,
- qreal *maxLevel, bool insideRange, bool firstInsideRange) const
+ int pos, qreal diffTolerance, QMap<int, int> *uniqueLevels) const
{
Q_ASSERT(pos >= 0);
Q_ASSERT(pos < values.size());
- const qreal v = values.at(pos);
-
- if (firstInsideRange) {
- *minLevel = *maxLevel = v;
- } else if (insideRange) {
- *minLevel = qMin(*minLevel, v);
- *maxLevel = qMax(*maxLevel, v);
- }
-
QMap<int, int>::iterator it;
for (it = uniqueLevels->begin(); it != uniqueLevels->end(); ++it)
if (equal(pos, it.key(), diffTolerance))
@@ -234,18 +224,22 @@ void ResultHistoryInfo::computeStabilityStats(
if (insideRange && (!(*zerosFound)) && (values.at(i) == 0.0))
*zerosFound = true;
+ const qreal val = values.at(i);
+ if (firstInsideRange) {
+ *minLevel = *maxLevel = val;
+ } else if (insideRange) {
+ *minLevel = qMin(*minLevel, val);
+ *maxLevel = qMax(*maxLevel, val);
+ }
+
if (basePos == -1) {
basePos = i;
- startSubsequence(
- basePos, diffTolerance, &uniqueLevels_, minLevel, maxLevel, insideRange,
- firstInsideRange);
+ startSubsequence(basePos, diffTolerance, &uniqueLevels_);
} else if (!equal(basePos, i, diffTolerance)) {
endSubsequence(seqSize, total, stable, stabTolerance);
seqSize = 1;
basePos = i;
- startSubsequence(
- basePos, diffTolerance, &uniqueLevels_, minLevel, maxLevel, insideRange,
- firstInsideRange);
+ startSubsequence(basePos, diffTolerance, &uniqueLevels_);
}
if (i == values.size() - 1)
diff --git a/src/bm/resulthistoryinfo.h b/src/bm/resulthistoryinfo.h
index e74fc49..21132b9 100644
--- a/src/bm/resulthistoryinfo.h
+++ b/src/bm/resulthistoryinfo.h
@@ -101,9 +101,7 @@ private:
void markOutliers() const;
bool equal(int i, int j, int diffTolerance) const;
- void startSubsequence(
- int pos, qreal diffTolerance, QMap<int, int> *uniqueLevels, qreal *minLevel,
- qreal *maxLevel, bool insideRange, bool firstInsideRange = false) const;
+ void startSubsequence(int pos, qreal diffTolerance, QMap<int, int> *uniqueLevels) const;
static void endSubsequence(int seqSize, int *total, int *stable, int stabTolerance);
};