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/Expressions/StatefulExpression.cs

    r14952 r15017  
    99    [Storable]
    1010    public T State { get; protected set; }
     11    [NonSerialized]
    1112    private int? hashCode;
     13    [NonSerialized]
    1214    private string stringRepresentation;
    1315
     
    2022
    2123    protected virtual int CalcHashCode() {
    22       return State.GetHashCode();
     24      var hash = 19 * 31 + GetType().FullName.GetHashCode();
     25      hash = hash * 31 + State.GetHashCode();
     26
     27      return hash;
     28    }
     29
     30    protected virtual string GetStringRepresentation() {
     31      return State.ToString();
    2332    }
    2433
     
    2736      get
    2837      {
    29         return stringRepresentation ?? (stringRepresentation = State.ToString());
     38        return stringRepresentation ?? (stringRepresentation = GetStringRepresentation());
    3039      }
    3140    }
Note: See TracChangeset for help on using the changeset viewer.