ctf: reduce complexity in VariantDeclaration equals
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Thu, 26 Feb 2015 20:06:11 +0000 (15:06 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 27 Feb 2015 22:47:23 +0000 (17:47 -0500)
Change-Id: I2b05afc385b66855ee136248452b3ebebe62b8a8
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/42839
Reviewed-by: Hudson CI
Reviewed-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Tested-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java

index 5ef3e95b23a037942041cf7e16b10d04996fc407..2a9e4f529b3855e640ab591a2cf33739ffa4ffdb 100644 (file)
@@ -12,6 +12,8 @@
 
 package org.eclipse.tracecompass.ctf.core.event.types;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.equalsNullable;
+
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
@@ -232,34 +234,16 @@ public class VariantDeclaration extends Declaration {
         }
         // do not check the order of the fields
 
-        if (fFields == null) {
-            if (other.fFields != null) {
-                return false;
-            }
-        } else {
-            if( !fFields.equals(other.fFields)) {
-                return false;
-            }
+        if (!equalsNullable(fFields, other.fFields)) {
+            return false;
         }
-        if (fPrevDefinitionScope == null) {
-            if (other.fPrevDefinitionScope != null) {
-                return false;
-            }
-        } else if (!fPrevDefinitionScope.equals(other.fPrevDefinitionScope)) {
+        if (!equalsNullable(fPrevDefinitionScope, other.fPrevDefinitionScope)) {
             return false;
         }
-        if (fTag == null) {
-            if (other.fTag != null) {
-                return false;
-            }
-        } else if (!fTag.equals(other.fTag)) {
+        if (!equalsNullable(fTag, other.fTag)) {
             return false;
         }
-        if (fTagDef == null) {
-            if (other.fTagDef != null) {
-                return false;
-            }
-        } else if (!fTagDef.equals(other.fTagDef)) {
+        if (!equalsNullable(fTagDef, other.fTagDef)){
             return false;
         }
         return true;
This page took 0.025694 seconds and 5 git commands to generate.