Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/FlushExpressions.cs @ 14733

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

#2665 Storable problem data, Renamings due to typos, Removed GP from class names

File size: 1.8 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
2  using HeuristicLab.Problems.ProgramSynthesis.Push.Attributes;
3
4  using Interpreter;
5  using Stack;
6
7  /// <summary>
8  ///     Empties the given stack.
9  /// </summary>
10  /// <typeparam name="T">Stacktype</typeparam>
11  public abstract class FlushExpression<T> : StatelessExpression {
12    public void Eval(IStack<T> stack) {
13      stack.Clear();
14    }
15  }
16
17  [PushExpression(StackType.Integer, "INTEGER.FLUSH")]
18  public class IntegerFlushExpression : FlushExpression<long> {
19    public override void Eval(IPushInterpreter interpreter) {
20      Eval(interpreter.IntegerStack);
21    }
22  }
23
24  [PushExpression(StackType.Float, "FLOAT.FLUSH")]
25  public class FloatFlushExpression : FlushExpression<double> {
26    public override void Eval(IPushInterpreter interpreter) {
27      Eval(interpreter.FloatStack);
28    }
29  }
30
31  [PushExpression(StackType.Boolean, "BOOLEAN.FLUSH")]
32  public class BooleanFlushExpression : FlushExpression<bool> {
33    public override void Eval(IPushInterpreter interpreter) {
34      Eval(interpreter.BooleanStack);
35    }
36  }
37
38  [PushExpression(StackType.Name, "NAME.FLUSH")]
39  public class NameFlushExpression : FlushExpression<string> {
40    public override void Eval(IPushInterpreter interpreter) {
41      Eval(interpreter.NameStack);
42    }
43  }
44
45  [PushExpression(StackType.Exec, "EXEC.FLUSH")]
46  public class ExecFlushExpression : FlushExpression<Expression> {
47    public override void Eval(IPushInterpreter interpreter) {
48      Eval(interpreter.ExecStack);
49    }
50  }
51
52  [PushExpression(StackType.Code, "CODE.FLUSH")]
53  public class CodeFlushExpression : FlushExpression<Expression> {
54    public override void Eval(IPushInterpreter interpreter) {
55      Eval(interpreter.CodeStack);
56    }
57  }
58}
Note: See TracBrowser for help on using the repository browser.