Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DistinctEnumerator.cs
1using System;
2using System.Collections;
3using System.Collections.Generic;
4using System.Threading.Tasks;
6
8{
13 {
14 private readonly Dictionary<Record, bool> reported = new Dictionary<Record, bool>();
15
23 : base(ItemEnumerator, Columns, Variables)
24 {
25 }
26
30 public override bool MoveNext()
31 {
32 while (base.MoveNext())
33 {
34 Record Rec = new Record(this.CurrentRecord);
35 if (!this.reported.ContainsKey(Rec))
36 {
37 this.reported[Rec] = true;
38 return true;
39 }
40 }
41
42 return false;
43 }
44
51 public override async Task<bool> MoveNextAsync()
52 {
53 while (await base.MoveNextAsync())
54 {
55 Record Rec = new Record(this.CurrentRecord);
56 if (!this.reported.ContainsKey(Rec))
57 {
58 this.reported[Rec] = true;
59 return true;
60 }
61 }
62
63 return false;
64 }
65
69 public override void Reset()
70 {
71 base.Reset();
72 this.reported.Clear();
73 }
74
75 }
76}
Base class for all nodes in a parsed script tree.
Definition: ScriptNode.cs:69
Enumerator that limits the return set to a maximum number of records.
DistinctEnumerator(IResultSetEnumerator ItemEnumerator, ScriptNode[] Columns, Variables Variables)
Enumerator that limits the return set to a maximum number of records.
override async Task< bool > MoveNextAsync()
Advances the enumerator to the next element of the collection.
Enumerator that limits the return set to a maximum number of records.
Represents one record.
Definition: Record.cs:9
Collection of variables.
Definition: Variables.cs:25