-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubstitutionFunc.cs
54 lines (37 loc) · 993 Bytes
/
SubstitutionFunc.cs
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using System;
using System.Collections.Generic;
using System.Linq;
namespace smn
{
public class SubstitutionFunc : PartRecBase
{
List<PartRecBase> cn;
PartRecBase b;
public SubstitutionFunc(PartRecBase b, List<PartRecBase> cn)
{
//<4,n,b,c1...ck>
//additionalIndexParameter
this.index = 4;
this.cn = cn;
this.b = b;
}
#region implemented abstract members of PartRecBase
public override int Execute (System.Collections.Generic.List<int> parameters)
{
var qn = new List<int> ();
foreach (PartRecBase c in cn) {
//execute all c's on the parameters
qn.Add (c.Execute (parameters));
}
//execute b with qn as parameter
return b.Execute (qn);
}
#endregion
public override string ToString()
{
var simFunctionsString = String.Join (",", cn.Select (x => x.ToString ()));
var indexString = string.Format ("<{0},{1},{2},{3}>",index, numParams, this.b.ToString(), simFunctionsString);
return indexString;
}
}
}