Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/PushExpressions.cs @ 14727

Last change on this file since 14727 was 14727, checked in by pkimmesw, 7 years ago

#2665 PushGP HL Integration, Views, Parameters

File size: 1.8 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
2  using HeuristicLab.Problems.ProgramSynthesis.Push.Interpreter;
3  using HeuristicLab.Problems.ProgramSynthesis.Push.Stack;
4
5  public abstract class PushExpression<T> : StatefullExpression<T> {
6
7    protected PushExpression(T state) : base(state) { }
8
9    protected void Eval(IStack<T> stack) {
10      stack.Push(this.State);
11    }
12    public override string StringRepresentation { get { return this.State.ToString(); } }
13  }
14
15  public class IntegerPushExpression : PushExpression<long> {
16    public IntegerPushExpression(long state)
17      : base(state) {
18    }
19
20    public override void Eval(IPushGpInterpreter interpreter) {
21      this.Eval(interpreter.IntegerStack);
22    }
23  }
24
25  public class FloatPushExpression : PushExpression<double> {
26    public FloatPushExpression(double state)
27      : base(state) {
28    }
29
30    public override void Eval(IPushGpInterpreter interpreter) {
31      this.Eval(interpreter.FloatStack);
32    }
33  }
34
35  public class BooleanPushExpression : PushExpression<bool> {
36    public BooleanPushExpression(bool state)
37      : base(state) {
38    }
39
40    public override void Eval(IPushGpInterpreter interpreter) {
41      this.Eval(interpreter.BooleanStack);
42    }
43  }
44
45  public class NamePushExpression : PushExpression<string> {
46    public NamePushExpression(string state)
47      : base(state) {
48    }
49
50    public override void Eval(IPushGpInterpreter interpreter) {
51      this.Eval(interpreter.NameStack);
52    }
53  }
54
55  public class ExecPushExpression : PushExpression<Expression> {
56    public ExecPushExpression(Expression state)
57      : base(state) {
58    }
59
60    public override void Eval(IPushGpInterpreter interpreter) {
61      this.Eval(interpreter.ExecStack);
62    }
63  }
64}
Note: See TracBrowser for help on using the repository browser.