ITimeSeries.IsEmpty

Fore Syntax

IsEmpty: Boolean;

Fore.NET Syntax

IsEmpty: boolean;

Description

The IsEmpty property returns whether a series is empty.

Comments

Available values:

Fore Example

Custom series calculation method is given in the example.

Add links to the MathFin, Ms, Transform system assemblies.

Function IsEmpty(Input: ITimeSeries): ITimeSeries;
Var
    TsCalc: TsCalculation;
    pContext: ITsCalculationContext;
    i: Integer;
    Output: ITimeSeries;
Begin
    // Check if an input series is empty
    If Not Input.IsEmpty
        // If series is not empty, calculate its base-10 logarithm
        Then
        TsCalc := New TsCalculation.Create;
            pContext := TsCalc.Current;
            Output := pContext.CreateTimeSeries;
            For i := Input.StartIndex To Input.EndIndex Do
                Output(i) := Math.Log10(Input(i));
            End For;
            // Return calculation results
            Return Output;
        // If series  is empty, return it without changes 
        Else
            Return Input;
    End If;
End Function IsEmpty;

The method calculates base-10 logarithm if series contains data.

Fore.NET Example

The requirements and result of the Fore.NET example execution match with those in the Fore example.

Imports Prognoz.Platform.Interop.Dimensions;
Imports Prognoz.Platform.Interop.MathFin;
Imports Prognoz.Platform.Interop.Ms;
Imports Prognoz.Platform.Interop.Transform;

Public Shared Function IsEmpty(Input: ITimeSeries): ITimeSeries;
Var
    TsCalc: TsCalculation;
    pContext: ITsCalculationContext;
    i: Integer;
    Output: ITimeSeries;
    Math: MathClass = New MathClass();
Begin
    // Check if an input series is empty
    If Not Input.IsEmpty
        // If series is not empty, calculate its base-10 logarithm
        Then
        TsCalc := New TsCalculation.Create();
            pContext := TsCalc.Current[Null];
            Output := pContext.CreateTimeSeries(DimCalendarLevel.dclNone, NullAs ITimeSeries;
            For i := Input.StartIndex To Input.EndIndex Do
                Output[i] := Math.Log10(Input[i] As double);
            End For;
            // Return calculation results
            Return Output;
        // If series  is empty, return it without changes 
        Else
            Return Input;
    End If;
End Function IsEmpty;

See also:

ITimeSeries