UNPKG

@bitcobblers/wod-wiki-library

Version:

A specialized markdown-like workout syntax editor and runtime for defining workouts

55 lines (54 loc) 1.99 kB
import { MetricValue } from '../MetricValue'; import { RuntimeMetric } from '../RuntimeMetric'; import { RuntimeSpan } from '../RuntimeSpan'; import { IRuntimeBlock } from '../IRuntimeBlock'; import { ITimeSpan } from '../ITimeSpan'; /** * Builder class for creating and managing RuntimeSpan objects. * Provides a fluent interface for creating spans with metrics and timespans. */ export declare class ResultSpanBuilder { private spans; private currentSpan; /** * Creates a new RuntimeSpan with the passed in metrics * @param metrics Array of RuntimeMetric objects to add to the span * @returns The builder instance for chaining */ Create(block: IRuntimeBlock, metrics: RuntimeMetric[]): ResultSpanBuilder; /** * Allows a value metric to populate a MetricValue if the current type * metric value is not already on the RuntimeMetric item in the collection * @param value The metric value to inherit * @returns The builder instance for chaining */ Inherit(value: MetricValue): ResultSpanBuilder; /** * Allows a metric value to override all the child RuntimeMetric values * whether they are there or not * @param value The metric value to use for overriding * @returns The builder instance for chaining */ Override(value: MetricValue): ResultSpanBuilder; /** * Creates a start timespan for the current RuntimeSpan * @returns The builder instance for chaining */ Start(): ResultSpanBuilder; /** * Stops the most recent timespan in the current RuntimeSpan * @returns The builder instance for chaining */ Stop(): ResultSpanBuilder; Spans(): ITimeSpan[]; /** * Returns the last ResultSpan in the list * @returns The current RuntimeSpan */ Current(): RuntimeSpan; /** * Returns the complete list of ResultSpans * @returns Array of all RuntimeSpans created by this builder */ Build(): RuntimeSpan[]; }