IInterval Interface

Packages > fluid-framework > IInterval

Basic interval abstraction

This API is provided for existing users, but is not recommended for new users.

To use, import via fluid-framework/legacy.

For more information about our API support guarantees, see here .

Signature

export interface IInterval

Methods

Method Alerts Return Type Description
clone() Alpha IInterval
compare(b) Alpha number Compares this interval to b with standard comparator semantics: - returns -1 if this is less than b - returns 1 if this is greater than b - returns 0 if this is equivalent to b
compareEnd(b) Alpha number Compares the end endpoint of this interval to b's end endpoint. Standard comparator semantics apply.
compareStart(b) Alpha number Compares the start endpoint of this interval to b's start endpoint. Standard comparator semantics apply.
modify(label, start, end, op, localSeq, useNewSlidingBehavior) Alpha IInterval | undefined Modifies one or more of the endpoints of this interval, returning a new interval representing the result.
overlaps(b) Alpha boolean
union(b) Alpha IInterval Unions this interval with b, returning a new interval. The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes intermediate values between the two intervals.

Method Details

clone

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

clone(): IInterval;

Returns

a new interval object with identical semantics.

Return type: IInterval

compare

Compares this interval to b with standard comparator semantics: - returns -1 if this is less than b - returns 1 if this is greater than b - returns 0 if this is equivalent to b

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

compare(b: IInterval): number;

Parameters

Parameter Type Description
b IInterval Interval to compare against

Returns

Return type: number

compareEnd

Compares the end endpoint of this interval to b’s end endpoint. Standard comparator semantics apply.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

compareEnd(b: IInterval): number;

Parameters

Parameter Type Description
b IInterval Interval to compare against

Returns

Return type: number

compareStart

Compares the start endpoint of this interval to b’s start endpoint. Standard comparator semantics apply.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

compareStart(b: IInterval): number;

Parameters

Parameter Type Description
b IInterval Interval to compare against

Returns

Return type: number

modify

Modifies one or more of the endpoints of this interval, returning a new interval representing the result.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

modify(label: string, start: SequencePlace | undefined, end: SequencePlace | undefined, op?: ISequencedDocumentMessage, localSeq?: number, useNewSlidingBehavior?: boolean): IInterval | undefined;

Parameters

Parameter Modifiers Type Description
label string
start SequencePlace | undefined
end SequencePlace | undefined
op optional ISequencedDocumentMessage
localSeq optional number
useNewSlidingBehavior optional boolean

Returns

Return type: IInterval | undefined

overlaps

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

overlaps(b: IInterval): boolean;

Parameters

Parameter Type Description
b IInterval

Returns

whether this interval overlaps with b. Intervals are considered to overlap if their intersection is non-empty.

Return type: boolean

union

Unions this interval with b, returning a new interval. The union operates as a convex hull, i.e. if the two intervals are disjoint, the return value includes intermediate values between the two intervals.

This API is provided as an alpha preview and may change without notice.

To use, import via fluid-framework/alpha.

For more information about our API support guarantees, see here .

Signature

union(b: IInterval): IInterval;

Parameters

Parameter Type Description
b IInterval

Returns

Return type: IInterval