io.deephaven.engine.table.impl.select.FormulaParserConfiguration Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of deephaven-engine-table Show documentation
Show all versions of deephaven-engine-table Show documentation
Engine Table: Implementation and closely-coupled utilities
/**
* 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.configuration.Configuration;
public enum FormulaParserConfiguration {
Deephaven(), Numba();
public static final String OBFUSCATED_PARSER_ANNOTATION = "";
public static FormulaParserConfiguration parser = FormulaParserConfiguration
.valueOf(Configuration.getInstance().getStringWithDefault("default.parser", Deephaven.name()));
public static void setParser(FormulaParserConfiguration parser) {
FormulaParserConfiguration.parser = parser;
}
public static Pair extractParserAndExpression(String expression) {
if (expression.startsWith(FormulaParserConfiguration.OBFUSCATED_PARSER_ANNOTATION)) {
expression = expression.substring(OBFUSCATED_PARSER_ANNOTATION.length());
int endOfTag = expression.indexOf(':');
FormulaParserConfiguration parserConfig =
FormulaParserConfiguration.valueOf(expression.substring(0, endOfTag));
return new Pair<>(parserConfig, expression.substring(endOfTag + 1));
}
return new Pair<>(parser, expression);
}
public static String nb(String expression) {
return new StringBuilder().append(OBFUSCATED_PARSER_ANNOTATION).append(Numba.name()).append(":")
.append(expression).toString();
}
public static String dh(String expression) {
return new StringBuilder().append(OBFUSCATED_PARSER_ANNOTATION).append(Deephaven.name()).append(":")
.append(expression).toString();
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy