import { BinaryOp } from "../../expression";
import { NumericRangePattern, NumericAggregationPattern, EmptyPattern, NeverPattern } from "./pattern";
/**
 * Join two numeric ranges together to represent values in both ranges.
 * Throw an error if the range could not match a single value.
 * x > 10 && x > 5 => x > 10
 * x >= 10 && x > 9 => x >= 10
 * x > 10 && x >= 10 => x > 10
 */
export declare const intersectNumericRange: (pattern1: NumericRangePattern | NeverPattern, pattern2: NumericRangePattern | NeverPattern, allowZeroRange?: boolean) => NumericRangePattern | NeverPattern;
/**
 * If the ranges overlap, return the union of them.
 * If the range are mutually exclusive, return an aggregate with two ranges.
 *
 * [10, 20] [15, 30] => [10, 30]
 * [10, 20] [21, 30] => [10, 20] [21, 30]
 * [10, 20] [20, 30] => [10, 30]
 * [10, 20) (20, 30] => [10, 20) (20, 30]
 */
export declare const unionNumericRange: (pattern1: NumericRangePattern, pattern2: NumericRangePattern) => NumericAggregationPattern | NumericRangePattern;
export declare const isOverlappngRange: (pattern1: NumericRangePattern, pattern2: NumericRangePattern) => boolean;
/**
 * In a valid range, the lower is before the upper.
 *
 * [10, 5] => invalid
 * [5, 10] => valid
 * [10, 10) => invalid
 * [10, 10] => valid
 */
export declare const validateNumericRange: (range: NumericRangePattern) => boolean;
/**
 * Runs {@link reduceNumericRanges} and then checks to see if the outcome is
 * empty, singular, or still an aggregate.
 */
export declare const reduceNumericAggregate: (pattern: NumericAggregationPattern) => EmptyPattern | NumericRangePattern | NumericAggregationPattern;
/**
 * Given one to many ranges, collapse them all to the least number of ranges when one or more overlap.
 * This operation may take multiple iterations to find all overlappting ranges.
 *
 * TODO: this can probably be simplified to a single iteration by ordering the ranges, the performance impact will be minimal.
 *
 * one or more ranges merge with multiple other ranges
 * [1, 10], [11, 20], [8, 12]
 * [1, 10], [11, 20]
 * [1, 12], [8, 20]
 * [1, 20]
 *
 * one or more ranges merge with one other range
 * [1, 10], [11, 20], [12, 21]
 * [1, 10], [11, 20]
 * [1, 10], [11, 21]
 *
 * one or more ranges merge with multiple other range early
 * [8, 12], [1, 10], [11, 20]
 * [1, 12]
 * [1, 20]
 *
 * no ranges merge
 * [1, 10], [11, 20], [21, 22]
 * [1, 10], [11, 20], [21, 22]
 */
export declare const reduceNumericRanges: (ranges: NumericRangePattern[]) => NumericRangePattern[];
/**
 * Invert numeric ranges!
 *
 * [10, 20] => [neg_inf, 10), (20, inf]
 * (10, 20) => [neg_inf, 10], [20, inf]
 * (10, inf] => [neg_inf, 10]
 * [neg_inf, 20] => (20, inf]
 */
export declare const negateNumericRange: (pattern: NumericRangePattern) => NumericRangePattern;
/**
 * Intersect multiple numeric ranges.
 * 1. attempt to intersect each numeric ranges.
 * 2. validate each result
 * 3. filter invalid result.
 * 4. Fail if no results are valid.
 *
 * [10, 20] AND ( [5, 15] OR [25, 30] ) => [10, 15]
 * [10, 20] AND ( [25, 30] OR [35, 40] ) => INVALID (cannot AND either range on the other side)
 * ([10, 20] OR [30, 40]) AND ( [5, 15] OR [25, 30] ) => [10,15] OR 30
 * ([10, 20] OR [30, 40]) AND ( [5, 15] OR [25, 30) ) => INVALID
 */
export declare const intersectNumericAggregation: (aggregation1: NumericAggregationPattern, aggregation2: NumericAggregationPattern) => NumericAggregationPattern | NumericRangePattern | EmptyPattern | NeverPattern;
/**
 * Apply intersection logic between a single range and set of aggregate ranges (OR logic).
 */
export declare const intersectNumericAggregationWithRange: (aggregation: NumericAggregationPattern, range: NumericRangePattern) => NumericAggregationPattern | NumericRangePattern | EmptyPattern | NeverPattern;
/**
 * Creates a single numeric range entry with only one limit (lower or upper) set.
 */
export declare const createSingleNumericRange: (value: number, op: BinaryOp) => NumericRangePattern | undefined;
export declare const deploymentOnlyModule = true;
//# sourceMappingURL=numeric.d.ts.map