Class AdjacentValuesInterpolator<TIn, TResult>
Implements an interpolator based on the values adjacent to the interpolation time, i.e. the nearest values before and after the interpolation time.
Inheritance
Inherited Members
Namespace: Microsoft.Psi.Common.Interpolators
Assembly: Microsoft.Psi.dll
Syntax
public class AdjacentValuesInterpolator<TIn, TResult> : ReproducibleInterpolator<TIn, TResult>
Type Parameters
Name | Description |
---|---|
TIn | The type of the messages to interpolate. |
TResult | The type of the output interpolation result. |
Remarks
The interpolator results do not depend on the wall-clock time of the messages arriving on the secondary stream, i.e., they are based on originating times of messages. As a result, the interpolator might introduce an extra delay as it might have to wait for enough messages on the secondary stream to prove that the interpolation result is correct, irrespective of any other messages that might arrive later.
Constructors
View SourceAdjacentValuesInterpolator(Func<TIn, TIn, Double, TResult>, Boolean, TResult, Nullable<TimeSpan>, String)
Initializes a new instance of the AdjacentValuesInterpolator<TIn, TResult> class.
Declaration
public AdjacentValuesInterpolator(Func<TIn, TIn, double, TResult> interpolatorFunc, bool orDefault, TResult defaultValue = null, TimeSpan? maxSpan = null, string name = null)
Parameters
Type | Name | Description |
---|---|---|
Func<TIn, TIn, System.Double, TResult> | interpolatorFunc | A function which produces an interpolation result, given the two nearest values and the ratio between them. |
System.Boolean | orDefault | Indicates whether to output a default value when no result is found. |
TResult | defaultValue | An optional default value to use. |
System.Nullable<TimeSpan> | maxSpan | The maximal timespan between adjacent messages for which interpolation will be run. |
String | name | An optional name for the interpolator (defaults to AdjacentValues). |
Methods
View SourceInterpolate(DateTime, IEnumerable<Message<TIn>>, Nullable<DateTime>)
Interpolates a set of messages at a given time.
Declaration
public override InterpolationResult<TResult> Interpolate(DateTime interpolationTime, IEnumerable<Message<TIn>> messages, DateTime? closedOriginatingTime)
Parameters
Type | Name | Description |
---|---|---|
DateTime | interpolationTime | The time to interpolate. |
IEnumerable<Message<TIn>> | messages | The set of messages from a stream. |
System.Nullable<DateTime> | closedOriginatingTime | An optional date-time that, when present, indicates at what time the stream was closed. |
Returns
Type | Description |
---|---|
InterpolationResult<TResult> | An interpolation result InterpolationResult<T>. |
Overrides
ToString()
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
String |