Skip to content

Commit 2761594

Browse files
Andrei Bozantandandanlen
andauthored
Update src/explorer.api/Extensions/ValueCounts.cs
applied review suggestions: abstracting AccumulateCounts into a class method for clarity and renamed it to AccumulateRow Co-Authored-By: dandanlen <3168260+dandanlen@users.noreply.github.com>
1 parent f3341fa commit 2761594

1 file changed

Lines changed: 12 additions & 7 deletions

File tree

src/explorer.api/Extensions/ValueCounts.cs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,22 @@ public static ValueCounts Compute<T>(IEnumerable<T> rows)
3030
return rows.Aggregate(new ValueCounts(), AccumulateCounts);
3131
}
3232

33-
private static ValueCounts AccumulateCounts<T>(ValueCounts vc, T row)
33+
private static ValueCounts AccumulateRow<T>(ValueCounts vc, T row)
3434
where T : ICountAggregate, ISuppressible
3535
{
36-
vc.TotalCount += row.Count;
37-
vc.TotalRows++;
36+
vc.AccumulateRow<T>(ValueCounts vc, T row);
37+
return vc;
38+
}
39+
40+
public void AccumulateRow<T>(T row)
41+
{
42+
TotalCount += row.Count;
43+
TotalRows++;
3844
if (row.IsSuppressed)
3945
{
40-
vc.SuppressedCount += row.Count;
41-
vc.SuppressedRows++;
46+
SuppressedCount += row.Count;
47+
SuppressedRows++;
4248
}
43-
return vc;
4449
}
4550
}
46-
}
51+
}

0 commit comments

Comments
 (0)