Changeset 15017 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/ShoveExpressions.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/ShoveExpressions.cs
r14952 r15017 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions { 2 using System;3 2 using System.Collections.Generic; 4 3 … … 6 5 7 6 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 7 using HeuristicLab.Problems.ProgramSynthesis.Push.Extensions; 8 8 9 9 using Interpreter; … … 17 17 18 18 protected void Eval(IPushStack<T> stack, IPushStack<long> integerStack) { 19 var index = (int)Math.Abs(integerStack.Pop() %stack.Count);19 var index = integerStack.Pop().AsInt(stack.Count); 20 20 var item = stack.Pop(); 21 21 stack.Insert(index, item); … … 87 87 } 88 88 89 [PushExpression(StackTypes.Exec, "EXEC.SHOVE", StackTypes.Integer )]89 [PushExpression(StackTypes.Exec, "EXEC.SHOVE", StackTypes.Integer, execIn: 1)] 90 90 [StorableClass] 91 91 public class ExecShoveExpression : ShoveExpression<Expression> { … … 153 153 [PushExpression(StackTypes.IntegerVector, "INTEGER[].SHOVE", StackTypes.Integer)] 154 154 [StorableClass] 155 public class IntegerVectorShoveExpression : ShoveExpression< List<long>> {155 public class IntegerVectorShoveExpression : ShoveExpression<IReadOnlyList<long>> { 156 156 public IntegerVectorShoveExpression() { } 157 157 [StorableConstructor] … … 169 169 [PushExpression(StackTypes.FloatVector, "FLOAT[].SHOVE", StackTypes.Integer)] 170 170 [StorableClass] 171 public class FloatVectorShoveExpression : ShoveExpression< List<double>> {171 public class FloatVectorShoveExpression : ShoveExpression<IReadOnlyList<double>> { 172 172 public FloatVectorShoveExpression() { } 173 173 [StorableConstructor] … … 185 185 [PushExpression(StackTypes.BooleanVector, "BOOLEAN[].SHOVE", StackTypes.Integer)] 186 186 [StorableClass] 187 public class BooleanVectorShoveExpression : ShoveExpression< List<bool>> {187 public class BooleanVectorShoveExpression : ShoveExpression<IReadOnlyList<bool>> { 188 188 public BooleanVectorShoveExpression() { } 189 189 [StorableConstructor] … … 201 201 [PushExpression(StackTypes.StringVector, "STRING[].SHOVE", StackTypes.Integer)] 202 202 [StorableClass] 203 public class StringVectorShoveExpression : ShoveExpression< List<string>> {203 public class StringVectorShoveExpression : ShoveExpression<IReadOnlyList<string>> { 204 204 public StringVectorShoveExpression() { } 205 205 [StorableConstructor]
Note: See TracChangeset
for help on using the changeset viewer.