diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmcountdistinct/ObjectSsmBackedSource.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmcountdistinct/ObjectSsmBackedSource.java index 507f8d66b8c..6e91d781d7f 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmcountdistinct/ObjectSsmBackedSource.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmcountdistinct/ObjectSsmBackedSource.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.by.ssmcountdistinct; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.vector.ObjectVector; import io.deephaven.engine.table.impl.AbstractColumnSource; diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmminmax/ObjectSetResult.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmminmax/ObjectSetResult.java index e24f94c50b1..f1d20395d7e 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmminmax/ObjectSetResult.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmminmax/ObjectSetResult.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.by.ssmminmax; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.engine.table.WritableColumnSource; import io.deephaven.engine.table.impl.sources.ObjectArraySource; diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmpercentile/ObjectPercentileTypeHelper.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmpercentile/ObjectPercentileTypeHelper.java index 542be9e039c..ef945c0a32d 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmpercentile/ObjectPercentileTypeHelper.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/by/ssmpercentile/ObjectPercentileTypeHelper.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.by.ssmpercentile; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.ChunkLengths; import io.deephaven.chunk.attributes.Values; diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectDupCompactKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectDupCompactKernel.java index cb063342cf0..f8835352a24 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectDupCompactKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectDupCompactKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.join.dupcompact; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.chunk.attributes.Any; @@ -109,19 +110,8 @@ private static int compactDuplicatesPreferFirst( // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions private static boolean leq(Object lhs, Object rhs) { diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectReverseDupCompactKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectReverseDupCompactKernel.java index b5f8868278f..b1f487cd052 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectReverseDupCompactKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupcompact/ObjectReverseDupCompactKernel.java @@ -9,8 +9,10 @@ package io.deephaven.engine.table.impl.join.dupcompact; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.chunk.attributes.Any; @@ -112,17 +114,7 @@ private static int compactDuplicatesPreferFirst( // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupexpand/ObjectDupExpandKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupexpand/ObjectDupExpandKernel.java index ca6889b93cb..d6c93dade44 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupexpand/ObjectDupExpandKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/dupexpand/ObjectDupExpandKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.join.dupexpand; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.chunk.attributes.Any; diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactReverseStampKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactReverseStampKernel.java index fd24f6ad0a8..62f9360610f 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactReverseStampKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactReverseStampKernel.java @@ -9,8 +9,10 @@ package io.deephaven.engine.table.impl.join.stamp; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.engine.rowset.chunkattributes.RowKeys; @@ -84,17 +86,7 @@ static private void computeRedirections(ObjectChunk leftStamps, // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactStampKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactStampKernel.java index 1ffc2ddf90b..33c9ba8e2c2 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactStampKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectNoExactStampKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.join.stamp; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.engine.rowset.chunkattributes.RowKeys; @@ -81,19 +82,8 @@ static private void computeRedirections(ObjectChunk leftStamps, // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions private static boolean lt(Object lhs, Object rhs) { diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectReverseStampKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectReverseStampKernel.java index 2879a4ff776..93cabd41c44 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectReverseStampKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectReverseStampKernel.java @@ -9,8 +9,10 @@ package io.deephaven.engine.table.impl.join.stamp; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.engine.rowset.chunkattributes.RowKeys; @@ -87,17 +89,7 @@ static private void computeRedirections(ObjectChunk leftStamps, // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectStampKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectStampKernel.java index affae91eaee..e055ecdd356 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectStampKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/join/stamp/ObjectStampKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.join.stamp; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.engine.rowset.chunkattributes.RowKeys; @@ -84,19 +85,8 @@ static private void computeRedirections(ObjectChunk leftStamps, // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions private static boolean lt(Object lhs, Object rhs) { diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortDescendingKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortDescendingKernel.java index 1dde8e730af..285bbba2437 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortDescendingKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortDescendingKernel.java @@ -9,6 +9,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Any; import io.deephaven.chunk.attributes.ChunkLengths; @@ -204,17 +205,7 @@ static private v // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortKernel.java index 69de4107b14..a91afda549f 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectByteTimsortKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Any; import io.deephaven.chunk.attributes.ChunkLengths; @@ -203,19 +204,8 @@ static private v // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions @VisibleForTesting diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortDescendingKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortDescendingKernel.java index c02a83662b0..6ee2d1259c5 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortDescendingKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortDescendingKernel.java @@ -9,6 +9,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Any; import io.deephaven.chunk.attributes.ChunkLengths; @@ -204,17 +205,7 @@ static private v // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortKernel.java index 973f705e64c..092177d9583 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectIntTimsortKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Any; import io.deephaven.chunk.attributes.ChunkLengths; @@ -203,19 +204,8 @@ static private v // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions @VisibleForTesting diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortDescendingKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortDescendingKernel.java index f9ecfa02fa0..3db4c9e2aa2 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortDescendingKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortDescendingKernel.java @@ -9,6 +9,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Any; import io.deephaven.chunk.attributes.ChunkLengths; @@ -204,17 +205,7 @@ static private v // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortKernel.java index 11eee8f5df8..7002d731900 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectLongTimsortKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Any; import io.deephaven.chunk.attributes.ChunkLengths; @@ -203,19 +204,8 @@ static private v // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions @VisibleForTesting diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortDescendingKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortDescendingKernel.java index 4e7c2667a84..8dbecf1277b 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortDescendingKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortDescendingKernel.java @@ -9,6 +9,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.ObjectChunk; import io.deephaven.chunk.WritableObjectChunk; @@ -161,17 +162,7 @@ static private void timSort( // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortKernel.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortKernel.java index 165306d225c..9b834eaccc5 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortKernel.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sort/timsort/ObjectTimsortKernel.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.sort.timsort; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.ObjectChunk; import io.deephaven.chunk.WritableObjectChunk; @@ -160,19 +161,8 @@ static private void timSort( // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions @VisibleForTesting diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/sortcheck/ObjectReverseSortCheck.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/sortcheck/ObjectReverseSortCheck.java index ae08133c625..9597fdfa2ee 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/sortcheck/ObjectReverseSortCheck.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/sortcheck/ObjectReverseSortCheck.java @@ -9,6 +9,7 @@ package io.deephaven.engine.table.impl.sortcheck; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.attributes.Values; import io.deephaven.util.compare.ObjectComparisons; @@ -41,17 +42,7 @@ private int sortCheck(ObjectChunk valuesToCheck) { // region comparison functions // descending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return 1; - } - if (rhs == null) { - return -1; - } - //noinspection unchecked,rawtypes - return ((Comparable)rhs).compareTo(lhs); + return ObjectComparisons.compare(rhs, lhs); } // endregion comparison functions diff --git a/engine/table/src/main/java/io/deephaven/engine/table/impl/ssa/ObjectChunkSsaStamp.java b/engine/table/src/main/java/io/deephaven/engine/table/impl/ssa/ObjectChunkSsaStamp.java index c398afa86fa..6dc103737bf 100644 --- a/engine/table/src/main/java/io/deephaven/engine/table/impl/ssa/ObjectChunkSsaStamp.java +++ b/engine/table/src/main/java/io/deephaven/engine/table/impl/ssa/ObjectChunkSsaStamp.java @@ -8,6 +8,7 @@ package io.deephaven.engine.table.impl.ssa; import java.util.Objects; +import io.deephaven.util.compare.ObjectComparisons; import io.deephaven.chunk.*; import io.deephaven.engine.rowset.chunkattributes.RowKeys; @@ -249,19 +250,8 @@ private static int findFirstResponsiveLeft(int leftLowIdx, ObjectChunk javaTuples, Objec // region comparison functions // ascending comparison private static int doComparison(Object lhs, Object rhs) { - if (lhs == rhs) { - return 0; - } - if (lhs == null) { - return -1; - } - if (rhs == null) { - return 1; - } - //noinspection unchecked,rawtypes - return ((Comparable)lhs).compareTo(rhs); + return ObjectComparisons.compare(lhs, rhs); } - // endregion comparison functions private static boolean gt(Object lhs, Object rhs) { diff --git a/replication/reflective/build.gradle b/replication/reflective/build.gradle index adf1a41e815..c8bcd42ddbe 100644 --- a/replication/reflective/build.gradle +++ b/replication/reflective/build.gradle @@ -19,6 +19,9 @@ dependencies { runtimeOnly libs.slf4j.simple implementation libs.arrow.vector + + // needed at compile + runtime due to our use of code-generation at runtime + implementation libs.jetbrains.annotations } task replicateAll { diff --git a/replication/static/src/main/java/io/deephaven/replicators/ReplicateSortKernel.java b/replication/static/src/main/java/io/deephaven/replicators/ReplicateSortKernel.java index 2fba4bb9de9..378b4e3655a 100644 --- a/replication/static/src/main/java/io/deephaven/replicators/ReplicateSortKernel.java +++ b/replication/static/src/main/java/io/deephaven/replicators/ReplicateSortKernel.java @@ -366,41 +366,21 @@ public static List fixupObjectComparisons(List lines) { } public static List fixupObjectComparisons(List lines, boolean ascending) { - final List ascendingComparision = Arrays.asList( + final List ascendingComparison = Arrays.asList( " // ascending comparison", " private static int doComparison(Object lhs, Object rhs) {", - " if (lhs == rhs) {", - " return 0;", - " }", - " if (lhs == null) {", - " return -1;", - " }", - " if (rhs == null) {", - " return 1;", - " }", - " //noinspection unchecked,rawtypes", - " return ((Comparable)lhs).compareTo(rhs);", - " }", - ""); - final List descendingComparision = Arrays.asList( + " return ObjectComparisons.compare(lhs, rhs);", + " }"); + final List descendingComparison = Arrays.asList( " // descending comparison", " private static int doComparison(Object lhs, Object rhs) {", - " if (lhs == rhs) {", - " return 0;", - " }", - " if (lhs == null) {", - " return 1;", - " }", - " if (rhs == null) {", - " return -1;", - " }", - " //noinspection unchecked,rawtypes", - " return ((Comparable)rhs).compareTo(lhs);", + " return ObjectComparisons.compare(rhs, lhs);", " }"); - - return addImport(simpleFixup( - replaceRegion(lines, "comparison functions", ascending ? ascendingComparision : descendingComparision), - "equality function", "lhs == rhs", "Objects.equals(lhs, rhs)"), "import java.util.Objects;"); + lines = replaceRegion(lines, "comparison functions", ascending ? ascendingComparison : descendingComparison); + lines = simpleFixup( + lines, + "equality function", "lhs == rhs", "Objects.equals(lhs, rhs)"); + return addImport(lines, "import java.util.Objects;", "import io.deephaven.util.compare.ObjectComparisons;"); } public static List invertComparisons(List lines) {