This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit fc6e728866c65962856d31b384c9f0d2ea53a77d Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Fri Feb 9 18:43:17 2024 +0100 Use `==` instead of `equals` when comparing `java.lang.Class`, `java.lang.Enum` and `org.opengis.util.CodeList`. This is for consistency (we were applying a mix of boths) and for compile-time safety, as the compiler raises an error when comparing incompatible types. It also makes the code a little bit more readable. --- .../sis/coverage/grid/DimensionalityReduction.java | 4 ++-- .../sis/coverage/grid/GridCoverageProcessor.java | 2 +- .../org/apache/sis/coverage/grid/GridExtent.java | 2 +- .../org/apache/sis/coverage/grid/GridGeometry.java | 4 ++-- .../apache/sis/coverage/grid/PixelTranslation.java | 4 ++-- .../org/apache/sis/filter/DefaultSortProperty.java | 8 +++----- .../main/org/apache/sis/filter/LogicalFilter.java | 2 +- .../main/org/apache/sis/filter/UnaryFunction.java | 2 +- .../sis/geometry/wrapper/GeometryWrapper.java | 2 +- .../main/org/apache/sis/image/ImageAdapter.java | 2 +- .../apache/sis/metadata/ModifiableMetadata.java | 6 +++--- .../apache/sis/metadata/iso/DefaultMetadata.java | 4 ++-- .../sis/metadata/iso/citation/DefaultContact.java | 2 +- .../apache/sis/metadata/iso/extent/Extents.java | 4 ++-- .../maintenance/DefaultMaintenanceInformation.java | 4 ++-- .../iso/maintenance/DefaultScopeDescription.java | 20 ++++++++++---------- .../apache/sis/xml/bind/lan/LocaleAndCharset.java | 10 +++++----- .../sis/xml/test/AnnotationConsistencyCheck.java | 4 ++-- .../org/apache/sis/portrayal/CanvasExtent.java | 4 ++-- .../sis/geometry/AbstractDirectPosition.java | 4 ++-- .../org/apache/sis/geometry/AbstractEnvelope.java | 2 +- .../org/apache/sis/geometry/CoordinateFormat.java | 10 +++++----- .../org/apache/sis/geometry/GeneralEnvelope.java | 4 ++-- .../apache/sis/io/wkt/GeodeticObjectParser.java | 6 +++--- .../main/org/apache/sis/io/wkt/VerticalInfo.java | 6 +++--- .../sis/referencing/crs/DefaultGeodeticCRS.java | 3 +-- .../sis/referencing/cs/CoordinateSystems.java | 2 +- .../cs/DefaultCoordinateSystemAxis.java | 4 ++-- .../sis/referencing/cs/DefaultEllipsoidalCS.java | 4 ++-- .../apache/sis/referencing/cs/DefaultTimeCS.java | 2 +- .../sis/referencing/cs/DefaultVerticalCS.java | 2 +- .../org/apache/sis/referencing/cs/Normalizer.java | 4 ++-- .../org/apache/sis/referencing/cs/SubTypes.java | 4 ++-- .../operation/transform/TransferFunction.java | 22 +++++++++++----------- .../sis/referencing/util/AxisDirections.java | 12 ++++-------- .../sis/referencing/util/CoordinateOperations.java | 2 +- .../sis/referencing/util/ReferencingUtilities.java | 8 ++++---- .../sis/referencing/util/WraparoundApplicator.java | 4 ++-- .../util/PositionalAccuracyConstantTest.java | 20 +++++++++----------- .../org/apache/sis/storage/geotiff/Writer.java | 2 +- .../geotiff/reader/GridGeometryBuilder.java | 6 +++--- .../sis/storage/geotiff/writer/GeoEncoder.java | 2 +- .../org/apache/sis/storage/geotiff/WriterTest.java | 2 +- .../org/apache/sis/storage/netcdf/base/Axis.java | 4 ++-- .../apache/sis/storage/netcdf/base/AxisType.java | 4 ++-- .../apache/sis/storage/netcdf/base/CRSBuilder.java | 8 ++++---- .../sis/storage/sql/postgis/RasterWriter.java | 2 +- .../main/org/apache/sis/storage/gpx/Person.java | 4 ++-- .../apache/sis/storage/base/MetadataBuilder.java | 2 +- .../apache/sis/storage/base/MetadataFetcher.java | 2 +- .../storage/base/WritableGridCoverageSupport.java | 4 ++-- .../main/org/apache/sis/storage/csv/Store.java | 2 +- .../apache/sis/storage/event/StoreListeners.java | 6 +++--- .../main/org/apache/sis/math/ArrayVector.java | 2 +- .../sis/storage/shapefile/ShapefileStore.java | 4 ++-- .../org/apache/sis/gui/internal/ColorName.java | 2 +- .../sis/gui/metadata/IdentificationInfo.java | 4 ++-- 57 files changed, 134 insertions(+), 143 deletions(-) diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/DimensionalityReduction.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/DimensionalityReduction.java index ae52bd3e01..115b80d3f7 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/DimensionalityReduction.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/DimensionalityReduction.java @@ -508,9 +508,9 @@ public class DimensionalityReduction implements UnaryOperator<GridCoverage>, Ser * @return removed part of the conversion from grid coordinates to "real world" coordinates. */ private MathTransform getRemovedGridToCRS(final PixelInCell anchor) { - if (PixelInCell.CELL_CENTER.equals(anchor)) { + if (anchor == PixelInCell.CELL_CENTER) { return removedGridToCRS; - } else if (PixelInCell.CELL_CORNER.equals(anchor)) { + } else if (anchor == PixelInCell.CELL_CORNER) { return removedCornerToCRS; } else { return PixelTranslation.translate(removedGridToCRS, PixelInCell.CELL_CENTER, anchor); diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageProcessor.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageProcessor.java index 6b86af0a7d..2d813bce9a 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageProcessor.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridCoverageProcessor.java @@ -583,7 +583,7 @@ public class GridCoverageProcessor implements Cloneable { * the interpolation type is "nearest neighbor" since this is not really * an interpolation. */ - if (!Interpolation.NEAREST.equals(imageProcessor.getInterpolation())) { + if (imageProcessor.getInterpolation() != Interpolation.NEAREST) { source = source.forConvertedValues(true); } final GridCoverage resampled; diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java index d5bc1bb450..49c641e23c 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridExtent.java @@ -949,7 +949,7 @@ public class GridExtent implements GridEnvelope, LenientComparable, Serializable public double[] getPointOfInterest(final PixelInCell anchor) { final int dimension = getDimension(); final double[] center = new double[dimension]; - final boolean isCorner = PixelInCell.CELL_CORNER.equals(anchor); + final boolean isCorner = anchor.equals(PixelInCell.CELL_CORNER); // Implicit null check. for (int i=0; i<dimension; i++) { /* * We want the average of (low + hi+1). However for the purpose of computing an average, it does diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java index a266271c54..f98f31e205 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/GridGeometry.java @@ -921,9 +921,9 @@ public class GridGeometry implements LenientComparable, Serializable { */ public MathTransform getGridToCRS(final PixelInCell anchor) { final MathTransform mt; - if (PixelInCell.CELL_CENTER.equals(anchor)) { + if (anchor.equals(PixelInCell.CELL_CENTER)) { // Implicit null check. mt = gridToCRS; - } else if (PixelInCell.CELL_CORNER.equals(anchor)) { + } else if (anchor == PixelInCell.CELL_CORNER) { mt = cornerToCRS; } else { mt = PixelTranslation.translate(gridToCRS, PixelInCell.CELL_CENTER, anchor); diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelTranslation.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelTranslation.java index 221b0cbd6a..d4ce805088 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelTranslation.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/coverage/grid/PixelTranslation.java @@ -175,9 +175,9 @@ public final class PixelTranslation extends Static implements Serializable { * @throws IllegalArgumentException if the given {@code anchor} is not a known code list value. */ public static double getPixelTranslation(final PixelInCell anchor) { - if (PixelInCell.CELL_CENTER.equals(anchor)) { + if (anchor == PixelInCell.CELL_CENTER) { return 0; - } else if (PixelInCell.CELL_CORNER.equals(anchor)) { + } else if (anchor == PixelInCell.CELL_CORNER) { return -0.5; } else { throw new IllegalArgumentException(Errors.format( diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/DefaultSortProperty.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/DefaultSortProperty.java index 14b1088b57..6c67e14321 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/DefaultSortProperty.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/DefaultSortProperty.java @@ -18,8 +18,8 @@ package org.apache.sis.filter; import java.util.Iterator; import java.util.Collections; +import java.util.Objects; import java.io.Serializable; -import org.apache.sis.util.ArgumentChecks; import org.apache.sis.util.collection.Containers; import org.apache.sis.util.resources.Errors; @@ -62,10 +62,8 @@ final class DefaultSortProperty<R> implements SortProperty<R>, Serializable { * @param order the desired order: {@code ASCENDING} or {@code DESCENDING}. */ DefaultSortProperty(final ValueReference<R,?> property, final SortOrder order) { - ArgumentChecks.ensureNonNull("property", property); - ArgumentChecks.ensureNonNull("order", order); - this.property = property; - descending = SortOrder.DESCENDING.equals(order); + this.property = Objects.requireNonNull(property); + descending = order.equals(SortOrder.DESCENDING); // Implicit null check. } /** diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/LogicalFilter.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/LogicalFilter.java index 25b783a4c7..dc49482c0c 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/LogicalFilter.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/LogicalFilter.java @@ -328,7 +328,7 @@ abstract class LogicalFilter<R> extends Node implements LogicalOperator<R>, Opti * A OR NOT(A) = TRUE */ for (Filter<R> f : effective) { - if (LogicalOperatorName.NOT.equals(f.getOperatorType())) { + if (f.getOperatorType() == LogicalOperatorName.NOT) { if (effective.containsAll(((LogicalOperator<?>) f).getOperands())) { return shortCircuit; } diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/UnaryFunction.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/UnaryFunction.java index 24d193e50f..ee78c0e1fa 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/UnaryFunction.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/filter/UnaryFunction.java @@ -171,7 +171,7 @@ class UnaryFunction<R,V> extends Node { final NilReason value = NilReason.forObject(expression.apply(object)); if (value == null) return false; if (nilReason == null) return true; - final String explanation = NilReason.OTHER.equals(value) ? value.getOtherExplanation() : value.toString(); + final String explanation = value.equals(NilReason.OTHER) ? value.getOtherExplanation() : value.toString(); return nilReason.equalsIgnoreCase(explanation); } } diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java index 51c7e8f5f5..fc120ecff5 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/geometry/wrapper/GeometryWrapper.java @@ -590,7 +590,7 @@ public abstract class GeometryWrapper extends AbstractGeometry implements Geomet */ @Override public final boolean equals(final Object obj) { - return (obj != null) && obj.getClass().equals(getClass()) && + return (obj != null) && obj.getClass() == getClass() && Objects.equals(((GeometryWrapper) obj).implementation(), implementation()); } diff --git a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ImageAdapter.java b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ImageAdapter.java index 560ae873d5..a788831dee 100644 --- a/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ImageAdapter.java +++ b/endorsed/src/org.apache.sis.feature/main/org/apache/sis/image/ImageAdapter.java @@ -154,7 +154,7 @@ abstract class ImageAdapter extends PlanarImage { */ @Override public boolean equals(final Object object) { - if (object != null && object.getClass().equals(getClass())) { + if (object != null && object.getClass() == getClass()) { return source.equals(((ImageAdapter) object).source); } return false; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/ModifiableMetadata.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/ModifiableMetadata.java index e011d2214f..9acfcea13e 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/ModifiableMetadata.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/ModifiableMetadata.java @@ -907,9 +907,9 @@ public abstract class ModifiableMetadata extends AbstractMetadata { * for elements of the given type. */ private <E> boolean useSet(final Class<E> elementType) { - final Class<? extends Collection<E>> type = collectionType(elementType); - if (Set .class == (Class) type) return true; - if (List.class == (Class) type) return false; + final Class<?> type = collectionType(elementType); + if (Set .class == type) return true; + if (List.class == type) return false; throw new NoSuchElementException(Errors.format(Errors.Keys.UnsupportedType_1, type)); } diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java index d22fe3e691..09509778e6 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/DefaultMetadata.java @@ -968,7 +968,7 @@ public class DefaultMetadata extends ISOMetadata implements Metadata { final Collection<CitationDate> dates = getDateInfo(); if (dates != null) { for (final CitationDate date : dates) { - if (DateType.CREATION.equals(date.getDateType())) { + if (date.getDateType() == DateType.CREATION) { return date.getDate(); } } @@ -997,7 +997,7 @@ public class DefaultMetadata extends ISOMetadata implements Metadata { final Iterator<CitationDate> it = newValues.iterator(); while (it.hasNext()) { final CitationDate date = it.next(); - if (DateType.CREATION.equals(date.getDateType())) { + if (date.getDateType() == DateType.CREATION) { if (newValue == null) { it.remove(); return; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultContact.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultContact.java index 03b608dfd6..d3d261da84 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultContact.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/citation/DefaultContact.java @@ -244,7 +244,7 @@ public class DefaultContact extends ISOMetadata implements Contact { TelephoneType ignored = null; for (final Telephone c : phones) { final TelephoneType type = c.getNumberType(); - if (TelephoneType.VOICE.equals(type) || TelephoneType.FACSIMILE.equals(type)) { + if (type == TelephoneType.VOICE || type == TelephoneType.FACSIMILE) { if (phone == null) { phone = c; } diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java index 0f9f213e2b..9b7f21c6a2 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/extent/Extents.java @@ -431,13 +431,13 @@ public final class Extents extends Static { final VerticalDatum datum = crs.getDatum(); if (datum != null) { type = datum.getVerticalDatumType(); - if (VerticalDatumType.DEPTH.equals(type)) { + if (type == VerticalDatumType.DEPTH) { type = VerticalDatumType.GEOIDAL; } } final CoordinateSystemAxis axis = crs.getCoordinateSystem().getAxis(0); unit = axis.getUnit(); - if (AxisDirection.DOWN.equals(axis.getDirection())) { + if (axis.getDirection() == AxisDirection.DOWN) { final double tmp = min; min = -max; max = -tmp; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java index 8431d50f43..3aff1708d3 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultMaintenanceInformation.java @@ -255,7 +255,7 @@ public class DefaultMaintenanceInformation extends ISOMetadata implements Mainte final Collection<CitationDate> dates = getMaintenanceDates(); if (dates != null) { // May be null on XML marshalling. for (final CitationDate date : dates) { - if (DateType.NEXT_UPDATE.equals(date.getDateType())) { + if (date.getDateType() == DateType.NEXT_UPDATE) { return date.getDate(); } } @@ -278,7 +278,7 @@ public class DefaultMaintenanceInformation extends ISOMetadata implements Mainte final Iterator<CitationDate> it = dates.iterator(); while (it.hasNext()) { final CitationDate date = it.next(); - if (DateType.NEXT_UPDATE.equals(date.getDateType())) { + if (date.getDateType() == DateType.NEXT_UPDATE) { if (newValue == null) { it.remove(); return; diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java index e80e2e7f14..1ed6037e7b 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/metadata/iso/maintenance/DefaultScopeDescription.java @@ -511,30 +511,30 @@ public class DefaultScopeDescription extends ISOMetadata implements ScopeDescrip * @since 1.0 */ public void setLevelDescription(final ScopeCode level, final Set<? extends CharSequence> newValues) { - if (ScopeCode.DATASET.equals(level)) { + if (level == ScopeCode.DATASET) { String description = null; if (newValues != null) { - for (CharSequence value : newValues) { - if (value != null) { - description = value.toString(); + for (CharSequence v : newValues) { + if (v != null) { + description = v.toString(); break; } } } setDataset(description); - } else if (ScopeCode.FEATURE_TYPE.equals(level)) { + } else if (level == ScopeCode.FEATURE_TYPE) { setFeatures(newValues); - } else if (ScopeCode.ATTRIBUTE_TYPE.equals(level)) { + } else if (level == ScopeCode.ATTRIBUTE_TYPE) { setAttributes(newValues); - } else if (ScopeCode.FEATURE.equals(level)) { + } else if (level == ScopeCode.FEATURE) { setFeatureInstances(newValues); - } else if (ScopeCode.ATTRIBUTE.equals(level)) { + } else if (level == ScopeCode.ATTRIBUTE) { setAttributeInstances(newValues); } else { InternationalString description = null; if (newValues != null) { - for (CharSequence value : newValues) { - description = Types.toInternationalString(value); + for (CharSequence v : newValues) { + description = Types.toInternationalString(v); if (description != null) break; } } diff --git a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/lan/LocaleAndCharset.java b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/lan/LocaleAndCharset.java index 40cddf718d..87b41613f7 100644 --- a/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/lan/LocaleAndCharset.java +++ b/endorsed/src/org.apache.sis.metadata/main/org/apache/sis/xml/bind/lan/LocaleAndCharset.java @@ -144,7 +144,7 @@ public final class LocaleAndCharset implements Node { */ private <V> V separateValue(final TableColumn<V> column, final boolean key) { V value = node.getValue(column); - if (TableColumn.VALUE.equals(column)) { + if (column == TableColumn.VALUE) { value = column.getElementType().cast(keyOrValue(value, key)); } return value; @@ -157,7 +157,7 @@ public final class LocaleAndCharset implements Node { */ @Override public <V> void setValue(final TableColumn<V> column, final V value) { - if (TableColumn.VALUE.equals(column)) { + if (column == TableColumn.VALUE) { throw new UnsupportedOperationException(); } else { node.setValue(column, value); @@ -212,9 +212,9 @@ public final class LocaleAndCharset implements Node { /** Returns the value at the given column, with hard-coded names. */ @Override public <V> V getValue(final TableColumn<V> column) { final String value; - if (TableColumn.IDENTIFIER.equals(column)) { + if (column == TableColumn.IDENTIFIER) { value = "characterSet"; - } else if (TableColumn.NAME.equals(column)) { + } else if (column == TableColumn.NAME) { value = "Character set"; } else { return separateValue(column, false); @@ -224,7 +224,7 @@ public final class LocaleAndCharset implements Node { /** Sets the value in the map entry key wrapped by this node. */ @Override public <V> void setValue(final TableColumn<V> column, V value) { - if (TableColumn.VALUE.equals(column)) { + if (column == TableColumn.VALUE) { /* * We rely on Entry.setValue(Object) implementation to perform type checks. * This is the case with SIS implementation backed by PropertyAccessor, diff --git a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java index 500eee6fc3..8aa9be0721 100644 --- a/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java +++ b/endorsed/src/org.apache.sis.metadata/test/org/apache/sis/xml/test/AnnotationConsistencyCheck.java @@ -363,7 +363,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { protected String getExpectedXmlTypeName(final Stereotype stereotype, final UML uml) { final String rootName = uml.identifier(); final StringBuilder buffer = new StringBuilder(rootName.length() + 13); - if (Stereotype.ABSTRACT.equals(stereotype)) { + if (stereotype == Stereotype.ABSTRACT) { buffer.append("Abstract"); } return buffer.append(rootName).append("_Type").toString(); @@ -382,7 +382,7 @@ public abstract class AnnotationConsistencyCheck extends TestCase { */ protected String getExpectedXmlRootElementName(final Stereotype stereotype, final UML uml) { String name = uml.identifier(); - if (Stereotype.ABSTRACT.equals(stereotype)) { + if (stereotype == Stereotype.ABSTRACT) { name = "Abstract".concat(name); } return name; diff --git a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasExtent.java b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasExtent.java index f8ef62b86c..38daa6e7ff 100644 --- a/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasExtent.java +++ b/endorsed/src/org.apache.sis.portrayal/main/org/apache/sis/portrayal/CanvasExtent.java @@ -222,9 +222,9 @@ final class CanvasExtent extends GridExtent { final DimensionNameType[] axisTypes = new DimensionNameType[i]; while (--i >= displayDimension) { final AxisDirection dir = AxisDirections.absolute(cs.getAxis(i).getDirection()); - if (AxisDirection.FUTURE.equals(dir)) { + if (dir == AxisDirection.FUTURE) { axisTypes[i] = DimensionNameType.TIME; - } else if (AxisDirection.UP.equals(dir)) { + } else if (dir == AxisDirection.UP) { axisTypes[i] = DimensionNameType.VERTICAL; } } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java index 35d59ce3dd..2b69bdcdd9 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractDirectPosition.java @@ -214,11 +214,11 @@ public abstract class AbstractDirectPosition extends FormattableObject implement final double minimum = axis.getMinimumValue(); final double maximum = axis.getMaximumValue(); final RangeMeaning rm = axis.getRangeMeaning(); - if (RangeMeaning.EXACT.equals(rm)) { + if (rm == RangeMeaning.EXACT) { if (coordinate < minimum) coordinate = minimum; else if (coordinate > maximum) coordinate = maximum; else continue; - } else if (RangeMeaning.WRAPAROUND.equals(rm)) { + } else if (rm == RangeMeaning.WRAPAROUND) { final double csSpan = maximum - minimum; final double shift = Math.floor((coordinate - minimum) / csSpan) * csSpan; if (shift == 0) { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java index 201ddb92e7..c12a887cee 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/AbstractEnvelope.java @@ -241,7 +241,7 @@ public abstract class AbstractEnvelope extends FormattableObject implements Enve * @return {@code true} if the range meaning is {@code WRAPAROUND}. */ static boolean isWrapAround(final CoordinateSystemAxis axis) { - return (axis != null) && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning()); + return (axis != null) && axis.getRangeMeaning() == RangeMeaning.WRAPAROUND; } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/CoordinateFormat.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/CoordinateFormat.java index 3173699118..fbdccd84f8 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/CoordinateFormat.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/CoordinateFormat.java @@ -555,10 +555,10 @@ public class CoordinateFormat extends CompoundFormat<DirectPosition> { * Type is LONGITUDE, LATITUDE or ANGLE depending on axis direction. */ byte type = ANGLE; - if (AxisDirection.NORTH.equals(direction)) {type = LATITUDE;} - else if (AxisDirection.EAST .equals(direction)) {type = LONGITUDE;} - else if (AxisDirection.SOUTH.equals(direction)) {type = LATITUDE; negate(i);} - else if (AxisDirection.WEST .equals(direction)) {type = LONGITUDE; negate(i);} + if (direction == AxisDirection.NORTH) {type = LATITUDE;} + else if (direction == AxisDirection.EAST) {type = LONGITUDE;} + else if (direction == AxisDirection.SOUTH) {type = LATITUDE; negate(i);} + else if (direction == AxisDirection.WEST) {type = LONGITUDE; negate(i);} types [i] = type; formats[i] = getFormat(Angle.class); setConverter(dimension, i, unit.asType(javax.measure.quantity.Angle.class).getConverterTo(Units.DEGREE)); @@ -577,7 +577,7 @@ public class CoordinateFormat extends CompoundFormat<DirectPosition> { formats[i] = getFormat(Date.class); epochs [i] = ((TemporalCRS) t).getDatum().getOrigin().getTime(); setConverter(dimension, i, unit.asType(Time.class).getConverterTo(Units.MILLISECOND)); - if (AxisDirection.PAST.equals(direction)) { + if (direction == AxisDirection.PAST) { negate(i); } continue; diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/GeneralEnvelope.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/GeneralEnvelope.java index dea7870b75..1572d6c08a 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/GeneralEnvelope.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/geometry/GeneralEnvelope.java @@ -1022,10 +1022,10 @@ public class GeneralEnvelope extends ArrayEnvelope implements Cloneable, Seriali final double minimum = axis.getMinimumValue(); final double maximum = axis.getMaximumValue(); final RangeMeaning rm = axis.getRangeMeaning(); - if (RangeMeaning.EXACT.equals(rm)) { + if (rm == RangeMeaning.EXACT) { if (coordinates[iLower] < minimum) {coordinates[iLower] = minimum; changed = true;} if (coordinates[iUpper] > maximum) {coordinates[iUpper] = maximum; changed = true;} - } else if (RangeMeaning.WRAPAROUND.equals(rm)) { + } else if (rm == RangeMeaning.WRAPAROUND) { final double cycle = maximum - minimum; if (cycle > 0 && cycle < Double.POSITIVE_INFINITY) { double o1 = coordinates[iLower]; diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java index 6004428ee4..cef0cb0664 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/GeodeticObjectParser.java @@ -1940,9 +1940,9 @@ class GeodeticObjectParser extends MathTransformParser implements Comparator<Coo * But sometimes the axis (which was not available when we created the datum) provides * more information. Verify if we can have a better type now, and if so rebuild the datum. */ - if (VerticalDatumType.OTHER_SURFACE.equals(datum.getVerticalDatumType())) { - final VerticalDatumType type = VerticalDatumTypes.guess(datum.getName().getCode(), datum.getAlias(), cs.getAxis(0)); - if (!VerticalDatumType.OTHER_SURFACE.equals(type)) { + if (datum.getVerticalDatumType() == VerticalDatumType.OTHER_SURFACE) { + var type = VerticalDatumTypes.guess(datum.getName().getCode(), datum.getAlias(), cs.getAxis(0)); + if (type != VerticalDatumType.OTHER_SURFACE) { final DatumFactory datumFactory = factories.getDatumFactory(); datum = datumFactory.createVerticalDatum(IdentifiedObjects.getProperties(datum), type); } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/VerticalInfo.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/VerticalInfo.java index 822eb41226..4f620525fb 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/VerticalInfo.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/io/wkt/VerticalInfo.java @@ -105,7 +105,7 @@ final class VerticalInfo { * became empty as a result of this operation. */ final VerticalInfo resolve(final VerticalCRS crs) { - if (crs != null && VerticalDatumType.GEOIDAL.equals(crs.getDatum().getVerticalDatumType())) { + if (crs != null && crs.getDatum().getVerticalDatumType() == VerticalDatumType.GEOIDAL) { return resolve(crs, crs.getCoordinateSystem().getAxis(0)); } return this; @@ -120,7 +120,7 @@ final class VerticalInfo { next = next.resolve(crs, axis); } final Unit<?> crsUnit = axis.getUnit(); - if (AxisDirection.UP.equals(axis.getDirection()) && unit.equals(crsUnit)) { + if (axis.getDirection() == AxisDirection.UP && unit.equals(crsUnit)) { extent.setVerticalCRS(crs); return next; } else if (unit.isCompatible(crsUnit)) { @@ -151,7 +151,7 @@ final class VerticalInfo { final Object name; final String abbreviation; CoordinateSystemAxis axis = compatibleCRS.getCoordinateSystem().getAxis(0); - final boolean isUP = AxisDirection.UP.equals(axis.getDirection()); + final boolean isUP = (axis.getDirection() == AxisDirection.UP); if (isUP) { name = axis.getName(); abbreviation = axis.getAbbreviation(); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java index 69b7f5a5e7..b934a7d676 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/crs/DefaultGeodeticCRS.java @@ -27,7 +27,6 @@ import org.opengis.referencing.cs.CartesianCS; import org.opengis.referencing.cs.SphericalCS; import org.opengis.referencing.cs.EllipsoidalCS; import org.opengis.referencing.cs.CoordinateSystem; -import org.opengis.referencing.cs.AxisDirection; import org.opengis.referencing.crs.GeodeticCRS; import org.opengis.referencing.crs.SingleCRS; import org.opengis.referencing.datum.GeodeticDatum; @@ -191,7 +190,7 @@ class DefaultGeodeticCRS extends AbstractCRS implements GeodeticCRS { // If made SingleCRS first = CRS.getHorizontalComponent(this); SingleCRS second = CRS.getVerticalComponent(this, true); if (first != null && second != null) { // Should not be null, but we are paranoiac. - if (AxisDirection.UP.equals(AxisDirections.absolute(cs.getAxis(0).getDirection()))) { + if (AxisDirections.isVertical(cs.getAxis(0).getDirection())) { // It is very unusual to have VerticalCRS first, but our code tries to be robust. final SingleCRS t = first; first = second; second = t; diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java index ed81369c4b..1549b9ab47 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/CoordinateSystems.java @@ -662,7 +662,7 @@ forDim: switch (axes.length) { final CoordinateSystemAxis axis = axes[i]; ArgumentChecks.ensureNonNullElement("axes", i, axis); directions[i] = axis.getDirection(); - if (isAngular && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) try { + if (isAngular && axis.getRangeMeaning() == RangeMeaning.WRAPAROUND) try { final UnitConverter uc = unit.getConverterToAny(Units.DEGREE); final double min = uc.convert(axis.getMinimumValue()); final double max = uc.convert(axis.getMaximumValue()); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java index 154f888ca1..d2bdaafd56 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultCoordinateSystemAxis.java @@ -623,8 +623,8 @@ public class DefaultCoordinateSystemAxis extends AbstractIdentifiedObject implem * coordinate operation may shift some coordinate values (typically ±360° on longitudes). */ final CoordinateSystemAxis that = (CoordinateSystemAxis) object; - if (!equalsIgnoreMetadata(that, mode, RangeMeaning.WRAPAROUND.equals(this.getRangeMeaning()) && - RangeMeaning.WRAPAROUND.equals(that.getRangeMeaning()))) + if (!equalsIgnoreMetadata(that, mode, this.getRangeMeaning() == RangeMeaning.WRAPAROUND && + that.getRangeMeaning() == RangeMeaning.WRAPAROUND)) { return false; } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java index 4f055826a9..50d12956b1 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultEllipsoidalCS.java @@ -178,8 +178,8 @@ public class DefaultEllipsoidalCS extends AbstractCS implements EllipsoidalCS { @Override final int validateAxis(AxisDirection direction, final Unit<?> unit) { direction = AxisDirections.absolute(direction); - final boolean isVertical = AxisDirection.UP.equals(direction); - if (!isVertical && !AxisDirection.NORTH.equals(direction) && !AxisDirection.EAST.equals(direction)) { + final boolean isVertical = direction == AxisDirection.UP; + if (!isVertical && direction != AxisDirection.NORTH && direction != AxisDirection.EAST) { return INVALID_DIRECTION; } if (!(isVertical ? Units.isLinear(unit) : Units.isAngular(unit))) { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultTimeCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultTimeCS.java index 1449c2835a..eceaf82e2a 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultTimeCS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultTimeCS.java @@ -150,7 +150,7 @@ public class DefaultTimeCS extends AbstractCS implements TimeCS { */ @Override final int validateAxis(final AxisDirection direction, final Unit<?> unit) { - if (!AxisDirection.FUTURE.equals(AxisDirections.absolute(direction))) { + if (!AxisDirections.isTemporal(direction)) { return INVALID_DIRECTION; } if (!Units.isTemporal(unit)) { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultVerticalCS.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultVerticalCS.java index 81d7297139..11fd808998 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultVerticalCS.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/DefaultVerticalCS.java @@ -161,7 +161,7 @@ public class DefaultVerticalCS extends AbstractCS implements VerticalCS { */ @Override final int validateAxis(final AxisDirection direction, Unit<?> unit) { - if (!AxisDirection.UP.equals(AxisDirections.absolute(direction))) { + if (!AxisDirections.isVertical(direction)) { return INVALID_DIRECTION; } unit = unit.getSystemUnit(); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/Normalizer.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/Normalizer.java index 27ee6de2b2..23bdd7cec6 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/Normalizer.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/Normalizer.java @@ -332,7 +332,7 @@ final class Normalizer implements Comparable<Normalizer> { * If we were not allowed to normalize the axis direction, we may have a * left-handed coordinate system here. If so, make it right-handed. */ - if (AxisDirections.CLOCKWISE.equals(newAxes[1].getDirection()) && isLengthAndAngle(newAxes, 0)) { + if (newAxes[1].getDirection() == AxisDirections.CLOCKWISE && isLengthAndAngle(newAxes, 0)) { ArraysExt.swap(newAxes, 0, 1); } } @@ -394,7 +394,7 @@ final class Normalizer implements Comparable<Normalizer> { final CoordinateSystemAxis[] axes = new CoordinateSystemAxis[cs.getDimension()]; for (int i=0; i<axes.length; i++) { CoordinateSystemAxis axis = cs.getAxis(i); - if (RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) { + if (axis.getRangeMeaning() == RangeMeaning.WRAPAROUND) { double min = axis.getMinimumValue(); if (min < 0) { double max = axis.getMaximumValue(); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java index 83783054bc..886f6c68e5 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/cs/SubTypes.java @@ -108,9 +108,9 @@ final class SubTypes { final CoordinateSystemAxis axis = axes[0]; final AxisDirection dir = AxisDirections.absolute(axis.getDirection()); final boolean isTemporal; - if (AxisDirection.UP.equals(dir)) { + if (dir == AxisDirection.UP) { isTemporal = false; - } else if (AxisDirection.FUTURE.equals(dir)) { // Happen with Minkowski coordinate system. + } else if (dir == AxisDirection.FUTURE) { // Happen with Minkowski coordinate system. isTemporal = true; } else { throw AbstractCS.unexpectedDimension(axes, 2, 3); diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/TransferFunction.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/TransferFunction.java index ed4cfd4c28..b849567d5f 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/TransferFunction.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/operation/transform/TransferFunction.java @@ -122,7 +122,7 @@ public class TransferFunction implements Cloneable, Serializable { * @since 1.0 */ public boolean isIdentity() { - return TransferFunctionType.LINEAR.equals(type) && scale == 1 && offset == 0; + return type == TransferFunctionType.LINEAR && scale == 1 && offset == 0; } /** @@ -153,7 +153,7 @@ public class TransferFunction implements Cloneable, Serializable { * @return the logarithmic or exponent base. */ public double getBase() { - return TransferFunctionType.LINEAR.equals(type) ? 1 : base; + return type == TransferFunctionType.LINEAR ? 1 : base; } /** @@ -243,14 +243,14 @@ public class TransferFunction implements Cloneable, Serializable { public MathTransform createTransform(final MathTransformFactory factory) throws FactoryException { ArgumentChecks.ensureNonNull("factory", factory); MathTransform mt; - if (TransferFunctionType.LINEAR.equals(type)) { + if (type == TransferFunctionType.LINEAR) { mt = createAffineTransform(factory, true); - } else if (TransferFunctionType.EXPONENTIAL.equals(type)) { + } else if (type == TransferFunctionType.EXPONENTIAL) { mt = ExponentialTransform1D.create(base, scale); if (offset != 0) { mt = factory.createConcatenatedTransform(mt, createAffineTransform(factory, false)); } - } else if (TransferFunctionType.LOGARITHMIC.equals(type)) { + } else if (type == TransferFunctionType.LOGARITHMIC) { if (scale == 1) { mt = LogarithmicTransform1D.create(base, offset); } else { @@ -273,14 +273,14 @@ public class TransferFunction implements Cloneable, Serializable { public MathTransform1D getTransform() { MathTransform1D mt = transform; if (mt == null) { - if (TransferFunctionType.LINEAR.equals(type)) { + if (type == TransferFunctionType.LINEAR) { mt = LinearTransform1D.create(scale, offset); - } else if (TransferFunctionType.EXPONENTIAL.equals(type)) { + } else if (type == TransferFunctionType.EXPONENTIAL) { mt = ExponentialTransform1D.create(base, scale); if (offset != 0) { // Rarely occurs in practice. mt = MathTransforms.concatenate(mt, LinearTransform1D.create(null, offset)); } - } else if (TransferFunctionType.LOGARITHMIC.equals(type)) { + } else if (type == TransferFunctionType.LOGARITHMIC) { if (scale == 1) { mt = LogarithmicTransform1D.create(base, offset); } else { @@ -402,16 +402,16 @@ public class TransferFunction implements Cloneable, Serializable { StringBuilders.trimFractionalPart(b.append(scale).append('⋅')); } } - if (TransferFunctionType.LINEAR.equals(type)) { + if (type == TransferFunctionType.LINEAR) { b.append('x'); - } else if (TransferFunctionType.EXPONENTIAL.equals(type)) { + } else if (type == TransferFunctionType.EXPONENTIAL) { if (base == Math.E) { b.append('e'); } else { StringBuilders.trimFractionalPart(b.append(base)); } b.append('ˣ'); - } else if (TransferFunctionType.LOGARITHMIC.equals(type)) { + } else if (type == TransferFunctionType.LOGARITHMIC) { if (base == Math.E) { b.append("ln"); } else { diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/AxisDirections.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/AxisDirections.java index 1d0e5ed683..291177fd72 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/AxisDirections.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/AxisDirections.java @@ -286,8 +286,7 @@ public final class AxisDirections extends Static { * @return {@code true} if the direction is vertical, or {@code false} otherwise. */ public static boolean isVertical(final AxisDirection dir) { - if (dir == null) return false; - return ((dir.ordinal() - UP.ordinal()) & ~1) == 0; + return dir == UP || dir == DOWN; } /** @@ -297,8 +296,7 @@ public final class AxisDirections extends Static { * @return {@code true} if the direction is temporal, or {@code false} otherwise. */ public static boolean isTemporal(final AxisDirection dir) { - if (dir == null) return false; - return ((dir.ordinal() - FUTURE.ordinal()) & ~1) == 0; + return dir == FUTURE || dir == PAST; } /** @@ -309,9 +307,7 @@ public final class AxisDirections extends Static { * @return {@code true} if the given direction is one of geocentric directions. */ public static boolean isGeocentric(final AxisDirection dir) { - if (dir == null) return false; - final int ordinal = dir.ordinal(); - return ordinal >= GEOCENTRIC_X.ordinal() && ordinal <= GEOCENTRIC_Z.ordinal(); + return dir == GEOCENTRIC_X || dir == GEOCENTRIC_Y || dir == GEOCENTRIC_Z; } /** @@ -473,7 +469,7 @@ public final class AxisDirections extends Static { final Unit<?> candidate = axis.getUnit(); if (Units.isAngular(candidate)) { fallback = candidate.asType(Angle.class); - if (AxisDirection.EAST.equals(absolute(axis.getDirection()))) { + if (absolute(axis.getDirection()) == AxisDirection.EAST) { break; // Found the longitude axis. } } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/CoordinateOperations.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/CoordinateOperations.java index 960cb87e4b..0488d02543 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/CoordinateOperations.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/CoordinateOperations.java @@ -212,7 +212,7 @@ public final class CoordinateOperations extends Static { * @return {@code true} if the given axis has "wrap around" range meaning. */ public static boolean isWrapAround(final CoordinateSystemAxis axis) { - return RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning()); + return axis.getRangeMeaning() == RangeMeaning.WRAPAROUND; } /** diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/ReferencingUtilities.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/ReferencingUtilities.java index 4234653bd1..41feffc4c6 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/ReferencingUtilities.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/ReferencingUtilities.java @@ -424,8 +424,8 @@ public final class ReferencingUtilities extends Static { public static boolean startsWithNorthEast(final CoordinateSystem cs) { final int dimension = cs.getDimension(); return (dimension >= 2) - && AxisDirection.NORTH.equals(cs.getAxis(0).getDirection()) - && AxisDirection.EAST .equals(cs.getAxis(1).getDirection()); + && cs.getAxis(0).getDirection() == AxisDirection.NORTH + && cs.getAxis(1).getDirection() == AxisDirection.EAST; } /** @@ -666,13 +666,13 @@ public final class ReferencingUtilities extends Static { final CoordinateSystemAxis axis = cs.getAxis(i); final AxisDirection direction = axis.getDirection(); if (AxisDirections.isCardinal(direction)) { - final boolean isMeridional = AxisDirection.NORTH.equals(direction) || AxisDirection.SOUTH.equals(direction); + final boolean isMeridional = (direction == AxisDirection.NORTH) || (direction == AxisDirection.SOUTH); if (isGeographic) { key = isMeridional ? Vocabulary.Keys.Latitude : Vocabulary.Keys.Longitude; } else if (isProjected) { // We could add "Easting" / "Northing" here for ProjectedCRS in a future version. } - } else if (AxisDirection.UP.equals(direction)) { + } else if (direction == AxisDirection.UP) { if (isGeographic | isProjected) { key = Vocabulary.Keys.Height; } diff --git a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/WraparoundApplicator.java b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/WraparoundApplicator.java index 230c5af824..59e0ae3aa2 100644 --- a/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/WraparoundApplicator.java +++ b/endorsed/src/org.apache.sis.referencing/main/org/apache/sis/referencing/util/WraparoundApplicator.java @@ -202,13 +202,13 @@ public final class WraparoundApplicator { */ static double range(final CoordinateSystem cs, final int dimension) { final CoordinateSystemAxis axis = cs.getAxis(dimension); - if (axis != null && RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) { + if (axis != null && axis.getRangeMeaning() == RangeMeaning.WRAPAROUND) { double period = axis.getMaximumValue() - axis.getMinimumValue(); if (period > 0 && period != Double.POSITIVE_INFINITY) { return period; } final AxisDirection dir = AxisDirections.absolute(axis.getDirection()); - if (AxisDirection.EAST.equals(dir) && cs instanceof EllipsoidalCS) { + if (dir == AxisDirection.EAST && cs instanceof EllipsoidalCS) { period = Longitude.MAX_VALUE - Longitude.MIN_VALUE; final Unit<?> unit = axis.getUnit(); if (unit != null) { diff --git a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/util/PositionalAccuracyConstantTest.java b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/util/PositionalAccuracyConstantTest.java index e91e30ce91..d274b8ac3b 100644 --- a/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/util/PositionalAccuracyConstantTest.java +++ b/endorsed/src/org.apache.sis.referencing/test/org/apache/sis/referencing/util/PositionalAccuracyConstantTest.java @@ -22,7 +22,7 @@ import org.opengis.metadata.quality.Result; // Test dependencies import org.junit.Test; -import static org.junit.Assert.*; +import static org.junit.jupiter.api.Assertions.*; import org.apache.sis.test.TestUtilities; import org.apache.sis.test.TestCase; @@ -44,12 +44,10 @@ public final class PositionalAccuracyConstantTest extends TestCase { */ @Test public void testPositionalAccuracy() { - assertEquals("Identity comparison", - PositionalAccuracyConstant.DATUM_SHIFT_APPLIED, + assertEquals(PositionalAccuracyConstant.DATUM_SHIFT_APPLIED, PositionalAccuracyConstant.DATUM_SHIFT_APPLIED); - assertEquals("Identity comparison", - PositionalAccuracyConstant.DATUM_SHIFT_OMITTED, + assertEquals(PositionalAccuracyConstant.DATUM_SHIFT_OMITTED, PositionalAccuracyConstant.DATUM_SHIFT_OMITTED); assertNotSame(PositionalAccuracyConstant.DATUM_SHIFT_APPLIED, @@ -60,11 +58,11 @@ public final class PositionalAccuracyConstantTest extends TestCase { final ConformanceResult applied = (ConformanceResult) TestUtilities.getSingleton(appliedResults); final ConformanceResult omitted = (ConformanceResult) TestUtilities.getSingleton(omittedResults); assertNotSame(applied, omitted); - assertTrue ("DATUM_SHIFT_APPLIED", applied.pass()); - assertFalse("DATUM_SHIFT_OMITTED", omitted.pass()); - assertFalse(applied.equals(omitted)); - assertFalse(appliedResults.equals(omittedResults)); - assertFalse(PositionalAccuracyConstant.DATUM_SHIFT_APPLIED.equals( - PositionalAccuracyConstant.DATUM_SHIFT_OMITTED)); + assertTrue (applied.pass(), "DATUM_SHIFT_APPLIED"); + assertFalse(omitted.pass(), "DATUM_SHIFT_OMITTED"); + assertNotEquals(applied, omitted); + assertNotEquals(appliedResults, omittedResults); + assertNotEquals(PositionalAccuracyConstant.DATUM_SHIFT_APPLIED, + PositionalAccuracyConstant.DATUM_SHIFT_OMITTED); } } diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java index 539f923cd9..0361ab0a05 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/Writer.java @@ -184,7 +184,7 @@ final class Writer extends IOBase implements Flushable { * Note that it does not necessarily mean that the stream has no bytes before current position. */ output.relocateOrigin(); - output.writeShort(ByteOrder.LITTLE_ENDIAN.equals(output.buffer.order()) ? LITTLE_ENDIAN : BIG_ENDIAN); + output.writeShort((output.buffer.order() == ByteOrder.LITTLE_ENDIAN) ? LITTLE_ENDIAN : BIG_ENDIAN); output.writeShort(isBigTIFF ? BIG_TIFF : CLASSIC); if (isBigTIFF) { output.writeShort((short) Long.BYTES); // Byte size of offsets. diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/GridGeometryBuilder.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/GridGeometryBuilder.java index 33190d7031..09fd76dc01 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/GridGeometryBuilder.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/reader/GridGeometryBuilder.java @@ -292,7 +292,7 @@ public final class GridGeometryBuilder extends GeoKeysLoader { case 0: break; } final GridExtent extent = new GridExtent(axisTypes, null, high, true); - boolean pixelIsPoint = CellGeometry.POINT.equals(cellGeometry); + boolean pixelIsPoint = (cellGeometry == CellGeometry.POINT); final MathTransformFactory factory = DefaultMathTransformFactory.provider(); GridGeometry gridGeometry; try { @@ -361,9 +361,9 @@ public final class GridGeometryBuilder extends GeoKeysLoader { */ metadata.setCellGeometry(cellGeometry); final PixelOrientation po; - if (CellGeometry.POINT.equals(cellGeometry)) { + if (cellGeometry == CellGeometry.POINT) { po = PixelOrientation.CENTER; - } else if (CellGeometry.AREA.equals(cellGeometry)) { + } else if (cellGeometry == CellGeometry.AREA) { po = PixelOrientation.UPPER_LEFT; } else { return; diff --git a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java index 4d142789bf..0124b98495 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/main/org/apache/sis/storage/geotiff/writer/GeoEncoder.java @@ -217,7 +217,7 @@ public final class GeoEncoder { throws FactoryException, IncommensurableException { citation = CollectionsExt.first(metadata.transformationDimension); - isPoint = CellGeometry.POINT.equals(CollectionsExt.first(metadata.cellGeometry)); + isPoint = CollectionsExt.first(metadata.cellGeometry) == CellGeometry.POINT; gridToCRS = MathTransforms.getMatrix(grid.getGridToCRS(isPoint ? PixelInCell.CELL_CENTER : PixelInCell.CELL_CORNER)); if (gridToCRS == null) { warning(resources().getString(Resources.Keys.CanNotEncodeNonLinearModel), null); diff --git a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/WriterTest.java b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/WriterTest.java index 23e619a451..f885f8c04a 100644 --- a/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/WriterTest.java +++ b/endorsed/src/org.apache.sis.storage.geotiff/test/org/apache/sis/storage/geotiff/WriterTest.java @@ -317,7 +317,7 @@ public final class WriterTest extends TestCase { @SuppressWarnings("LocalVariableHidesMemberVariable") final ByteBuffer data = this.data; final boolean isBigTIFF = store.getModifiers().contains(FormatModifier.BIG_TIFF); - final boolean isBigEndian = ByteOrder.BIG_ENDIAN.equals(data.order()); + final boolean isBigEndian = data.order() == ByteOrder.BIG_ENDIAN; assertEquals(tagCount, isBigTIFF ? data.getLong() : data.getShort()); /* * Build a list of tags considered mandatory for all images in this test. diff --git a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Axis.java b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Axis.java index ab9decf0d6..3838d8de4c 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Axis.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/Axis.java @@ -481,7 +481,7 @@ public final class Axis extends NamedElement { */ final boolean isWraparound() { if (abbreviation == 0) { - return AxisDirection.EAST.equals(AxisDirections.absolute(direction)) && Units.isAngular(getUnit()); + return AxisDirections.absolute(direction) == AxisDirection.EAST && Units.isAngular(getUnit()); } else { return abbreviation == 'λ'; } @@ -909,7 +909,7 @@ public final class Axis extends NamedElement { */ final Vector read() throws IOException, DataStoreException { final TransferFunction tr = coordinates.getTransferFunction(); - if (TransferFunctionType.LINEAR.equals(tr.getType())) { + if (tr.getType() == TransferFunctionType.LINEAR) { Vector data = coordinates.read(); if (gridSizes != null) { data = data.subList(0, getSizeProduct(0)); // Trim trailing NaN values. diff --git a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/AxisType.java b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/AxisType.java index c9c8ac9a0d..b6ca2b405a 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/AxisType.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/AxisType.java @@ -154,9 +154,9 @@ public enum AxisType { */ if (Units.isAngular(axis.getUnit())) { final AxisDirection direction = AxisDirections.absolute(Axis.direction(axis.getUnitsString())); - if (AxisDirection.EAST.equals(direction)) { + if (direction == AxisDirection.EAST) { return 'λ'; - } else if (AxisDirection.NORTH.equals(direction)) { + } else if (direction == AxisDirection.NORTH) { return 'φ'; } } diff --git a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java index aa219f552a..80274481c9 100644 --- a/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java +++ b/endorsed/src/org.apache.sis.storage.netcdf/main/org/apache/sis/storage/netcdf/base/CRSBuilder.java @@ -438,7 +438,7 @@ previous: for (int i=components.size(); --i >= 0;) { final CoordinateSystem cs = referenceSystem.getCoordinateSystem(); for (int i=cs.getDimension(); --i >= 0;) { final CoordinateSystemAxis axis = cs.getAxis(i); - if (RangeMeaning.WRAPAROUND.equals(axis.getRangeMeaning())) { + if (axis.getRangeMeaning() == RangeMeaning.WRAPAROUND) { final NumberRange<?> range = axes[i].read().range(); // Vector is cached. if (range != null) { // Note: minimum/maximum are not necessarily first and last values in the vector. @@ -635,8 +635,8 @@ previous: for (int i=components.size(); --i >= 0;) { final Axis axis = getFirstAxis(); final Unit<?> unit = axis.getUnit(); if (unit == null || expected.equals(unit)) { - isLongitudeFirst = AxisDirection.EAST.equals(axis.direction); - if (isLongitudeFirst || AxisDirection.NORTH.equals(axis.direction)) { + isLongitudeFirst = (axis.direction == AxisDirection.EAST); + if (isLongitudeFirst || (axis.direction == AxisDirection.NORTH)) { return true; } } @@ -875,7 +875,7 @@ previous: for (int i=components.size(); --i >= 0;) { final Unit<?> unit = axis.getUnit(); final CommonCRS.Vertical predefined; if (Units.METRE.equals(unit)) { - if (AxisDirection.UP.equals(axis.direction)) { + if (axis.direction == AxisDirection.UP) { predefined = CommonCRS.Vertical.MEAN_SEA_LEVEL; } else { predefined = CommonCRS.Vertical.DEPTH; diff --git a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/postgis/RasterWriter.java b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/postgis/RasterWriter.java index dd82092c68..eaefb886dd 100644 --- a/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/postgis/RasterWriter.java +++ b/endorsed/src/org.apache.sis.storage.sql/main/org/apache/sis/storage/sql/postgis/RasterWriter.java @@ -241,7 +241,7 @@ public final class RasterWriter extends RasterFormat { * Write the header followed by all bands. */ output.buffer.order(byteOrder); - output.writeByte(ByteOrder.LITTLE_ENDIAN.equals(byteOrder) ? 1 : 0); + output.writeByte(byteOrder == ByteOrder.LITTLE_ENDIAN ? 1 : 0); output.writeShort(0); // WKB version number. output.writeShort(ensureUnsignedShort("numBands", numBands)); output.writeDouble(gridToCRS.getScaleX()); diff --git a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Person.java b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Person.java index b877926cce..07c0985093 100644 --- a/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Person.java +++ b/endorsed/src/org.apache.sis.storage.xml/main/org/apache/sis/storage/gpx/Person.java @@ -114,8 +114,8 @@ public final class Person implements Responsibility, Party, Contact, Address { return (Person) r; } final Role role = r.getRole(); - final boolean isCreator = Role.ORIGINATOR.equals(role); - if (isCreator || Role.AUTHOR.equals(role)) { + final boolean isCreator = (role == Role.ORIGINATOR); + if (isCreator || role == Role.AUTHOR) { for (final Party p : r.getParties()) { final String name = Types.toString(p.getName(), locale); if (name != null) { diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataBuilder.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataBuilder.java index 5732f404f6..d0014ba154 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataBuilder.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataBuilder.java @@ -1663,7 +1663,7 @@ parse: for (int i = 0; i < length;) { if (notice.regionMatches(true, i, symbol, 0, symbol.length())) { final int after = i + symbol.length(); if (after >= length || isSpaceOrPunctuation(notice.codePointAt(after))) { - isCopyright |= Restriction.COPYRIGHT.equals(r.restriction); + isCopyright |= (r.restriction == Restriction.COPYRIGHT); constraints.getUseConstraints().add(r.restriction); wasPunctuation = true; // Pretend that "Copyright" was followed by a coma. skipNextChars = true; // Ignore spaces and punctuations until the next word. diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataFetcher.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataFetcher.java index 7a60ecb1f7..f8dbad4651 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataFetcher.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/MetadataFetcher.java @@ -220,7 +220,7 @@ public abstract class MetadataFetcher<T> { */ protected boolean accept(final CitationDate info) { if (creationDate == null) { - if (DateType.CREATION.equals(info.getDateType())) { + if (info.getDateType() == DateType.CREATION) { creationDate = List.of(convertDate(info.getDate())); } else { return false; // Search another date. diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/WritableGridCoverageSupport.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/WritableGridCoverageSupport.java index 247e22b692..37ad5a39a8 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/WritableGridCoverageSupport.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/base/WritableGridCoverageSupport.java @@ -79,8 +79,8 @@ public final class WritableGridCoverageSupport implements Localized { public WritableGridCoverageSupport(final GridCoverageResource target, final WritableGridCoverageResource.Option[] options) { this.target = target; for (final WritableGridCoverageResource.Option option : options) { - replace |= WritableGridCoverageResource.CommonOption.REPLACE.equals(option); - update |= WritableGridCoverageResource.CommonOption.UPDATE .equals(option); + replace |= (option == WritableGridCoverageResource.CommonOption.REPLACE); + update |= (option == WritableGridCoverageResource.CommonOption.UPDATE); } if (replace & update) { throw new IllegalArgumentException(Errors.format(Errors.Keys.MutuallyExclusiveOptions_2, diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java index 5e4debd581..e5920dd3a7 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/csv/Store.java @@ -234,7 +234,7 @@ final class Store extends URIDataStore implements FeatureSet { final Reader r = connector.commit(Reader.class, StoreProvider.NAME); source = (r instanceof BufferedReader) ? (BufferedReader) r : new LineNumberReader(r); geometries = Geometries.factory(connector.getOption(OptionKey.GEOMETRY_LIBRARY)); - dissociate = FoliationRepresentation.FRAGMENTED.equals(connector.getOption(DataOptionKey.FOLIATION_REPRESENTATION)); + dissociate = connector.getOption(DataOptionKey.FOLIATION_REPRESENTATION) == FoliationRepresentation.FRAGMENTED; GeneralEnvelope envelope = null; FeatureType featureType = null; Foliation foliation = null; diff --git a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/event/StoreListeners.java b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/event/StoreListeners.java index 559330333d..b075dc34dc 100644 --- a/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/event/StoreListeners.java +++ b/endorsed/src/org.apache.sis.storage/main/org/apache/sis/storage/event/StoreListeners.java @@ -732,7 +732,7 @@ public class StoreListeners implements Localized { if (isPossibleEvent(permittedEventTypes, eventType)) { ForType<E> ce = null; for (ForType<?> e = listeners; e != null; e = e.next) { - if (e.type.equals(eventType)) { + if (e.type == eventType) { ce = (ForType<E>) e; break; } @@ -789,7 +789,7 @@ public class StoreListeners implements Localized { ArgumentChecks.ensureNonNull("listener", listener); ArgumentChecks.ensureNonNull("eventType", eventType); for (ForType<?> e = listeners; e != null; e = e.next) { - if (e.type.equals(eventType)) { + if (e.type == eventType) { if (((ForType<E>) e).remove(listener) && cascadedListeners != null) { final StoreListener cascade = cascadedListeners.remove(eventType); if (cascade != null) { @@ -819,7 +819,7 @@ public class StoreListeners implements Localized { ArgumentChecks.ensureNonNull("listener", listener); ArgumentChecks.ensureNonNull("eventType", eventType); for (ForType<?> e = listeners; e != null; e = e.next) { - if (e.type.equals(eventType) && e.hasListener(listener)) { + if (e.type == eventType && e.hasListener(listener)) { return true; } } diff --git a/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/ArrayVector.java b/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/ArrayVector.java index ad7e4cf8d9..84f607ebb8 100644 --- a/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/ArrayVector.java +++ b/endorsed/src/org.apache.sis.util/main/org/apache/sis/math/ArrayVector.java @@ -138,7 +138,7 @@ abstract class ArrayVector<E extends Number> extends Vector implements CheckedCo * This method shall be invoked only for vector of floating point values (this is not verified). */ static Vector compress(final Vector source, final double tolerance) { - if (!Float.class.equals(source.getElementType())) { + if (source.getElementType() != Float.class) { /* * For floating point types, verify if values are equivalent to `float` values. * There are two different ways to pad extra fraction digits in `double` values: diff --git a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java index 8220ba595e..13680c102e 100644 --- a/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java +++ b/incubator/src/org.apache.sis.storage.shapefile/main/org/apache/sis/storage/shapefile/ShapefileStore.java @@ -1004,7 +1004,7 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe final CodeList operatorType = filter.getOperatorType(); - if (SpatialOperatorName.BBOX.equals(operatorType)) { + if (operatorType == SpatialOperatorName.BBOX) { Envelope env = isDirectBbox(filter); if (env != null) { return new AbstractMap.SimpleImmutableEntry<>(env, null); @@ -1012,7 +1012,7 @@ public final class ShapefileStore extends DataStore implements WritableFeatureSe return new AbstractMap.SimpleImmutableEntry<>(null, filter); } - } else if (LogicalOperatorName.AND.equals(operatorType)) { + } else if (operatorType == LogicalOperatorName.AND) { boolean rebuildAnd = false; List<Filter<?>> lst = (List<Filter<?>>) ((LogicalOperator<?>)filter).getOperands(); diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/ColorName.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/ColorName.java index 38cddf0b79..e7d3224bce 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/ColorName.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/internal/ColorName.java @@ -42,7 +42,7 @@ public final class ColorName { static { final StringBuilder buffer = new StringBuilder(); for (final Field field : Color.class.getFields()) { - if (Modifier.isStatic(field.getModifiers()) && Color.class.equals(field.getType())) try { + if (Modifier.isStatic(field.getModifiers()) && field.getType() == Color.class) try { final String name = field.getName(); buffer.append(name.toLowerCase()); // Default locale is okay here. buffer.setCharAt(0, name.charAt(0)); // Code point not used in Color API. diff --git a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java index 110c4b0b71..aaeaa27411 100644 --- a/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java +++ b/optional/src/org.apache.sis.gui/main/org/apache/sis/gui/metadata/IdentificationInfo.java @@ -345,12 +345,12 @@ final class IdentificationInfo extends Section<Identification> { final Date cd = c.getDate(); if (cd != null) { final DateType type = c.getDateType(); - if (DateType.PUBLICATION.equals(type) || DateType.RELEASED.equals(type)) { + if (type == DateType.PUBLICATION || type == DateType.RELEASED) { label = Vocabulary.Keys.PublicationDate; date = cd; break; // Take the first publication or release date. } - final boolean isCreation = DateType.CREATION.equals(type); + final boolean isCreation = (type == DateType.CREATION); if (date == null || isCreation) { label = isCreation ? Vocabulary.Keys.CreationDate : Vocabulary.Keys.Date; date = cd; // Fallback date: creation date, or the first date otherwise.