Changeset 14908 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/LoopExpression.cs
- Timestamp:
- 05/02/17 22:03:01 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/LoopExpression.cs
r14834 r14908 46 46 var hash = 19; 47 47 48 if ( this.Body != null)49 hash = hash * 31 + this.Body.GetHashCode();48 if (Body != null) 49 hash = hash * 31 + Body.GetHashCode(); 50 50 51 hash = hash * 31 + this.CurrentIndex.GetHashCode();52 hash = hash * 31 + this.DestinationIndex.GetHashCode();53 hash = hash * 31 + this.Incrementor.GetHashCode();51 hash = hash * 31 + CurrentIndex.GetHashCode(); 52 hash = hash * 31 + DestinationIndex.GetHashCode(); 53 hash = hash * 31 + Incrementor.GetHashCode(); 54 54 55 55 return hash; … … 64 64 protected bool Eval(IInternalPushInterpreter interpreter, IPushStack<Expression> sourceStack, bool pushCurrentIndex = false) { 65 65 // if not initialized 66 if ( this.State.Body == null) {67 if ( this.HasInsufficientArguments(interpreter, sourceStack)) return false;66 if (State.Body == null) { 67 if (HasInsufficientArguments(interpreter, sourceStack)) return false; 68 68 69 var state = this.InitState(interpreter, sourceStack);69 var state = InitState(interpreter, sourceStack); 70 70 var initLoopExpression = Clone(state, interpreter); 71 71 … … 75 75 76 76 // if loop end reached 77 if ( this.State.DestinationIndex == this.State.CurrentIndex) {78 this.PushLastIteration(interpreter);77 if (State.DestinationIndex == State.CurrentIndex) { 78 PushLastIteration(interpreter); 79 79 return true; 80 80 } 81 81 82 this.PushIteration(interpreter);82 PushIteration(interpreter); 83 83 84 84 return true; … … 100 100 101 101 protected virtual void PushIteration(IInternalPushInterpreter interpreter) { 102 interpreter.IntegerStack.Push( this.State.CurrentIndex);102 interpreter.IntegerStack.Push(State.CurrentIndex); 103 103 104 104 var newState = LoopState.Create(
Note: See TracChangeset
for help on using the changeset viewer.