-
-
Notifications
You must be signed in to change notification settings - Fork 588
Expand file tree
/
Copy pathLambdaStep.cs
More file actions
31 lines (25 loc) · 795 Bytes
/
LambdaStep.cs
File metadata and controls
31 lines (25 loc) · 795 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
namespace AutoEvo;
using System;
/// <summary>
/// Runs a generic function as a step.
/// Always assumed to be finished on the first call so the func is only called once.
/// Meant for one-off steps. If a similar step is used multiple times it should be made into a class
/// </summary>
public class LambdaStep : IRunStep
{
private readonly Action<RunResults> operation;
public LambdaStep(Action<RunResults> operation)
{
this.operation = operation;
}
public int TotalSteps => 1;
/// <summary>
/// By default lambda steps can't run concurrently
/// </summary>
public bool CanRunConcurrently { get; set; }
public bool RunStep(RunResults results, SimulationCache cache)
{
operation(results);
return true;
}
}