io.deephaven.chunk.util.hashing.IntToLongCast 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 CharToLongCast 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 a long.
*
* @param the chunk's attribute
*/
public class IntToLongCast implements ToLongFunctor {
private final WritableLongChunk result;
IntToLongCast(int size) {
result = WritableLongChunk.makeWritableChunk(size);
}
@Override
public LongChunk apply(Chunk input) {
return cast(input.asIntChunk());
}
private LongChunk cast(IntChunk input) {
castInto(input, result);
return result;
}
public static void castInto(IntChunk extends T2> input, WritableLongChunk super T2> result) {
for (int ii = 0; ii < input.size(); ++ii) {
result.set(ii, (long) input.get(ii));
}
result.setSize(input.size());
}
@Override
public void close() {
result.close();
}
}