diff options
author | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-14 21:47:34 +0200 |
---|---|---|
committer | Simon Brandhof <simon.brandhof@sonarsource.com> | 2014-10-14 21:47:34 +0200 |
commit | c809056c115524c9303c5b9c8e77964d976d4226 (patch) | |
tree | 22e770f6cf31f2d03a830eab04c6508a4c27f17a /plugins/sonar-core-plugin | |
parent | 3f74239a8255ad897c43b0b2fd260003b083eac9 (diff) | |
download | sonarqube-c809056c115524c9303c5b9c8e77964d976d4226.tar.gz sonarqube-c809056c115524c9303c5b9c8e77964d976d4226.zip |
Fix quality flaws
Diffstat (limited to 'plugins/sonar-core-plugin')
-rw-r--r-- | plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java index 32b760bc463..07fdef297f6 100644 --- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java +++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TendencyAnalyser.java @@ -52,17 +52,17 @@ public class TendencyAnalyser { for (Double p : values) { if (p != null) { nullValuesYList = false; - //SumY calculation + // SumY calculation sumY += p; // sumYPower2 calculation sumYPower2 += p * p; - //sumXY calculation + // sumXY calculation sumXY += p * (i + 1); - //SumX calculation + // SumX calculation sumX += (i + 1); - //sumXPower2 calculation + // sumXPower2 calculation sumXPower2 += (i + 1) * (i + 1); - //Point number calculation + // Point number calculation nbrPoints++; } i++; @@ -77,10 +77,10 @@ public class TendencyAnalyser { SlopeData result = new SlopeData(); - //yIntercept Calculation the value when X equals zero + // yIntercept Calculation the value when X equals zero result.setYIntercept(n1 / d); // Slope Calculation - if (n0 == 0d && d == 0d) { + if (Double.doubleToRawLongBits(n0) == 0L && Double.doubleToRawLongBits(d) == 0L) { result.setSlope(0.0); } else { Double slope = n0 / d; @@ -94,7 +94,7 @@ public class TendencyAnalyser { result.setSumXY(sumXY); result.setSumYPower2(sumYPower2); - if (sumXPower2 == 0 || sumYPower2 == 0) { + if (Double.doubleToRawLongBits(sumXPower2) == 0L || Double.doubleToRawLongBits(sumYPower2) == 0L) { result.setCorrelationRate(0.0); } else { result.setCorrelationRate(sumXY / Math.sqrt(sumXPower2 * sumYPower2)); @@ -103,7 +103,6 @@ public class TendencyAnalyser { return result; } - static class SlopeData { private double sumXPower2; private double sumYPower2; |