namespace HeuristicLab.Problems.ProgramSynthesis { using System; using HeuristicLab.Common; using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; [StorableClass] [Serializable] public abstract class StatelessExpression : Expression { [NonSerialized] private readonly int hashCode; protected StatelessExpression() { hashCode = GetType().FullName.GetHashCode(); } [StorableConstructor] protected StatelessExpression(bool deserializing) : base(deserializing) { } protected StatelessExpression(StatelessExpression origin, Cloner cloner) : base(origin, cloner) { } public override int GetHashCode() { return hashCode; } public override string StringRepresentation { get { return ExpressionTable.TypeToAttributeTable[GetType()].Name; } } public override bool Equals(object obj) { return ReferenceEquals(this, obj) || hashCode == obj.GetHashCode(); } } }