Changeset 15017 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatefulExpression.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/StatefulExpression.cs
r14952 r15017 9 9 [Storable] 10 10 public T State { get; protected set; } 11 [NonSerialized] 11 12 private int? hashCode; 13 [NonSerialized] 12 14 private string stringRepresentation; 13 15 … … 20 22 21 23 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(); 23 32 } 24 33 … … 27 36 get 28 37 { 29 return stringRepresentation ?? (stringRepresentation = State.ToString());38 return stringRepresentation ?? (stringRepresentation = GetStringRepresentation()); 30 39 } 31 40 }
Note: See TracChangeset
for help on using the changeset viewer.