From 8bad2ad828fad2f5f99a9a291ca0f5c51b62e4ca Mon Sep 17 00:00:00 2001 From: "waqas.ikram" Date: Wed, 30 May 2018 09:48:40 +0100 Subject: Fixing Sonar bugs and code smells Change-Id: I661cd409d01320fe11a29b7ea72b9e8f70e72a6c Issue-ID: POLICY-856 Signed-off-by: waqas.ikram --- .../policy/apex/model/enginemodel/concepts/AxEngineStats.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'model/engine-model/src/main/java/org') diff --git a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java index b7593e751..b35492356 100644 --- a/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java +++ b/model/engine-model/src/main/java/org/onap/policy/apex/model/enginemodel/concepts/AxEngineStats.java @@ -530,16 +530,14 @@ public class AxEngineStats extends AxConcept { if (lastExecutionTime != other.lastExecutionTime) { return (int) (lastExecutionTime - other.lastExecutionTime); } - if (averageExecutionTime != other.averageExecutionTime) { - return (int) (averageExecutionTime - other.averageExecutionTime); + final int result = Double.compare(averageExecutionTime, other.averageExecutionTime); + if (result != 0) { + return result; } if (upTime != other.upTime) { return (int) (upTime - other.upTime); } - if (getLastStart() != other.getLastStart()) { - return (int) (getLastStart() - other.getLastStart()); - } - return 0; + return Long.compare(lastStart, other.lastStart); } } -- cgit 1.2.3-korg