/// <summary> /// /// </summary> public IndicatorResults(Indicator indicator, string[] resultSetNames) { _signals = new double[0]; _actualResultSetStartingIndex = 0; foreach (string name in resultSetNames) { IndicatorResultSet set = new IndicatorResultSet(name, new double[0]); _resultSets.Add(set); } _indicator = indicator; }
///<summary> /// This used to handle results. ///</summary> public bool SetResultSetValues(string name, int startIndex, int count, double[] inputResult) { lock (this) { IndicatorResultSet set = GetResultSetByName(name); if (set == null) { //SystemMonitor.Error("SetResultSetValues result set [" + name + "] not found."); Console.WriteLine(" SetResultSetValues result set [" + name + "] not found. "); return(false); } System.Diagnostics.Debug.Assert(ActualResultsLength == startIndex + count || ActualResultsLength == 0, "Result size mismatch."); if (ActualResultsLength == 0) {// First pass - set the Signals array. _signals = new double[startIndex + count]; } // We shall select the larges start index of result set to make sure a signal is placed not sooner, before all result sets are ready. _actualResultSetStartingIndex = Math.Max(_actualResultSetStartingIndex, startIndex + 1); // Get the data from the result it is provided to us. double[] finalResult = new double[startIndex + count]; for (int i = 0; i < startIndex + count; i++) { if (i < startIndex) { finalResult[i] = double.NaN; } else { finalResult[i] = inputResult[i - startIndex]; } } set.SetValues(finalResult); } return(true); }