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

io.deephaven.engine.table.impl.select.FormulaColumn 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.select;

import io.deephaven.base.Pair;
import io.deephaven.engine.table.impl.MatchPair;

import java.util.List;
import java.util.Map;

public interface FormulaColumn extends SelectColumn {

    static FormulaColumn createFormulaColumn(String columnName, String formulaString,
            FormulaParserConfiguration parser) {
        switch (parser) {
            case Deephaven:
                return new DhFormulaColumn(columnName, formulaString);
            case Numba:
                throw new UnsupportedOperationException("Python formula columns must be created from python");
            default:
                throw new UnsupportedOperationException("Parser support not implemented for " + parser);
        }
    }

    static FormulaColumn createFormulaColumn(String columnName, String formulaString) {
        return createFormulaColumn(columnName, formulaString, FormulaParserConfiguration.parser);
    }

    /**
     * @return true if all rows have a single constant value
     */
    default boolean hasConstantValue() {
        return false;
    }

    /**
     * Returns true if the formula expression of the column has Array Access that conforms to "i +/- <constant>"
     * or "ii +/- <constant>".
     *
     * @return true or false
     */
    default boolean hasConstantArrayAccess() {
        return getFormulaShiftColPair() != null;
    }

    /**
     * Returns a Pair object consisting of formula string and shift to column MatchPairs. If the column formula or
     * expression has Array Access that conforms to "i +/- <constant>" or "ii +/- <constant>". If there is a
     * parsing error for the expression null is returned.
     *
     * @return Pair of final formula string and shift to column MatchPairs.
     */
    default Pair>> getFormulaShiftColPair() {
        return null;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy