All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.deephaven.chunk.util.hashing.FloatChunkEquals Maven / Gradle / Ivy

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.FloatComparisons;

// region name
public class FloatChunkEquals implements ChunkEquals {
    public static FloatChunkEquals INSTANCE = new FloatChunkEquals();
    // endregion name

    public static boolean equalReduce(FloatChunk lhs, FloatChunk 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(FloatChunk lhs, FloatChunk 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(FloatChunk lhs, FloatChunk 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(FloatChunk 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(FloatChunk lhs, float 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(FloatChunk lhs, FloatChunk 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(FloatChunk lhs, float 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(FloatChunk lhs, FloatChunk 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(FloatChunk lhs, FloatChunk 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(FloatChunk 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,
            FloatChunk 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,
            FloatChunk 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,
            FloatChunk lhs, FloatChunk 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,
            FloatChunk lhs, FloatChunk 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, FloatChunk lhs,
            FloatChunk 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, FloatChunk lhs,
            FloatChunk 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 lhs, Chunk rhs) {
        return equalReduce(lhs.asFloatChunk(), rhs.asFloatChunk());
    }

    @Override
    public void equal(Chunk lhs, Chunk rhs, WritableBooleanChunk destination) {
        equal(lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    public static void equal(Chunk lhs, float rhs, WritableBooleanChunk destination) {
        equal(lhs.asFloatChunk(), rhs, destination);
    }

    @Override
    public void equalNext(Chunk chunk, WritableBooleanChunk destination) {
        equalNext(chunk.asFloatChunk(), destination);
    }

    @Override
    public void andEqual(Chunk lhs, Chunk rhs, WritableBooleanChunk destination) {
        andEqual(lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    @Override
    public void andEqualNext(Chunk chunk, WritableBooleanChunk destination) {
        andEqualNext(chunk.asFloatChunk(), destination);
    }

    @Override
    public void equalPermuted(IntChunk lhsPositions, IntChunk rhsPositions,
            Chunk lhs, Chunk rhs, WritableBooleanChunk destination) {
        equalPermuted(lhsPositions, rhsPositions, lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    @Override
    public void equalLhsPermuted(IntChunk lhsPositions, Chunk lhs,
            Chunk rhs, WritableBooleanChunk destination) {
        equalLhsPermuted(lhsPositions, lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    @Override
    public void andEqualPermuted(IntChunk lhsPositions, IntChunk rhsPositions,
            Chunk lhs, Chunk rhs, WritableBooleanChunk destination) {
        andEqualPermuted(lhsPositions, rhsPositions, lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    @Override
    public void andEqualLhsPermuted(IntChunk lhsPositions, Chunk lhs,
            Chunk rhs, WritableBooleanChunk destination) {
        andEqualLhsPermuted(lhsPositions, lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    @Override
    public void notEqual(Chunk lhs, Chunk rhs, WritableBooleanChunk destination) {
        notEqual(lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    public static void notEqual(Chunk lhs, float rhs, WritableBooleanChunk destination) {
        notEqual(lhs.asFloatChunk(), rhs, destination);
    }

    @Override
    public void andNotEqual(Chunk lhs, Chunk rhs, WritableBooleanChunk destination) {
        andNotEqual(lhs.asFloatChunk(), rhs.asFloatChunk(), destination);
    }

    @Override
    public void equalPairs(IntChunk chunkPositionsToCheckForEquality, Chunk valuesChunk,
            WritableBooleanChunk destinations) {
        equalPairs(chunkPositionsToCheckForEquality, valuesChunk.asFloatChunk(), destinations);
    }

    @Override
    public void andEqualPairs(IntChunk chunkPositionsToCheckForEquality,
            Chunk valuesChunk, WritableBooleanChunk destinations) {
        andEqualPairs(chunkPositionsToCheckForEquality, valuesChunk.asFloatChunk(), destinations);
    }

    // region eq
    static private boolean eq(float lhs, float rhs) {
        return FloatComparisons.eq(lhs, rhs);
    }
    // endregion eq

    // region neq
    static private boolean neq(float lhs, float rhs) {
        return !eq(lhs, rhs);
    }
    // endregion neq
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy