Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/Exec/ExecYExpression.cs @ 14328

Last change on this file since 14328 was 14328, checked in by pkimmesw, 8 years ago

#2665 Set .NET version to 4.5, C# version to 5.0, Added expression templates and factory

File size: 836 bytes
Line 
1using HeuristicLab.Algorithms.PushGP.Interpreter;
2
3namespace HeuristicLab.Algorithms.PushGP.Expressions.Exec
4{
5    public class ExecYExpression : Expression
6    {
7        public override bool IsCodeOp { get { return false; } }
8
9        public override void Eval(IInterpreter interpreter)
10        {
11            // not enough arguments on stack
12            if (interpreter.ExecStack.Count == 0)
13                return;
14
15            var expandExpression = new ExecExpandExpression(new[]
16            {
17                interpreter.ExecStack.Top,
18                new ExecYExpression()
19            });
20
21            interpreter.ExecStack.Insert(interpreter.ExecStack.Count - 1, expandExpression);
22        }
23
24        public override string ToString()
25        {
26            return Symbols.ExecY;
27        }
28    }
29}
Note: See TracBrowser for help on using the repository browser.