Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/Auxiliary/ListGenerator.cs @ 13792

Last change on this file since 13792 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 716 bytes
Line 
1using System;
2using System.Collections.Generic;
3using System.Windows;
4
5namespace Microsoft.Research.DynamicDataDisplay
6{
7  public static class ListGenerator {
8    public static IEnumerable<Point> GeneratePoints(int length, Func<int, Point> generator) {
9      for (int i = 0; i < length; i++) {
10        yield return generator(i);
11      }
12    }
13
14    public static IEnumerable<Point> GeneratePoints(int length, Func<int, double> x, Func<int, double> y) {
15      for (int i = 0; i < length; i++) {
16        yield return new Point(x(i), y(i));
17      }
18    }
19
20    public static IEnumerable<T> Generate<T>(int length, Func<int, T> generator) {
21      for (int i = 0; i < length; i++) {
22        yield return generator(i);
23      }
24    }
25  }
26}
Note: See TracBrowser for help on using the repository browser.