Changeset 14513 for branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FlushExpressions.cs
- Timestamp:
- 12/20/16 22:57:11 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.Algorithms.PushGP/HeuristicLab.Algorithms.PushGP/Expressions/FlushExpressions.cs
r14398 r14513 1 using HeuristicLab.Algorithms.PushGP.Interpreter; 2 using HeuristicLab.Algorithms.PushGP.Stack; 1 namespace HeuristicLab.Algorithms.PushGP.Expressions 2 { 3 using HeuristicLab.Algorithms.PushGP.Interpreter; 4 using HeuristicLab.Algorithms.PushGP.Stack; 3 5 4 namespace HeuristicLab.Algorithms.PushGP.Expressions 5 { 6 /// <summary>7 /// Empties the given stack.8 /// </summary>9 /// <typeparam name="T">Stacktype</typeparam>10 public abstract class FlushExpression<T> : StatelessExpression6 /// <summary> 7 /// Empties the given stack. 8 /// </summary> 9 /// <typeparam name="T">Stacktype</typeparam> 10 public abstract class FlushExpression<T> : StatelessExpression 11 { 12 public void Eval(IStack<T> stack) 11 13 { 12 public void Eval(IStack<T> stack) 13 { 14 stack.Clear(); 15 } 14 stack.Clear(); 15 } 16 } 17 18 public class IntegerFlushExpression : FlushExpression<long> 19 { 20 protected override string InitStringRepresentation() 21 { 22 return "INTEGER.FLUSH"; 16 23 } 17 24 18 public class IntegerFlushExpression : FlushExpression<long>25 public override void Eval(IPushGpInterpreter interpreter) 19 26 { 20 protected override string InitStringRepresentation() { return "INTEGER.FLUSH"; } 27 this.Eval(interpreter.IntegerStack); 28 } 29 } 21 30 22 public override void Eval(IInterpreter interpreter) 23 { 24 Eval(interpreter.IntegerStack); 25 } 31 public class FloatFlushExpression : FlushExpression<double> 32 { 33 protected override string InitStringRepresentation() 34 { 35 return "FLOAT.FLUSH"; 26 36 } 27 37 28 public class FloatFlushExpression : FlushExpression<double>38 public override void Eval(IPushGpInterpreter interpreter) 29 39 { 30 protected override string InitStringRepresentation() { return "FLOAT.FLUSH"; } 40 this.Eval(interpreter.FloatStack); 41 } 42 } 31 43 32 public override void Eval(IInterpreter interpreter) 33 { 34 Eval(interpreter.FloatStack); 35 } 44 public class BooleanFlushExpression : FlushExpression<bool> 45 { 46 protected override string InitStringRepresentation() 47 { 48 return "BOOLEAN.FLUSH"; 36 49 } 37 50 38 public class BooleanFlushExpression : FlushExpression<bool>51 public override void Eval(IPushGpInterpreter interpreter) 39 52 { 40 protected override string InitStringRepresentation() { return "BOOLEAN.FLUSH"; } 53 this.Eval(interpreter.BooleanStack); 54 } 55 } 41 56 42 public override void Eval(IInterpreter interpreter) 43 { 44 Eval(interpreter.BooleanStack); 45 } 57 public class NameFlushExpression : FlushExpression<string> 58 { 59 protected override string InitStringRepresentation() 60 { 61 return "NAME.FLUSH"; 46 62 } 47 63 48 public class NameFlushExpression : FlushExpression<string>64 public override void Eval(IPushGpInterpreter interpreter) 49 65 { 50 protected override string InitStringRepresentation() { return "NAME.FLUSH"; } 66 this.Eval(interpreter.NameStack); 67 } 68 } 51 69 52 public override void Eval(IInterpreter interpreter) 53 { 54 Eval(interpreter.NameStack); 55 } 70 public class ExecFlushExpression : FlushExpression<Expression> 71 { 72 protected override string InitStringRepresentation() 73 { 74 return "EXEC.FLUSH"; 56 75 } 57 76 58 public class ExecFlushExpression : FlushExpression<Expression>77 public override void Eval(IPushGpInterpreter interpreter) 59 78 { 60 protected override string InitStringRepresentation() { return "EXEC.FLUSH"; } 79 this.Eval(interpreter.ExecStack); 80 } 81 } 61 82 62 public override void Eval(IInterpreter interpreter) 63 { 64 Eval(interpreter.ExecStack); 65 } 83 public class CodeFlushExpression : FlushExpression<Expression> 84 { 85 protected override string InitStringRepresentation() 86 { 87 return "CODE.FLUSH"; 66 88 } 67 89 68 public class CodeFlushExpression : FlushExpression<Expression>90 public override void Eval(IPushGpInterpreter interpreter) 69 91 { 70 protected override string InitStringRepresentation() { return "CODE.FLUSH"; } 71 72 public override void Eval(IInterpreter interpreter) 73 { 74 Eval(interpreter.CodeStack); 75 } 92 this.Eval(interpreter.CodeStack); 76 93 } 94 } 77 95 }
Note: See TracChangeset
for help on using the changeset viewer.