Free cookie consent management tool by TermsFeed Policy Generator

source: branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatelessExpression.cs @ 14952

Last change on this file since 14952 was 14952, checked in by pkimmesw, 7 years ago

#2665 Added IsNoop to Expression, Made Expressions storable, Fixed Debugger, Fixed and improved problem data and result visualisation, Added custom ErcOption view, Added problem difficulty to problem data name

File size: 688 bytes
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
2  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
3
4  [StorableClass]
5  public abstract class StatelessExpression : Expression {
6    private readonly int hashCode;
7
8    protected StatelessExpression() {
9      hashCode = GetType().GetHashCode();
10    }
11
12    [StorableConstructor]
13    protected StatelessExpression(bool deserializing) : base(deserializing) { }
14
15    public override int GetHashCode() {
16      return hashCode;
17    }
18
19    public override bool Equals(object obj) {
20      return ReferenceEquals(this, obj) ||
21             hashCode == obj.GetHashCode();
22    }
23  }
24}
Note: See TracBrowser for help on using the repository browser.