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

io.deephaven.engine.table.impl.sources.regioned.PartitioningSourceFactory Maven / Gradle / Ivy

There is a newer version: 0.37.1
Show newest version
/**
 * Copyright (c) 2016-2022 Deephaven Data Labs and Patent Pending
 */
package io.deephaven.engine.table.impl.sources.regioned;

import org.jetbrains.annotations.NotNull;

class PartitioningSourceFactory {

    /**
     * Get a partitioning {@link RegionedColumnSource} for the supplied {@code dataType}.
     *
     * @param dataType The data type expected for partition values
     * @return A new partitioning {@link RegionedColumnSource}
     */
    static  RegionedColumnSource makePartitioningSource(
            @NotNull final Class dataType) {
        final RegionedColumnSource result;
        if (dataType == boolean.class || dataType == Boolean.class) {
            result = new RegionedColumnSourceObject.Partitioning<>(dataType);
        } else if (dataType == char.class || dataType == Character.class) {
            result = new RegionedColumnSourceChar.Partitioning();
        } else if (dataType == byte.class || dataType == Byte.class) {
            result = new RegionedColumnSourceByte.Partitioning();
        } else if (dataType == short.class || dataType == Short.class) {
            result = new RegionedColumnSourceShort.Partitioning();
        } else if (dataType == int.class || dataType == Integer.class) {
            result = new RegionedColumnSourceInt.Partitioning();
        } else if (dataType == long.class || dataType == Long.class) {
            result = new RegionedColumnSourceLong.Partitioning();
        } else if (dataType == float.class || dataType == Float.class) {
            result = new RegionedColumnSourceFloat.Partitioning();
        } else if (dataType == double.class || dataType == Double.class) {
            result = new RegionedColumnSourceDouble.Partitioning();
        } else {
            result = new RegionedColumnSourceObject.Partitioning<>(dataType);
        }
        // noinspection unchecked
        return (RegionedColumnSource) result;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy