Table of Contents

Class GateInterval

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that allows a single element from the first sequence to pass through every time the specified time interval elapses.

Marble diagram

The gate starts in the open state, and a single element is allowed to pass through from the source sequence. After this first element is emitted, the gate closes and all subsequent elements are dropped from the result sequence. The gate reopens when the specified Interval elapses.

It is possible to specify how long the gate stays open by using the DueTime property. If no value is specified, the gate stays open indefinitely until an element arrives. If a maximum due time is specified, then no elements from the source sequence arriving after the due time elapses will be allowed through until the gate reopens.

public class GateInterval : Combinator
Inheritance
GateInterval
Inherited Members

Properties

DueTime

Gets or sets a value specifying the maximum time the gate stays open.

public TimeSpan? DueTime { get; set; }

Property Value

TimeSpan?

Remarks

If no value is specified, the gate stays open indefinitely until an element arrives. If a maximum due time is specified, however, then if an element from the first sequence arrives after this interval elapses, that element will not be allowed through and will be dropped from the result sequence.

Interval

Gets or sets the period after which a new element from the sequence is allowed to pass through the gate.

public TimeSpan Interval { get; set; }

Property Value

TimeSpan

Methods

Process<TSource>(IObservable<TSource>)

Allows a single element from an observable sequence to pass through every time the specified time interval elapses.

public override IObservable<TSource> Process<TSource>(IObservable<TSource> source)

Parameters

source IObservable<TSource>

The observable sequence to filter.

Returns

IObservable<TSource>

The filtered observable sequence. Every time the specified time interval elapses, the next element from the source sequence will be allowed through.

Type Parameters

TSource

The type of the elements in the source sequence.