Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Windows;
|
---|
4 |
|
---|
5 | namespace 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.