From 6973ec9109fd2651e2284663b6c8039bd830a677 Mon Sep 17 00:00:00 2001 From: liamfallon Date: Sat, 22 Sep 2018 21:07:43 +0100 Subject: Fix sonar problems in Apex Fixed some easy to resolve Sonar issues. Issue-ID: POLICY-1034 Change-Id: Ia8e4606bd4307daca499b4a74c96135211e572fd Signed-off-by: liamfallon --- .../apex/examples/adaptive/concepts/AnomalyDetection.java | 6 +++--- .../AnomalyDetectionPolicyDecideTaskSelectionLogic.java | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'examples/examples-adaptive') diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java index c70c9feb6..9dbfe266f 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/concepts/AnomalyDetection.java @@ -38,6 +38,9 @@ public class AnomalyDetection implements Serializable { private boolean firstRound = true; private int frequency = 0; + private List anomalyScores = new LinkedList<>(); + private List frequencyForecasted; + /** * The Constructor creates an AnomalyDetection instance. */ @@ -46,9 +49,6 @@ public class AnomalyDetection implements Serializable { frequency = 0; } - private List anomalyScores = new LinkedList<>(); - private List frequencyForecasted; - /** * Checks if the AnomalyDetection instance is initialized. * diff --git a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java index 5ee114e0e..ffbaf5905 100644 --- a/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java +++ b/examples/examples-adaptive/src/main/java/org/onap/policy/apex/examples/adaptive/model/java/AnomalyDetectionPolicyDecideTaskSelectionLogic.java @@ -47,6 +47,13 @@ public class AnomalyDetectionPolicyDecideTaskSelectionLogic { private static final double ANOMALY_SENSITIVITY = 0.05; private static final int FREQUENCY = 360; + /* + * Some utility methods + */ + // exponential = 2(n+1) + private static final double EMA_EXPONENT = 2.0 / (7.0 + 1.0); + private static final double EMA_EXPONENT_1 = (1.0 - EMA_EXPONENT); + /** * A map to hold the Anomaly degree/levels/probabilities required for each task.
* If there is no task defined for a calculated anomaly-degree, then the default task is @@ -295,13 +302,6 @@ public class AnomalyDetectionPolicyDecideTaskSelectionLogic { return pvalue; } - /* - * Some utility methods - */ - // exponential = 2(n+1) - private static final double EMA_EXPONENT = 2.0 / (7.0 + 1.0); - private static final double EMA_EXPONENT_1 = (1.0 - EMA_EXPONENT); - /** * exponential moving average. * -- cgit 1.2.3-korg