Changeset 14952 for branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatefulExpression.cs
- Timestamp:
- 05/10/17 11:23:05 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatefulExpression.cs
r14908 r14952 1 1 namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions { 2 2 using System; 3 3 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 4 4 using HeuristicLab.Problems.ProgramSynthesis.Push.Data.Pool; 5 5 6 6 [Serializable] 7 [StorableClass] 7 8 public abstract class StatefulExpression<T> : Expression, IPooledObject { 9 [Storable] 8 10 public T State { get; protected set; } 9 11 private int? hashCode; … … 13 15 State = state; 14 16 } 17 18 [StorableConstructor] 19 protected StatefulExpression(bool deserializing) : base(deserializing) { } 15 20 16 21 protected virtual int CalcHashCode() { … … 22 27 get 23 28 { 24 if (stringRepresentation == null) stringRepresentation = State.ToString(); 25 return stringRepresentation; 29 return stringRepresentation ?? (stringRepresentation = State.ToString()); 26 30 } 27 31 }
Note: See TracChangeset
for help on using the changeset viewer.