-
Notifications
You must be signed in to change notification settings - Fork 0
/
PartRecAdd.cs
45 lines (36 loc) · 877 Bytes
/
PartRecAdd.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
using System;
using System.Collections.Generic;
namespace smn
{
public class PartRecAdd: PartRecBase
{
public PartRecAdd ()
{
this.numParams = 2;
this.index = 99;
}
#region implemented abstract members of PartRecBase
public override int Execute (List<int> parameters)
{
if (parameters [0] == 0) {
var projection = PartRecFactory.GetFunction (1, 1, 1);
return projection.Execute(new List<int>(){parameters [1]}); //return projection of x to x
} else {
var successor = PartRecFactory.GetFunction(2,1,1);
var projection = PartRecFactory.GetFunction (1, 3, 1);
return successor.Execute (
new List<int> () {
projection.Execute(
new List<int> () {
Execute(new List<int>(){parameters[0]-1, parameters[1]}),
parameters[1],
parameters[0]-1
}
)
}
);
}
}
#endregion
}
}