Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/10/17 21:36:03 (7 years ago)
Author:
pkimmesw
Message:

#2665 Fixed small issues, testet benchmark suite, added INX Expressions

Location:
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Stack
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Stack/IPushStack.cs

    r15017 r15189  
    11namespace HeuristicLab.Problems.ProgramSynthesis.Push.Stack {
    2   using System;
    32  using System.Collections.Generic;
    43
     
    1817    void Push(IEnumerable<T> items);
    1918    new void Clear();
    20     T Peek();
    21     T[] Peek(int count);
    22     void PushResult(int count, Func<T[], T> templateFunc);
     19    IReadOnlyList<T> Peek(int count);
    2320    void Insert(int index, T item);
    24     T ReverseElementAt(int offset);
    2521    T Pop();
    26     T[] Pop(int count);
     22    IReadOnlyList<T> Pop(int count);
    2723    bool TryPop(out T item);
    2824    T ElementAt(int index);
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Stack/InterpreterStackStringifier.cs

    r15017 r15189  
    4545
    4646    private static IEnumerable<string> StringifyLiteralStack<T>(IPushStack<T> stack, string prefix = "", string postfix = "", bool reverse = true) {
    47       var result = stack.AsEnumerable();
     47      var result = stack.AsStrings();
    4848
    4949      if (reverse)
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Stack/PushStack.cs

    r15017 r15189  
    122122    }
    123123
    124     public T ReverseElementAt(int offset) {
    125       return data[offset];
    126     }
    127 
    128124    public T this[int index]
    129125    {
     
    145141      if (index == Count - 1) return;
    146142
    147       var item = ReverseElementAt(index);
     143      var item = data[index];
    148144      data.RemoveAt(index);
    149145      data.Add(item);
     
    157153    }
    158154
    159     public T[] Pop(int count) {
     155    public IReadOnlyList<T> Pop(int count) {
    160156      var items = Peek(count);
    161157      Remove(count);
     
    164160    }
    165161
    166     public T Peek() {
    167       return Top;
    168     }
    169 
    170     public T[] Peek(int count) {
     162    public IReadOnlyList<T> Peek(int count) {
    171163      var startIndex = Count - count;
    172164
     
    207199    }
    208200
    209     public void PushResult(int count, Func<T[], T> templateFunc) {
    210       if (!IsEnabled) return;
    211 
    212       var startIndex = Count - count;
    213       var items = new T[count];
    214 
    215       data.CopyTo(startIndex, items, 0, count);
    216       Remove(count - 1);
    217 
    218       data[Count - 1] = templateFunc(items);
    219     }
    220 
    221201    public void Push(IReadOnlyList<T> items, int startIndex) {
    222202      if (!IsEnabled) return;
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Stack/StackTypes.cs

    r15032 r15189  
    2020    BooleanVector = 0x2000,
    2121  }
     22
     23  //public static class StackTypeExtensions {
     24  //  private static readonly IReadOnlyDictionary<StackTypes, string> StackTypesNameDict = new Dictionary<StackTypes, string> {
     25  //    { StackTypes.Integer, "Integer" },
     26  //    { StackTypes.Float, "Float" },
     27  //    { StackTypes.Char, "Char" },
     28  //    { StackTypes.String, "String" },
     29  //    { StackTypes.Boolean, "Boolean" },
     30  //    { StackTypes.Name, "Name" },
     31  //    { StackTypes.Code, "Code" },
     32  //    { StackTypes.Exec, "Exec" },
     33  //    { StackTypes.Print, "Print" },
     34  //    { StackTypes.IntegerVector, "IntegerVector" },
     35  //    { StackTypes.FloatVector, "FloatVector" },
     36  //    { StackTypes.StringVector, "StringVector" },
     37  //    { StackTypes.BooleanVector, "BooleanVector" },
     38  //  };
     39
     40  //  public static string GetName(this StackTypes types) {
     41  //    return StackTypesNameDict[types];
     42  //  }
     43  //}
    2244}
Note: See TracChangeset for help on using the changeset viewer.