Free cookie consent management tool by TermsFeed Policy Generator

source: branches/2895_PushGP_GenealogyAnalysis/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatelessExpression.cs @ 16752

Last change on this file since 16752 was 15771, checked in by bburlacu, 7 years ago

#2895: Add solution skeleton for PushGP with genealogy analysis.

File size: 1.0 KB
Line 
1namespace HeuristicLab.Problems.ProgramSynthesis {
2  using System;
3
4  using HeuristicLab.Common;
5  using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
6
7  [StorableClass]
8  [Serializable]
9  public abstract class StatelessExpression : Expression {
10    [NonSerialized]
11    private readonly int hashCode;
12
13    protected StatelessExpression() {
14      hashCode = GetType().FullName.GetHashCode();
15    }
16
17    [StorableConstructor]
18    protected StatelessExpression(bool deserializing) : base(deserializing) { }
19
20    protected StatelessExpression(StatelessExpression origin, Cloner cloner) : base(origin, cloner) { }
21
22    public override int GetHashCode() {
23      return hashCode;
24    }
25
26    public override string StringRepresentation
27    {
28      get
29      {
30        return ExpressionTable.TypeToAttributeTable[GetType()].Name;
31      }
32    }
33
34    public override bool Equals(object obj) {
35      return ReferenceEquals(this, obj) ||
36             hashCode == obj.GetHashCode();
37    }
38  }
39}
Note: See TracBrowser for help on using the repository browser.