Ignore:
Timestamp:
03/08/17 10:23:51 (5 years ago)
Author:
mkommend
Message:

#2665: Removed memory pressure from expressions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PushGP/HeuristicLab.PushGP/HeuristicLab.Problems.ProgramSynthesis/Push/Expressions/StatefullExpression.cs

    r14727 r14730  
    11namespace HeuristicLab.Problems.ProgramSynthesis.Push.Expressions {
    2   using System;
    32
    43  public abstract class StatefullExpression<T> : Expression {
    54
    65    public readonly T State;
    7     private readonly Lazy<int> hashCode;
     6
     7    private int hashCode;
     8    private int HashCode {
     9      get {
     10        if (hashCode == default(int)) hashCode = CalcHashCode();
     11        return hashCode;
     12      }
     13    }
    814
    915    protected StatefullExpression(T state) {
    1016      this.State = state;
    11       this.hashCode = new Lazy<int>(this.CalcHashCode, true);
    1217    }
    1318
     
    3035
    3136    public override int GetHashCode() {
    32       return this.hashCode.Value;
     37      return HashCode;
    3338    }
    3439  }
Note: See TracChangeset for help on using the changeset viewer.