1 | using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; |
---|
2 | |
---|
3 | namespace HeuristicLab.Problems.ProgramSynthesis { |
---|
4 | /// <summary>
|
---|
5 | /// InExpression has a state, but this state is static at compile time and therefore InExpression can be seen as stateless at runtime
|
---|
6 | /// </summary>
|
---|
7 | [StorableClass]
|
---|
8 | public abstract class InExpression : StatelessExpression {
|
---|
9 | private readonly int index;
|
---|
10 |
|
---|
11 | protected InExpression(int nr) {
|
---|
12 | index = nr - 1;
|
---|
13 | }
|
---|
14 |
|
---|
15 | [StorableConstructor]
|
---|
16 | protected InExpression(bool deserializing) : base(deserializing) { }
|
---|
17 |
|
---|
18 | public override bool IsNoop(IInternalPushInterpreter interpreter) {
|
---|
19 | var expression = interpreter.InputExpressions[index];
|
---|
20 |
|
---|
21 | return expression.IsNoop(interpreter);
|
---|
22 | }
|
---|
23 |
|
---|
24 | public override void Eval(IInternalPushInterpreter interpreter) {
|
---|
25 | var expression = interpreter.InputExpressions[index];
|
---|
26 |
|
---|
27 | expression.Eval(interpreter);
|
---|
28 | }
|
---|
29 | }
|
---|
30 |
|
---|
31 | [PushExpression(
|
---|
32 | StackTypes.None,
|
---|
33 | "IN1",
|
---|
34 | "Pushes first input parameter.",
|
---|
35 | isHidden: true,
|
---|
36 | inExpressionNr: 1)]
|
---|
37 | [StorableClass]
|
---|
38 | public class In1Expression : InExpression {
|
---|
39 | public In1Expression() : base(1) { }
|
---|
40 |
|
---|
41 | [StorableConstructor]
|
---|
42 | protected In1Expression(bool deserializing) : base(deserializing) { }
|
---|
43 | }
|
---|
44 |
|
---|
45 | [PushExpression(
|
---|
46 | StackTypes.None,
|
---|
47 | "IN2",
|
---|
48 | "Pushes second input parameter.",
|
---|
49 | isHidden: true,
|
---|
50 | inExpressionNr: 2)]
|
---|
51 | [StorableClass]
|
---|
52 | public class In2Expression : InExpression {
|
---|
53 | public In2Expression() : base(2) { }
|
---|
54 |
|
---|
55 | [StorableConstructor]
|
---|
56 | protected In2Expression(bool deserializing) : base(deserializing) { }
|
---|
57 | }
|
---|
58 |
|
---|
59 | [PushExpression(
|
---|
60 | StackTypes.None,
|
---|
61 | "IN3",
|
---|
62 | "Pushes third input parameter.",
|
---|
63 | isHidden: true,
|
---|
64 | inExpressionNr: 3)]
|
---|
65 | [StorableClass]
|
---|
66 | public class In3Expression : InExpression {
|
---|
67 | public In3Expression() : base(3) { }
|
---|
68 |
|
---|
69 | [StorableConstructor]
|
---|
70 | protected In3Expression(bool deserializing) : base(deserializing) { }
|
---|
71 | }
|
---|
72 |
|
---|
73 | [PushExpression(
|
---|
74 | StackTypes.None,
|
---|
75 | "IN4",
|
---|
76 | "Pushes fourth input parameter.",
|
---|
77 | isHidden: true,
|
---|
78 | inExpressionNr: 4)]
|
---|
79 | [StorableClass]
|
---|
80 | public class In4Expression : InExpression {
|
---|
81 | public In4Expression() : base(4) { }
|
---|
82 |
|
---|
83 | [StorableConstructor]
|
---|
84 | protected In4Expression(bool deserializing) : base(deserializing) { }
|
---|
85 | }
|
---|
86 |
|
---|
87 | [PushExpression(
|
---|
88 | StackTypes.None,
|
---|
89 | "IN5",
|
---|
90 | "Pushes fifth input parameter.",
|
---|
91 | isHidden: true,
|
---|
92 | inExpressionNr: 5)]
|
---|
93 | [StorableClass]
|
---|
94 | public class In5Expression : InExpression {
|
---|
95 | public In5Expression() : base(5) { }
|
---|
96 |
|
---|
97 | [StorableConstructor]
|
---|
98 | protected In5Expression(bool deserializing) : base(deserializing) { }
|
---|
99 | }
|
---|
100 |
|
---|
101 | [PushExpression(
|
---|
102 | StackTypes.None,
|
---|
103 | "IN6",
|
---|
104 | "Pushes sixth input parameter.",
|
---|
105 | isHidden: true,
|
---|
106 | inExpressionNr: 6)]
|
---|
107 | [StorableClass]
|
---|
108 | public class In6Expression : InExpression {
|
---|
109 | public In6Expression() : base(6) { }
|
---|
110 |
|
---|
111 | [StorableConstructor]
|
---|
112 | protected In6Expression(bool deserializing) : base(deserializing) { }
|
---|
113 | }
|
---|
114 |
|
---|
115 | [PushExpression(
|
---|
116 | StackTypes.None,
|
---|
117 | "IN7",
|
---|
118 | "Pushes seventh input parameter.",
|
---|
119 | isHidden: true,
|
---|
120 | inExpressionNr: 7)]
|
---|
121 | [StorableClass]
|
---|
122 | public class In7Expression : InExpression {
|
---|
123 | public In7Expression() : base(7) { }
|
---|
124 |
|
---|
125 | [StorableConstructor]
|
---|
126 | protected In7Expression(bool deserializing) : base(deserializing) { }
|
---|
127 | }
|
---|
128 |
|
---|
129 | [PushExpression(
|
---|
130 | StackTypes.None,
|
---|
131 | "IN8",
|
---|
132 | "Pushes eighth input parameter.",
|
---|
133 | isHidden: true,
|
---|
134 | inExpressionNr: 8)]
|
---|
135 | [StorableClass]
|
---|
136 | public class In8Expression : InExpression {
|
---|
137 | public In8Expression() : base(8) { }
|
---|
138 |
|
---|
139 | [StorableConstructor]
|
---|
140 | protected In8Expression(bool deserializing) : base(deserializing) { }
|
---|
141 | }
|
---|
142 |
|
---|
143 | [PushExpression(
|
---|
144 | StackTypes.None,
|
---|
145 | "IN9",
|
---|
146 | "Pushes nineth input parameter.",
|
---|
147 | isHidden: true,
|
---|
148 | inExpressionNr: 9)]
|
---|
149 | [StorableClass]
|
---|
150 | public class In9Expression : InExpression {
|
---|
151 | public In9Expression() : base(9) { }
|
---|
152 |
|
---|
153 | [StorableConstructor]
|
---|
154 | protected In9Expression(bool deserializing) : base(deserializing) { }
|
---|
155 | }
|
---|
156 |
|
---|
157 | [PushExpression(
|
---|
158 | StackTypes.None,
|
---|
159 | "IN10",
|
---|
160 | "Pushes tenth input parameter.",
|
---|
161 | isHidden: true,
|
---|
162 | inExpressionNr: 10)]
|
---|
163 | [StorableClass]
|
---|
164 | public class In10Expression : InExpression {
|
---|
165 | public In10Expression() : base(10) { }
|
---|
166 |
|
---|
167 | [StorableConstructor]
|
---|
168 | protected In10Expression(bool deserializing) : base(deserializing) { }
|
---|
169 | }
|
---|
170 | }
|
---|