summaryrefslogtreecommitdiffstats
path: root/examples/examples-adaptive
diff options
context:
space:
mode:
authorramverma <ram.krishna.verma@ericsson.com>2018-07-27 10:40:01 +0100
committerramverma <ram.krishna.verma@ericsson.com>2018-07-27 10:41:24 +0100
commit7ab23ab0a54a6391f4c6bb37733fe10fc9e33a3f (patch)
treec4393f2bfddbc0ba412e94f7e92d90bffacd7d34 /examples/examples-adaptive
parentf8959f5c51e6338b62e23ea503eb86d9c65d7c74 (diff)
Fixing sonar bugs in apex-pdp
Sonar was complaining about direct comparision of double values. Changed the comparision to Double.compare(d1,d2). Change-Id: I3821924e606180626434d5bc41e29b9a8451a9b2 Issue-ID: POLICY-861 Signed-off-by: ramverma <ram.krishna.verma@ericsson.com>
Diffstat (limited to 'examples/examples-adaptive')
-rw-r--r--examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java
index a0b2a8f40..a044ad14b 100644
--- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java
+++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicy_Decide_TaskSelectionLogic.java
@@ -230,7 +230,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic {
while (pValue < significanceLevel) { // takes approx 20% of method time
// the score value as the anomaly probability
final double score = (significanceLevel - pValue) / significanceLevel;
- if (v == currentV) {
+ if (Double.compare(v, currentV) == 0) {
return score;
}
// do the critical check again for the left values
@@ -326,7 +326,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic {
*/
private static Double[] removevalue(final Double[] lValues, final double v) {
for (int i = 0; i < lValues.length; i++) {
- if (lValues[i] == v) {
+ if (Double.compare(lValues[i], v) == 0) {
final Double[] ret = new Double[lValues.length - 1];
System.arraycopy(lValues, 0, ret, 0, i);
System.arraycopy(lValues, i + 1, ret, i, lValues.length - i - 1);
@@ -389,7 +389,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic {
private static boolean isAllEqual(final List<Double> lValues) {
final double first = lValues.get(0);
for (final Double d : lValues) {
- if (d != first) {
+ if (Double.compare(d, first) != 0) {
return false;
}
}
@@ -405,7 +405,7 @@ public class AnomalyDetectionPolicy_Decide_TaskSelectionLogic {
private static boolean isAllEqual(final Double[] lValues) {
final double first = lValues[0];
for (final Double d : lValues) {
- if (d != first) {
+ if (Double.compare(d, first) != 0) {
return false;
}
}