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:
627 bytes
|
Rev | Line | |
---|
[14320] | 1 | using HeuristicLab.Algorithms.PushGP.Stack;
|
---|
| 2 |
|
---|
| 3 | namespace HeuristicLab.Algorithms.PushGP.Expressions
|
---|
| 4 | {
|
---|
| 5 | public class CodePushExpression : Expression
|
---|
| 6 | {
|
---|
| 7 | public CodePushExpression(Expression value) : base(OpCode.CodePush)
|
---|
| 8 | {
|
---|
| 9 | this.Value = value;
|
---|
| 10 | }
|
---|
| 11 |
|
---|
| 12 | public Expression Value { get; }
|
---|
| 13 |
|
---|
| 14 | public override void Eval(IInterpreterService interpreterService)
|
---|
| 15 | {
|
---|
| 16 | interpreterService.CodeStack.Push(Value);
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | public override string ToString()
|
---|
| 20 | {
|
---|
| 21 | return $"{base.ToString()}({this.Value})";
|
---|
| 22 | }
|
---|
| 23 | }
|
---|
| 24 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.