import { IOperatorConfig, IRunArgs, OccurrenceGeneratorRunResult, Operator, OperatorFnOutput, } from '../occurrence-generator'; export declare class MergeDurationOperatorError extends Error {} /** * An operator function which takes an occurrence stream with * `hasDuration === true` and merges occurrences which have overlapping * start and end times. * * Because it's possible for all the occurrences in the stream to have * overlapping start and end times, you must provide a `maxDuration` * argument that represents the maximum possible duration for a single * occurrence. If this duration is exceeded, a `MergeDurationOperatorError` * will be thrown. * * - For your convenience, you can globally set a default * `MergeDurationOperator#maxDuration` via * `RScheduleConfig.MergeDurationOperator.defaultMaxDuration`. * * Usage example: * * ```typescript * const MILLISECONDS_IN_HOUR = 1000 * 60 * 60; * * const dates = new Dates({ * dates: [ * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 2 }), * new StandardDateAdapter(new Date(2010, 10, 11, 14), { duration: MILLISECONDS_IN_HOUR * 2 }), * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * ], * dateAdpter: StandardDateAdapter, * }).pipe( * mergeDuration({ * maxDuration: MILLISECONDS_IN_HOUR * 24 * }) * ) * * dates.occurrences().toArray() === [ * new StandardDateAdapter(new Date(2010, 10, 10, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * new StandardDateAdapter(new Date(2010, 10, 11, 13), { duration: MILLISECONDS_IN_HOUR * 3 }), * new StandardDateAdapter(new Date(2010, 10, 12, 13), { duration: MILLISECONDS_IN_HOUR * 1 }), * ] * ``` */ export declare function mergeDuration(args: { maxDuration: number; }): OperatorFnOutput; export declare class MergeDurationOperator extends Operator { readonly maxDuration: number; private forwardRun; private reverseRun; constructor( args: { maxDuration: number; }, config: IOperatorConfig, ); /** Not actually used but necessary for IRunnable interface */ set(_: 'timezone', value: string | null): MergeDurationOperator; _run(args?: IRunArgs): OccurrenceGeneratorRunResult; protected calculateIsInfinite(): boolean; protected calculateHasDuration(): boolean; }