Changeset 15017 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/VectorConcatExpressions.cs
- Timestamp:
- 06/01/17 09:28:34 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/VectorConcatExpressions.cs
r14952 r15017 16 16 protected VectorConcatExpression(bool deserializing) : base(deserializing) { } 17 17 18 protected bool IsNoop(IInternalPushInterpreter interpreter, IPushStack< List<T>> vectorStack) {18 protected bool IsNoop(IInternalPushInterpreter interpreter, IPushStack<IReadOnlyList<T>> vectorStack) { 19 19 return vectorStack.Count < 2 || 20 20 vectorStack.Top.Count + vectorStack[1].Count > interpreter.Configuration.MaxVectorLength; 21 21 } 22 22 23 protected void Eval(IInternalPushInterpreter interpter, IPushStack< List<T>> vectorStack) {23 protected void Eval(IInternalPushInterpreter interpter, IPushStack<IReadOnlyList<T>> vectorStack) { 24 24 var first = vectorStack.Pop(); 25 25 var second = vectorStack.Top; 26 var result = new T[first.Count + second.Count]; 26 var result = new List<T>(second.Count + first.Count); 27 result.AddRange(second); 28 result.AddRange(first); 27 29 28 first.CopyTo(result, 0); 29 second.CopyTo(result, first.Count); 30 vectorStack.SetTop(new List<T>(result)); 30 vectorStack.Top = result; 31 31 } 32 32 }
Note: See TracChangeset
for help on using the changeset viewer.