io.deephaven.chunk.util.hashing.LongChunkEquals Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-chunk Show documentation
Show all versions of deephaven-engine-chunk Show documentation
Engine Chunks: Array-like data structures for dense, efficient data movement
The newest version!
//
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending
//
// ****** AUTO-GENERATED CLASS - DO NOT EDIT MANUALLY
// ****** Edit CharChunkEquals and run "./gradlew replicateHashing" to regenerate
//
// @formatter:off
package io.deephaven.chunk.util.hashing;
import io.deephaven.chunk.*;
import io.deephaven.chunk.attributes.Any;
import io.deephaven.chunk.attributes.ChunkPositions;
import io.deephaven.util.compare.LongComparisons;
// region name
public class LongChunkEquals implements ChunkEquals {
public static LongChunkEquals INSTANCE = new LongChunkEquals();
// endregion name
public static boolean equalReduce(LongChunk extends Any> lhs, LongChunk extends Any> rhs) {
if (lhs.size() != rhs.size()) {
return false;
}
for (int ii = 0; ii < lhs.size(); ++ii) {
if (!eq(lhs.get(ii), rhs.get(ii))) {
return false;
}
}
return true;
}
public static int firstDifference(LongChunk extends Any> lhs, LongChunk extends Any> rhs) {
int ii = 0;
for (ii = 0; ii < lhs.size() && ii < rhs.size(); ++ii) {
if (!eq(lhs.get(ii), rhs.get(ii))) {
return ii;
}
}
return ii;
}
private static void equal(LongChunk extends Any> lhs, LongChunk extends Any> rhs,
WritableBooleanChunk destination) {
for (int ii = 0; ii < lhs.size(); ++ii) {
destination.set(ii, eq(lhs.get(ii), rhs.get(ii)));
}
destination.setSize(lhs.size());
}
private static void equalNext(LongChunk extends Any> chunk, WritableBooleanChunk destination) {
for (int ii = 0; ii < chunk.size() - 1; ++ii) {
destination.set(ii, eq(chunk.get(ii), chunk.get(ii + 1)));
}
destination.setSize(chunk.size() - 1);
}
private static void equal(LongChunk extends Any> lhs, long rhs, WritableBooleanChunk destination) {
for (int ii = 0; ii < lhs.size(); ++ii) {
destination.set(ii, eq(lhs.get(ii), rhs));
}
destination.setSize(lhs.size());
}
public static void notEqual(LongChunk extends Any> lhs, LongChunk extends Any> rhs,
WritableBooleanChunk destination) {
for (int ii = 0; ii < lhs.size(); ++ii) {
destination.set(ii, neq(lhs.get(ii), rhs.get(ii)));
}
destination.setSize(lhs.size());
}
public static void notEqual(LongChunk extends Any> lhs, long rhs, WritableBooleanChunk destination) {
for (int ii = 0; ii < lhs.size(); ++ii) {
destination.set(ii, neq(lhs.get(ii), rhs));
}
destination.setSize(lhs.size());
}
private static void andEqual(LongChunk extends Any> lhs, LongChunk extends Any> rhs,
WritableBooleanChunk destination) {
for (int ii = 0; ii < lhs.size(); ++ii) {
destination.set(ii, destination.get(ii) && eq(lhs.get(ii), rhs.get(ii)));
}
destination.setSize(lhs.size());
}
private static void andNotEqual(LongChunk extends Any> lhs, LongChunk extends Any> rhs,
WritableBooleanChunk destination) {
for (int ii = 0; ii < lhs.size(); ++ii) {
destination.set(ii, destination.get(ii) && neq(lhs.get(ii), rhs.get(ii)));
}
destination.setSize(lhs.size());
}
private static void andEqualNext(LongChunk extends Any> chunk, WritableBooleanChunk destination) {
for (int ii = 0; ii < chunk.size() - 1; ++ii) {
destination.set(ii, destination.get(ii) && eq(chunk.get(ii), chunk.get(ii + 1)));
}
destination.setSize(chunk.size() - 1);
}
private static void equalPairs(IntChunk chunkPositionsToCheckForEquality,
LongChunk extends Any> valuesChunk, WritableBooleanChunk destinations) {
final int pairCount = chunkPositionsToCheckForEquality.size() / 2;
for (int ii = 0; ii < pairCount; ++ii) {
final int firstPosition = chunkPositionsToCheckForEquality.get(ii * 2);
final int secondPosition = chunkPositionsToCheckForEquality.get(ii * 2 + 1);
final boolean equals = eq(valuesChunk.get(firstPosition), valuesChunk.get(secondPosition));
destinations.set(ii, equals);
}
destinations.setSize(pairCount);
}
private static void andEqualPairs(IntChunk chunkPositionsToCheckForEquality,
LongChunk extends Any> valuesChunk, WritableBooleanChunk destinations) {
final int pairCount = chunkPositionsToCheckForEquality.size() / 2;
for (int ii = 0; ii < pairCount; ++ii) {
if (destinations.get(ii)) {
final int firstPosition = chunkPositionsToCheckForEquality.get(ii * 2);
final int secondPosition = chunkPositionsToCheckForEquality.get(ii * 2 + 1);
final boolean equals = eq(valuesChunk.get(firstPosition), valuesChunk.get(secondPosition));
destinations.set(ii, equals);
}
}
}
private static void equalPermuted(IntChunk lhsPositions, IntChunk rhsPositions,
LongChunk extends Any> lhs, LongChunk extends Any> rhs, WritableBooleanChunk destinations) {
for (int ii = 0; ii < lhsPositions.size(); ++ii) {
final int lhsPosition = lhsPositions.get(ii);
final int rhsPosition = rhsPositions.get(ii);
final boolean equals = eq(lhs.get(lhsPosition), rhs.get(rhsPosition));
destinations.set(ii, equals);
}
destinations.setSize(lhsPositions.size());
}
private static void andEqualPermuted(IntChunk lhsPositions, IntChunk rhsPositions,
LongChunk extends Any> lhs, LongChunk extends Any> rhs, WritableBooleanChunk destinations) {
for (int ii = 0; ii < lhsPositions.size(); ++ii) {
if (destinations.get(ii)) {
final int lhsPosition = lhsPositions.get(ii);
final int rhsPosition = rhsPositions.get(ii);
final boolean equals = eq(lhs.get(lhsPosition), rhs.get(rhsPosition));
destinations.set(ii, equals);
}
}
destinations.setSize(lhsPositions.size());
}
private static void equalLhsPermuted(IntChunk lhsPositions, LongChunk extends Any> lhs,
LongChunk extends Any> rhs, WritableBooleanChunk destinations) {
for (int ii = 0; ii < lhsPositions.size(); ++ii) {
final int lhsPosition = lhsPositions.get(ii);
final boolean equals = eq(lhs.get(lhsPosition), rhs.get(ii));
destinations.set(ii, equals);
}
destinations.setSize(lhsPositions.size());
}
private static void andEqualLhsPermuted(IntChunk lhsPositions, LongChunk extends Any> lhs,
LongChunk extends Any> rhs, WritableBooleanChunk destinations) {
for (int ii = 0; ii < lhsPositions.size(); ++ii) {
if (destinations.get(ii)) {
final int lhsPosition = lhsPositions.get(ii);
final boolean equals = eq(lhs.get(lhsPosition), rhs.get(ii));
destinations.set(ii, equals);
}
}
destinations.setSize(lhsPositions.size());
}
@Override
public boolean equalReduce(Chunk extends Any> lhs, Chunk extends Any> rhs) {
return equalReduce(lhs.asLongChunk(), rhs.asLongChunk());
}
@Override
public void equal(Chunk extends Any> lhs, Chunk extends Any> rhs, WritableBooleanChunk destination) {
equal(lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
public static void equal(Chunk extends Any> lhs, long rhs, WritableBooleanChunk destination) {
equal(lhs.asLongChunk(), rhs, destination);
}
@Override
public void equalNext(Chunk extends Any> chunk, WritableBooleanChunk destination) {
equalNext(chunk.asLongChunk(), destination);
}
@Override
public void andEqual(Chunk extends Any> lhs, Chunk extends Any> rhs, WritableBooleanChunk destination) {
andEqual(lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
@Override
public void andEqualNext(Chunk extends Any> chunk, WritableBooleanChunk destination) {
andEqualNext(chunk.asLongChunk(), destination);
}
@Override
public void equalPermuted(IntChunk lhsPositions, IntChunk rhsPositions,
Chunk extends Any> lhs, Chunk extends Any> rhs, WritableBooleanChunk destination) {
equalPermuted(lhsPositions, rhsPositions, lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
@Override
public void equalLhsPermuted(IntChunk lhsPositions, Chunk extends Any> lhs,
Chunk extends Any> rhs, WritableBooleanChunk destination) {
equalLhsPermuted(lhsPositions, lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
@Override
public void andEqualPermuted(IntChunk lhsPositions, IntChunk rhsPositions,
Chunk extends Any> lhs, Chunk extends Any> rhs, WritableBooleanChunk destination) {
andEqualPermuted(lhsPositions, rhsPositions, lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
@Override
public void andEqualLhsPermuted(IntChunk lhsPositions, Chunk extends Any> lhs,
Chunk extends Any> rhs, WritableBooleanChunk destination) {
andEqualLhsPermuted(lhsPositions, lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
@Override
public void notEqual(Chunk extends Any> lhs, Chunk extends Any> rhs, WritableBooleanChunk destination) {
notEqual(lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
public static void notEqual(Chunk extends Any> lhs, long rhs, WritableBooleanChunk destination) {
notEqual(lhs.asLongChunk(), rhs, destination);
}
@Override
public void andNotEqual(Chunk extends Any> lhs, Chunk extends Any> rhs, WritableBooleanChunk destination) {
andNotEqual(lhs.asLongChunk(), rhs.asLongChunk(), destination);
}
@Override
public void equalPairs(IntChunk chunkPositionsToCheckForEquality, Chunk extends Any> valuesChunk,
WritableBooleanChunk destinations) {
equalPairs(chunkPositionsToCheckForEquality, valuesChunk.asLongChunk(), destinations);
}
@Override
public void andEqualPairs(IntChunk chunkPositionsToCheckForEquality,
Chunk extends Any> valuesChunk, WritableBooleanChunk destinations) {
andEqualPairs(chunkPositionsToCheckForEquality, valuesChunk.asLongChunk(), destinations);
}
// region eq
static private boolean eq(long lhs, long rhs) {
return LongComparisons.eq(lhs, rhs);
}
// endregion eq
// region neq
static private boolean neq(long lhs, long rhs) {
return !eq(lhs, rhs);
}
// endregion neq
}