Changeset 6103 for trunk/sources/HeuristicLab.Parameters
- Timestamp:
- 05/03/11 11:04:02 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Parameters/3.3/Parameter.cs
r5768 r6103 33 33 [Item("Parameter", "A base class for parameters.")] 34 34 [StorableClass] 35 public abstract class Parameter : NamedItem, IParameter {35 public abstract class Parameter : NamedItem, IParameter, IStatefulItem { 36 36 public override Image ItemImage { 37 37 get { … … 92 92 protected Parameter(bool deserializing) 93 93 : base(deserializing) { 94 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 95 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 94 InitializeState(); 96 95 } 97 96 protected Parameter(Parameter original, Cloner cloner) … … 99 98 dataType = original.dataType; 100 99 hidden = original.hidden; 101 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 102 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 100 InitializeState(); 103 101 } 104 102 protected Parameter() … … 106 104 dataType = typeof(IItem); 107 105 hidden = false; 108 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 109 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 106 InitializeState(); 110 107 } 111 108 protected Parameter(string name, Type dataType) … … 114 111 this.dataType = dataType; 115 112 hidden = false; 116 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 117 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 113 InitializeState(); 118 114 } 119 115 protected Parameter(string name, string description, Type dataType) … … 122 118 this.dataType = dataType; 123 119 hidden = false; 120 InitializeState(); 121 } 122 123 public virtual void InitializeState() { 124 124 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 125 125 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 126 } 127 public virtual void ClearState() { 128 cachedActualValues = null; 129 executionContexts = null; 126 130 } 127 131
Note: See TracChangeset
for help on using the changeset viewer.