Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/01/17 09:28:34 (7 years ago)
Author:
pkimmesw
Message:

#2665 Fixed Benchmark Problem Definition, Converted LoopExpressions to stateless expressions, Added several unit test to ensure funcionality, Fixed UI bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Extensions/CollectionExtensions.cs

    r14834 r15017  
    1212      return source[x];
    1313    }
     14
     15    public static int HashCode<T>(this IReadOnlyList<T> source) {
     16      var hash = 19 * 31 + typeof(T).FullName.GetHashCode();
     17
     18      for (var i = 0; i < source.Count; i++)
     19        hash = hash * 31 + source[i].GetHashCode();
     20
     21      return hash;
     22    }
     23
     24    public static int HashCode<T>(this IEnumerable<T> source) {
     25      var hash = 19 * 31 + typeof(T).FullName.GetHashCode();
     26
     27      foreach (var item in source)
     28        hash = hash * 31 + item.GetHashCode();
     29
     30      return hash;
     31    }
    1432  }
    1533}
Note: See TracChangeset for help on using the changeset viewer.