Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/03/11 19:25:13 (13 years ago)
Author:
swagner
Message:

Code formatting and minor changes (#1424)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs

    r6103 r6114  
    9292    protected Parameter(bool deserializing)
    9393      : base(deserializing) {
    94       InitializeState();
     94      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     95      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    9596    }
    9697    protected Parameter(Parameter original, Cloner cloner)
     
    9899      dataType = original.dataType;
    99100      hidden = original.hidden;
    100       InitializeState();
     101      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     102      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    101103    }
    102104    protected Parameter()
     
    104106      dataType = typeof(IItem);
    105107      hidden = false;
    106       InitializeState();
     108      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     109      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    107110    }
    108111    protected Parameter(string name, Type dataType)
     
    111114      this.dataType = dataType;
    112115      hidden = false;
    113       InitializeState();
     116      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     117      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    114118    }
    115119    protected Parameter(string name, string description, Type dataType)
     
    118122      this.dataType = dataType;
    119123      hidden = false;
    120       InitializeState();
    121     }
    122 
    123     public virtual void InitializeState() {
    124124      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    125125      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    126126    }
     127
     128    public virtual void InitializeState() { }
    127129    public virtual void ClearState() {
    128       cachedActualValues = null;
    129       executionContexts = null;
     130      cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
     131      executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);
    130132    }
    131133
Note: See TracChangeset for help on using the changeset viewer.