Free cookie consent management tool by TermsFeed Policy Generator

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

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

#2665 Fixed bias 0 issue, PushExpressionFrequencyAnalyzer, Fixed probability for ERC settings, Fixed enable/disable instructions, Added expression descriptions

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