From: Matthew Khouzam Date: Thu, 26 Feb 2015 20:06:11 +0000 (-0500) Subject: ctf: reduce complexity in VariantDeclaration equals X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=069efcf54cdb49ecee2f92ebdd71e963dce97937;p=deliverable%2Ftracecompass.git ctf: reduce complexity in VariantDeclaration equals Change-Id: I2b05afc385b66855ee136248452b3ebebe62b8a8 Signed-off-by: Matthew Khouzam Reviewed-on: https://git.eclipse.org/r/42839 Reviewed-by: Hudson CI Reviewed-by: Alexandre Montplaisir Tested-by: Alexandre Montplaisir --- diff --git a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java index 5ef3e95b23..2a9e4f529b 100644 --- a/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java +++ b/org.eclipse.tracecompass.ctf.core/src/org/eclipse/tracecompass/ctf/core/event/types/VariantDeclaration.java @@ -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;