sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1625022 - in /sis/branches/JDK8/core: sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
Date Mon, 15 Sep 2014 13:05:03 GMT
Author: desruisseaux
Date: Mon Sep 15 13:05:02 2014
New Revision: 1625022

URL: http://svn.apache.org/r1625022
Log:
Stricter check for equality.

Modified:
    sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
    sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java

Modified: sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java?rev=1625022&r1=1625021&r2=1625022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-metadata/src/main/java/org/apache/sis/internal/jaxb/metadata/replace/ServiceParameter.java
[UTF-8] Mon Sep 15 13:05:02 2014
@@ -39,6 +39,8 @@ import org.apache.sis.xml.Namespaces;
 import static org.apache.sis.internal.util.CollectionsExt.nonNull;
 import static org.apache.sis.internal.jaxb.gco.PropertyType.LEGACY_XML;
 
+import static org.apache.sis.util.Utilities.deepEquals;
+
 
 /**
  * Parameter information conform to the ISO 19115:2014 specification.
@@ -311,6 +313,9 @@ public final class ServiceParameter exte
      */
     @Override
     public boolean equals(final Object object, final ComparisonMode mode) {
+        if (object == this) {
+            return true;
+        }
         if (super.equals(object, mode) && object instanceof ParameterDescriptor<?>)
{
             final ParameterDescriptor<?> that = (ParameterDescriptor<?>) object;
             if (that.getUnit()         == null &&
@@ -320,7 +325,8 @@ public final class ServiceParameter exte
                 if (mode.ordinal() >= ComparisonMode.IGNORE_METADATA.ordinal()) {
                     return true;
                 }
-                return that.getMinimumOccurs() == getMinimumOccurs() &&
+                return deepEquals(that.getDescription(), getDescription(), mode) &&
+                       that.getMinimumOccurs() == getMinimumOccurs() &&
                        that.getMaximumOccurs() == getMaximumOccurs() &&
                        that.getValidValues()   == null &&
                        that.getMinimumValue()  == null &&

Modified: sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java?rev=1625022&r1=1625021&r2=1625022&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-utility/src/main/java/org/apache/sis/internal/simple/SimpleIdentifiedObject.java
[UTF-8] Mon Sep 15 13:05:02 2014
@@ -30,10 +30,8 @@ import org.apache.sis.internal.util.Cita
 import org.apache.sis.util.iso.DefaultNameSpace;
 import org.apache.sis.util.LenientComparable;
 import org.apache.sis.util.ComparisonMode;
-import org.apache.sis.util.Utilities;
 
-// Branch-dependent imports
-import java.util.Objects;
+import static org.apache.sis.util.Utilities.deepEquals;
 
 
 /**
@@ -180,15 +178,17 @@ public class SimpleIdentifiedObject impl
         if (object == this) {
             return true;
         }
-        if (mode == ComparisonMode.STRICT) {
-            if (object != null && object.getClass() == getClass()) {
-                final SimpleIdentifiedObject that = (SimpleIdentifiedObject) object;
-                return Objects.equals(name, that.name);
-            }
-        } else {
-            if (object instanceof IdentifiedObject) {
+        if (object instanceof IdentifiedObject) {
+            if (mode != ComparisonMode.STRICT || object.getClass() == getClass()) {
                 final IdentifiedObject that = (IdentifiedObject) object;
-                return Utilities.deepEquals(name, that.getName(), mode);
+                if (deepEquals(getName(), that.getName(), mode)) {
+                    if (mode.ordinal() >= ComparisonMode.IGNORE_METADATA.ordinal()) {
+                        return true;
+                    }
+                    return deepEquals(getAlias(),       that.getAlias(),       mode) &&
+                           deepEquals(getIdentifiers(), that.getIdentifiers(), mode) &&
+                           deepEquals(getRemarks(),     that.getRemarks(),     mode);
+                }
             }
         }
         return false;



Mime
View raw message