Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/DataSources/OneDimensional/EnumerablePointEnumerator.cs @ 13467

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

#2283 added GUI and charts; fixed MCTS

File size: 999 bytes
Line 
1using System.Collections;
2using System.Windows;
3
4namespace Microsoft.Research.DynamicDataDisplay.DataSources
5{
6    /// <summary>This enumerator enumerates given enumerable object as sequence of points</summary>
7    /// <typeparam name="T">Type parameter of source IEnumerable</typeparam>
8  public sealed class EnumerablePointEnumerator<T> : IPointEnumerator {
9    private readonly EnumerableDataSource<T> dataSource;
10    private readonly IEnumerator enumerator;
11
12    public EnumerablePointEnumerator(EnumerableDataSource<T> dataSource) {
13      this.dataSource = dataSource;
14      enumerator = dataSource.Data.GetEnumerator();
15    }
16
17    public bool MoveNext() {
18      return enumerator.MoveNext();
19    }
20
21    public void GetCurrent(ref Point p) {
22      dataSource.FillPoint((T)enumerator.Current, ref p);
23    }
24
25    public void ApplyMappings(DependencyObject target) {
26      dataSource.ApplyMappings(target, (T)enumerator.Current);
27    }
28
29    public void Dispose() {
30      //enumerator.Reset();
31    }
32  }
33}
Note: See TracBrowser for help on using the repository browser.