Changeset 14777 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoRangeExpressions.cs
- Timestamp:
- 03/23/17 01:11:18 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoRangeExpressions.cs
r14744 r14777 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions { 2 using System; 3 2 4 using Attributes; 3 5 using Interpreter; 4 6 using Stack; 5 7 8 [Serializable] 6 9 public abstract class DoRangeExpression : LoopExpression { 7 10 protected DoRangeExpression() { } … … 17 20 var incrementor = destinationIndex < interpreter.IntegerStack.Top ? -1 : 1; 18 21 19 return new LoopState(22 return LoopState.Create(interpreter.PoolContainer.LoopStatePool, 20 23 body: sourceStack.Pop(), 21 24 currentIndex: interpreter.IntegerStack.Top + incrementor, … … 47 50 /// that is less than the specified current index. 48 51 /// </summary> 49 [PushExpression(StackType.Code, "CODE.DO*RANGE")] 52 [Serializable] 53 [PushExpression(StackTypes.Code, "CODE.DO*RANGE", StackTypes.Integer)] 50 54 public class CodeDoRangeExpression : DoRangeExpression { 51 55 public CodeDoRangeExpression() { } … … 56 60 } 57 61 58 protected override LoopExpression Clone(LoopState state) { 59 return new CodeDoRangeExpression(state); 62 protected override LoopExpression Clone(LoopState state, IPushInterpreter interpreter) { 63 var expression = interpreter.PoolContainer.GetStatefulExpression<CodeDoRangeExpression>(); 64 expression.State = state; 65 66 return expression; 60 67 } 61 68 } … … 85 92 /// index that is less than the specified current index. 86 93 /// </summary> 87 [PushExpression(StackType.Exec, "EXEC.DO*RANGE")] 94 [Serializable] 95 [PushExpression(StackTypes.Exec, "EXEC.DO*RANGE", StackTypes.Integer)] 88 96 public class ExecDoRangeExpression : DoRangeExpression { 89 97 public ExecDoRangeExpression() { } … … 93 101 return this.Eval(interpreter, interpreter.ExecStack); 94 102 } 95 protected override LoopExpression Clone(LoopState state) { 96 return new ExecDoRangeExpression(state); 103 protected override LoopExpression Clone(LoopState state, IPushInterpreter interpreter) { 104 var expression = interpreter.PoolContainer.GetStatefulExpression<ExecDoRangeExpression>(); 105 expression.State = state; 106 107 return expression; 97 108 } 98 109 }
Note: See TracChangeset
for help on using the changeset viewer.