internal override void ApplyRemapResult(RemapTrendsResult result) { if (result == null) { var empty = new Tuple<DateTime, double>[0]; if (_currentSamplesCallabacks != null) { foreach (var action in _currentSamplesCallabacks.SelectMany(callaback => callaback)) { action(empty); } } if (_pageSamplesCallbacks != null) { foreach (var action in _pageSamplesCallbacks.SelectMany(callback => callback)) { action(empty); } } return; } for (var i = 0; i < result.Samples.Length; i++) { var s = result.Samples[i]; var callbacks = _currentSamplesCallabacks[i]; for (var j = 0; j < callbacks.Length; j++) { var samples = (from item in s let v = item.Item2[j] where v.HasValue select new Tuple<DateTime, double>(item.Item1, v.Value)).ToArray(); callbacks[j](samples); } } for (var i = 0; i < result.Pages.Length; i++) { var s = result.Pages[i]; var callbacks = _pageSamplesCallbacks[i]; for (var j = 0; j < callbacks.Length; j++) { var samples = (from item in s let v = item.Item2[j] where v.HasValue select new Tuple<DateTime, double>(item.Item1, v.Value)).ToArray(); callbacks[j](samples); } } }
private static void ReadTrendsSamples(RemapTrendsParameter parameter, RemapTrendsResult result, ITrendsRunTarget runTarget) { var r = new Tuple<DateTime, double?[]>[parameter.SamplesParameters.Length][]; for (var i = 0; i < parameter.SamplesParameters.Length; i++) { var samplesParameter = parameter.SamplesParameters[i]; r[i] = runTarget.GetSamples( samplesParameter.Item1, samplesParameter.Item2, samplesParameter.Item3, samplesParameter.Item4); } result.Samples = r; }
public RemapTrendsResult[] RemapTrends(RemapTrendsParameter[] parameters) { if (NotValid()) return null; var result = new RemapTrendsResult[parameters.Length]; for (var i = 0; i < parameters.Length; i++) { var parameter = parameters[i]; var trendsRunTarget = _project.TrendsRunTargets[parameter.CategoryId]; var r = new RemapTrendsResult(); ReadTrendsSamples(parameter, r, trendsRunTarget); ReadTrendsPages(parameter, r, trendsRunTarget); r.Notifications = GetNotifications(trendsRunTarget.Reporter.Notifications); result[i] = r; } return result; }
private void ApplyResult(TrendsCategoryAbstract category, RemapTrendsResult result) { _reporter.Report(result.Notifications); category.ApplyRemapResult(result); }
internal abstract void ApplyRemapResult(RemapTrendsResult result);