Last change
on this file since 14320 was
14320,
checked in by pkimmesw, 8 years ago
|
#2665 Added Interpreter, Parser, 16 Examples, Expressions needed for the examples
|
File size:
795 bytes
|
Line | |
---|
1 | using System.Linq;
|
---|
2 | using HeuristicLab.Algorithms.PushGP.Stack;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Algorithms.PushGP.Expressions
|
---|
5 | {
|
---|
6 | public class ExecExpandExpression : Expression
|
---|
7 | {
|
---|
8 | public ExecExpandExpression(Expression[] expressions) : base(OpCode.ExecExpand)
|
---|
9 | {
|
---|
10 | this.Expressions = expressions;
|
---|
11 | }
|
---|
12 |
|
---|
13 | public Expression[] Expressions { get; }
|
---|
14 |
|
---|
15 | public override void Eval(IInterpreterService interpreterService)
|
---|
16 | {
|
---|
17 | foreach (var expression in this.Expressions)
|
---|
18 | {
|
---|
19 | interpreterService.ExecStack.Add(expression);
|
---|
20 | }
|
---|
21 | }
|
---|
22 |
|
---|
23 | public override string ToString()
|
---|
24 | {
|
---|
25 | return $"({string.Join(", ", this.Expressions.Reverse())})";
|
---|
26 | }
|
---|
27 | }
|
---|
28 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.