io.deephaven.chunk.util.hashing.ShortToIntegerCast 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 CharToIntegerCast and run "./gradlew replicateHashing" to regenerate
//
// @formatter:off
package io.deephaven.chunk.util.hashing;
import io.deephaven.chunk.*;
import io.deephaven.chunk.attributes.Any;
/**
* Cast the values in the input chunk to an int.
*
* @param the chunk's attribute
*/
public class ShortToIntegerCast implements ToIntFunctor {
private final WritableIntChunk result;
ShortToIntegerCast(int size) {
result = WritableIntChunk.makeWritableChunk(size);
}
@Override
public IntChunk extends T> apply(Chunk extends T> input) {
return cast(input.asShortChunk());
}
private IntChunk cast(ShortChunk extends T> input) {
castInto(input, result);
return result;
}
public static void castInto(ShortChunk extends T2> input, WritableIntChunk result) {
for (int ii = 0; ii < input.size(); ++ii) {
result.set(ii, (int) input.get(ii));
}
result.setSize(input.size());
}
@Override
public void close() {
result.close();
}
}