Free cookie consent management tool by TermsFeed Policy Generator

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

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

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

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