/** * Compares this unit with the given object for equality, * optionally ignoring metadata and rounding errors. */ @Override public boolean equals(final Object other, final ComparisonMode mode) { if (other == null || other.getClass() != getClass()) { return false; } if (mode.isIgnoringMetadata()) { return true; } final AbstractUnit<?> that = (AbstractUnit<?>) other; return equals(epsg, that.epsg) && equals(scope, that.scope) && Objects.equals(symbol, that.symbol); }
/** * Compares this unit with the given object for equality, * optionally ignoring metadata and rounding errors. */ @Override public boolean equals(final Object other, final ComparisonMode mode) { if (other == null || other.getClass() != getClass()) { return false; } if (mode.isIgnoringMetadata()) { return true; } final AbstractUnit<?> that = (AbstractUnit<?>) other; return equals(epsg, that.epsg) && equals(scope, that.scope) && Objects.equals(symbol, that.symbol); }
if (other == null) return false; if (proxy.getClass() == other.getClass()) { if (mode.isIgnoringMetadata()) { return true;
if (other == null) return false; if (proxy.getClass() == other.getClass()) { if (mode.isIgnoringMetadata()) { return true;
/** * Compares the given objects for equality, ignoring parameter order in "ignore metadata" mode. */ static boolean equals(final Parameters expected, final ParameterValueGroup actual, final ComparisonMode mode) { if (!Utilities.deepEquals(expected.getDescriptor(), actual.getDescriptor(), mode)) { return false; } if (!mode.isIgnoringMetadata()) { return Utilities.deepEquals(expected.values(), actual.values(), mode); } final List<GeneralParameterValue> values = new LinkedList<>(expected.values()); scan: for (final GeneralParameterValue param : actual.values()) { final Iterator<GeneralParameterValue> it = values.iterator(); while (it.hasNext()) { if (Utilities.deepEquals(it.next(), param, mode)) { it.remove(); continue scan; } } return false; // A parameter from 'actual' has not been found in 'expected'. } return values.isEmpty(); }
/** * Compares the given objects for equality, ignoring parameter order in "ignore metadata" mode. */ static boolean equals(final Parameters expected, final ParameterValueGroup actual, final ComparisonMode mode) { if (!Utilities.deepEquals(expected.getDescriptor(), actual.getDescriptor(), mode)) { return false; } if (!mode.isIgnoringMetadata()) { return Utilities.deepEquals(expected.values(), actual.values(), mode); } final List<GeneralParameterValue> values = new LinkedList<>(expected.values()); scan: for (final GeneralParameterValue param : actual.values()) { final Iterator<GeneralParameterValue> it = values.iterator(); while (it.hasNext()) { if (Utilities.deepEquals(it.next(), param, mode)) { it.remove(); continue scan; } } return false; // A parameter from 'actual' has not been found in 'expected'. } return values.isEmpty(); }
/** * Compares this object with the given one for equality. * * @param object the object to compare with this reference system. * @param mode the strictness level of the comparison. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (super.equals(object, mode) && (object instanceof ReferenceSystem)) { final ReferenceSystem that = (ReferenceSystem) object; if (mode.isIgnoringMetadata()) { // Compare the name because it was ignored by super.equals(…) in "ignore metadata" mode. return Objects.equals(getName(), that.getName()); } return that.getDomainOfValidity() == null && that.getScope() == null; } return false; } }
/** * Compares this object with the given one for equality. * * @param object the object to compare with this reference system. * @param mode the strictness level of the comparison. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (super.equals(object, mode) && (object instanceof ReferenceSystem)) { final ReferenceSystem that = (ReferenceSystem) object; if (mode.isIgnoringMetadata()) { // Compare the name because it was ignored by super.equals(…) in "ignore metadata" mode. return Objects.equals(getName(), that.getName()); } return that.getDomainOfValidity() == null && that.getScope() == null; } return false; } }
if (mode.isIgnoringMetadata()) { return true;
if (mode.isIgnoringMetadata()) { return true;
/** * Compares this object with the given one for equality. * This method compares the {@linkplain #name} only in "strict" or "by contract" modes. * If name is a critical component of this object, then it shall be compared by the subclass. * This behavior is consistent with {@link org.apache.sis.referencing.AbstractIdentifiedObject}. * * @param object the object to compare with this identified object. * @param mode the strictness level of the comparison. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (object == this) { return true; } if (object instanceof IdentifiedObject) { if (mode != ComparisonMode.STRICT || object.getClass() == getClass()) { if (mode.isIgnoringMetadata()) { return true; } final IdentifiedObject that = (IdentifiedObject) object; return Objects.equals(getName(), that.getName()) && isNullOrEmpty(that.getIdentifiers()) && isNullOrEmpty(that.getAlias()) && that.getRemarks() == null; } } return false; }
/** * Compares this object with the given one for equality. * This method compares the {@linkplain #name} only in "strict" or "by contract" modes. * If name is a critical component of this object, then it shall be compared by the subclass. * This behavior is consistent with {@link org.apache.sis.referencing.AbstractIdentifiedObject}. * * @param object the object to compare with this identified object. * @param mode the strictness level of the comparison. * @return {@code true} if both objects are equal. */ @Override public boolean equals(final Object object, final ComparisonMode mode) { if (object == this) { return true; } if (object instanceof IdentifiedObject) { if (mode != ComparisonMode.STRICT || object.getClass() == getClass()) { if (mode.isIgnoringMetadata()) { return true; } final IdentifiedObject that = (IdentifiedObject) object; return Objects.equals(getName(), that.getName()) && isNullOrEmpty(that.getIdentifiers()) && isNullOrEmpty(that.getAlias()) && that.getRemarks() == null; } } return false; }
that.getValueClass() == getValueClass()) if (mode.isIgnoringMetadata()) { return Objects.equals(toString(getName()), toString(that.getName()));
that.getValueClass() == getValueClass()) if (mode.isIgnoringMetadata()) { return Objects.equals(toString(getName()), toString(that.getName()));
if ((mode.isIgnoringMetadata() || (deepEquals(getScope(), that.getScope(), mode) && deepEquals(getDomainOfValidity(), that.getDomainOfValidity(), mode) && if (mode.isIgnoringMetadata()) { mode = ComparisonMode.ALLOW_VARIANT;
if ((mode.isIgnoringMetadata() || (deepEquals(getScope(), that.getScope(), mode) && deepEquals(getDomainOfValidity(), that.getDomainOfValidity(), mode) && if (mode.isIgnoringMetadata()) { debug = (mode == ComparisonMode.DEBUG); mode = ComparisonMode.ALLOW_VARIANT;