import { isComparable } from '../utils';
export var DFSOperation;
(function (DFSOperation) {
    DFSOperation[DFSOperation["VISIT"] = 0] = "VISIT";
    DFSOperation[DFSOperation["PROCESS"] = 1] = "PROCESS";
})(DFSOperation || (DFSOperation = {}));
export class Range {
    low;
    high;
    includeLow;
    includeHigh;
    constructor(low, high, includeLow = true, includeHigh = true) {
        this.low = low;
        this.high = high;
        this.includeLow = includeLow;
        this.includeHigh = includeHigh;
        if (!(isComparable(low) && isComparable(high)))
            throw new RangeError('low or high is not comparable');
        if (low > high)
            throw new RangeError('low must be less than or equal to high');
    }
    // Determine whether a key is within the range
    isInRange(key, comparator) {
        const lowCheck = this.includeLow ? comparator(key, this.low) >= 0 : comparator(key, this.low) > 0;
        const highCheck = this.includeHigh ? comparator(key, this.high) <= 0 : comparator(key, this.high) < 0;
        return lowCheck && highCheck;
    }
}
//# sourceMappingURL=index.js.map