Changeset 14952 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoRangeExpressions.cs
- Timestamp:
- 05/10/17 11:23:05 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/DoRangeExpressions.cs
r14908 r14952 3 3 4 4 using Attributes; 5 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 7 5 8 using Interpreter; 6 9 using Stack; 7 10 8 11 [Serializable] 12 [StorableClass] 9 13 public abstract class DoRangeExpression : LoopExpression { 10 14 protected DoRangeExpression() { } 11 15 protected DoRangeExpression(LoopState state) : base(state) { } 16 [StorableConstructor] 17 protected DoRangeExpression(bool deserializing) : base(deserializing) { } 18 12 19 protected override bool HasInsufficientArguments(IInternalPushInterpreter interpreter, IPushStack<Expression> sourceStack) { 13 20 return interpreter.IntegerStack.Count < 2 || … … 51 58 /// </summary> 52 59 [Serializable] 60 [StorableClass] 53 61 [PushExpression(StackTypes.Code, "CODE.DO*RANGE", StackTypes.Integer)] 54 62 public class CodeDoRangeExpression : DoRangeExpression { 55 63 public CodeDoRangeExpression() { } 64 public CodeDoRangeExpression(LoopState state) : base(state) { } 65 [StorableConstructor] 66 protected CodeDoRangeExpression(bool deserializing) : base(deserializing) { } 56 67 57 public CodeDoRangeExpression(LoopState state) : base(state) { } 58 public override bool Eval(IInternalPushInterpreter interpreter) { 59 return Eval(interpreter, interpreter.CodeStack); 68 public override bool IsNoop(IInternalPushInterpreter interpreter) { 69 return State.Body == null && HasInsufficientArguments(interpreter, interpreter.CodeStack); 70 } 71 72 public override void Eval(IInternalPushInterpreter interpreter) { 73 Eval(interpreter, interpreter.CodeStack); 60 74 } 61 75 … … 93 107 /// </summary> 94 108 [Serializable] 109 [StorableClass] 95 110 [PushExpression(StackTypes.Exec, "EXEC.DO*RANGE", StackTypes.Integer)] 96 111 public class ExecDoRangeExpression : DoRangeExpression { … … 98 113 99 114 public ExecDoRangeExpression(LoopState state) : base(state) { } 100 public override bool Eval(IInternalPushInterpreter interpreter) { 101 return Eval(interpreter, interpreter.ExecStack); 115 [StorableConstructor] 116 protected ExecDoRangeExpression(bool deserializing) : base(deserializing) { } 117 118 public override bool IsNoop(IInternalPushInterpreter interpreter) { 119 return State.Body == null && HasInsufficientArguments(interpreter, interpreter.ExecStack); 120 } 121 122 public override void Eval(IInternalPushInterpreter interpreter) { 123 Eval(interpreter, interpreter.ExecStack); 102 124 } 103 125 protected override LoopExpression Clone(LoopState state, IInternalPushInterpreter interpreter) {
Note: See TracChangeset
for help on using the changeset viewer.