forked from deephaven/deephaven-core
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypedFunction, ObjectProcessor, and ObjectProcessorFunctions
* io.deephaven.functions: extensions/protobuf -> java/functions * io.deephaven.processor: extensions/kafka -> java/processor * io.deephaven.processor.functions: extensions/kafka -> java/processor-functions Introduced top-level directory `java/`, with the hopes of having it become the directory for new projects ala deephaven#4991
- Loading branch information
1 parent
ecebae9
commit 5b60730
Showing
53 changed files
with
205 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'io.deephaven.project.register' | ||
} | ||
|
||
dependencies { | ||
api project(':qst') | ||
|
||
compileOnly depAnnotations | ||
|
||
Classpaths.inheritJUnitPlatform(project) | ||
Classpaths.inheritAssertJ(project) | ||
testImplementation 'org.junit.jupiter:junit-jupiter' | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.deephaven.project.ProjectType=JAVA_PUBLIC |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'io.deephaven.project.register' | ||
} | ||
|
||
|
||
dependencies { | ||
api project(':processor') | ||
api project(':functions') | ||
|
||
implementation project(':engine-time') | ||
|
||
Classpaths.inheritJUnitClassic(project, 'testImplementation') | ||
Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') | ||
Classpaths.inheritAssertJ(project) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.deephaven.project.ProjectType=JAVA_PUBLIC |
138 changes: 138 additions & 0 deletions
138
java/processor-functions/src/main/java/io/deephaven/processor/functions/ChunkUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
/** | ||
* Copyright (c) 2016-2023 Deephaven Data Labs and Patent Pending | ||
*/ | ||
package io.deephaven.processor.functions; | ||
|
||
import io.deephaven.chunk.ObjectChunk; | ||
import io.deephaven.chunk.WritableBooleanChunk; | ||
import io.deephaven.chunk.WritableByteChunk; | ||
import io.deephaven.chunk.WritableCharChunk; | ||
import io.deephaven.chunk.WritableDoubleChunk; | ||
import io.deephaven.chunk.WritableFloatChunk; | ||
import io.deephaven.chunk.WritableIntChunk; | ||
import io.deephaven.chunk.WritableLongChunk; | ||
import io.deephaven.chunk.WritableObjectChunk; | ||
import io.deephaven.chunk.WritableShortChunk; | ||
import io.deephaven.functions.ToByteFunction; | ||
import io.deephaven.functions.ToCharFunction; | ||
import io.deephaven.functions.ToFloatFunction; | ||
import io.deephaven.functions.ToShortFunction; | ||
|
||
import java.util.function.Function; | ||
import java.util.function.Predicate; | ||
import java.util.function.ToDoubleFunction; | ||
import java.util.function.ToIntFunction; | ||
import java.util.function.ToLongFunction; | ||
|
||
final class ChunkUtils { | ||
|
||
// Copy from io.deephaven.kafka.ingest.ChunkUtils | ||
|
||
public static <T> void applyInto( | ||
Predicate<? super T> booleanFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableBooleanChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, booleanFunction.test(src.get(i + srcOffset))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToByteFunction<? super T> byteFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableByteChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, byteFunction.applyAsByte(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToCharFunction<? super T> charFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableCharChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, charFunction.applyAsChar(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToShortFunction<? super T> shortFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableShortChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, shortFunction.applyAsShort(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToIntFunction<? super T> intFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableIntChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, intFunction.applyAsInt(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToLongFunction<? super T> longFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableLongChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, longFunction.applyAsLong(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToFloatFunction<? super T> floatFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableFloatChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, floatFunction.applyAsFloat(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T> void applyInto( | ||
ToDoubleFunction<? super T> doubleFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableDoubleChunk<?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, doubleFunction.applyAsDouble(src.get(srcOffset + i))); | ||
} | ||
} | ||
|
||
public static <T, R> void applyInto( | ||
Function<? super T, ? extends R> objFunction, | ||
ObjectChunk<? extends T, ?> src, | ||
int srcOffset, | ||
WritableObjectChunk<R, ?> dest, | ||
int destOffset, | ||
int length) { | ||
for (int i = 0; i < length; ++i) { | ||
dest.set(destOffset + i, objFunction.apply(src.get(srcOffset + i))); | ||
} | ||
} | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'io.deephaven.project.register' | ||
} | ||
|
||
|
||
dependencies { | ||
api project(':qst') | ||
api project(':engine-chunk') | ||
|
||
implementation project(':engine-time') | ||
|
||
Classpaths.inheritJUnitClassic(project, 'testImplementation') | ||
Classpaths.inheritSlf4j(project, 'slf4j-simple', 'testRuntimeOnly') | ||
Classpaths.inheritAssertJ(project) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
io.deephaven.project.ProjectType=JAVA_PUBLIC |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters