Changeset 9363 for branches/OaaS/HeuristicLab.Parameters
- Timestamp:
- 04/16/13 13:13:41 (12 years ago)
- Location:
- branches/OaaS
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/OaaS
- Property svn:ignore
-
old new 21 21 protoc.exe 22 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll 23 24 packages
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/OaaS/HeuristicLab.Parameters/3.3/HeuristicLab.Parameters-3.3.csproj
r6866 r9363 191 191 --> 192 192 <PropertyGroup> 193 <PreBuildEvent>set Path=%25Path%25;$(ProjectDir);$(SolutionDir)193 <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir) 194 194 set ProjectDir=$(ProjectDir) 195 195 set SolutionDir=$(SolutionDir) … … 198 198 call PreBuildEvent.cmd 199 199 </PreBuildEvent> 200 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' "> 201 export ProjectDir=$(ProjectDir) 202 export SolutionDir=$(SolutionDir) 203 204 $SolutionDir/PreBuildEvent.sh 205 </PreBuildEvent> 200 206 </PropertyGroup> 201 207 </Project> -
branches/OaaS/HeuristicLab.Parameters/3.3/LookupParameter.cs
r7259 r9363 21 21 22 22 using System; 23 using System.Threading; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 31 32 [Item("LookupParameter", "A parameter whose value is retrieved from or written to a scope.")] 32 33 [StorableClass] 33 public class LookupParameter<T> : Parameter, I LookupParameter<T> where T : class, IItem {34 public class LookupParameter<T> : Parameter, IStatefulItem, ILookupParameter<T> where T : class, IItem { 34 35 [Storable] 35 36 private string actualName; … … 59 60 } 60 61 62 private Lazy<ThreadLocal<IItem>> cachedActualValues; 63 private IItem CachedActualValue { 64 get { return cachedActualValues.Value.Value; } 65 } 66 67 private Lazy<ThreadLocal<IExecutionContext>> executionContexts; 68 public IExecutionContext ExecutionContext { 69 get { return executionContexts.Value.Value; } 70 set { 71 if (value != executionContexts.Value.Value) { 72 executionContexts.Value.Value = value; 73 cachedActualValues.Value.Value = null; 74 } 75 } 76 } 77 61 78 [StorableConstructor] 62 protected LookupParameter(bool deserializing) : base(deserializing) { } 79 protected LookupParameter(bool deserializing) 80 : base(deserializing) { 81 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 82 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 83 } 63 84 protected LookupParameter(LookupParameter<T> original, Cloner cloner) 64 85 : base(original, cloner) { 65 86 actualName = original.actualName; 87 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 88 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 66 89 } 67 90 public LookupParameter() … … 69 92 this.actualName = Name; 70 93 this.Hidden = true; 94 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 95 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 71 96 } 72 97 public LookupParameter(string name) … … 74 99 this.actualName = Name; 75 100 this.Hidden = true; 101 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 102 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 76 103 } 77 104 public LookupParameter(string name, string description) … … 79 106 this.actualName = Name; 80 107 this.Hidden = true; 108 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 109 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 81 110 } 82 111 public LookupParameter(string name, string description, string actualName) … … 84 113 this.actualName = string.IsNullOrWhiteSpace(actualName) ? Name : actualName; 85 114 this.Hidden = true; 115 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 116 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 86 117 } 87 118 … … 132 163 } 133 164 protected override IItem GetActualValue() { 165 if (CachedActualValue != null) return CachedActualValue; 134 166 string name; 135 167 // try to get value from context stack … … 146 178 typeof(T).GetPrettyName()) 147 179 ); 180 cachedActualValues.Value.Value = var.Value; 148 181 return var.Value; 149 182 } … … 156 189 typeof(T).GetPrettyName()) 157 190 ); 191 cachedActualValues.Value.Value = value; 192 158 193 // try to set value in context stack 159 194 string name; … … 175 210 } 176 211 212 public virtual void InitializeState() { 213 } 214 public virtual void ClearState() { 215 if (cachedActualValues.IsValueCreated) { 216 cachedActualValues.Value.Dispose(); 217 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 218 } 219 if (executionContexts.IsValueCreated) { 220 executionContexts.Value.Dispose(); 221 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication); 222 } 223 } 224 177 225 public event EventHandler ActualNameChanged; 178 226 protected virtual void OnActualNameChanged() { -
branches/OaaS/HeuristicLab.Parameters/3.3/Parameter.cs
r7259 r9363 22 22 using System; 23 23 using System.Drawing; 24 using System.Threading;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; … … 33 32 [Item("Parameter", "A base class for parameters.")] 34 33 [StorableClass] 35 public abstract class Parameter : NamedItem, IParameter , IStatefulItem{34 public abstract class Parameter : NamedItem, IParameter { 36 35 public override Image ItemImage { 37 36 get { … … 67 66 } 68 67 69 private Lazy<ThreadLocal<IItem>> cachedActualValues;70 68 public IItem ActualValue { 71 get { 72 if (cachedActualValues.Value.Value == null) cachedActualValues.Value.Value = GetActualValue(); 73 return cachedActualValues.Value.Value; 74 } 75 set { 76 cachedActualValues.Value.Value = value; 77 SetActualValue(value); 78 } 79 } 80 private Lazy<ThreadLocal<IExecutionContext>> executionContexts; 81 public IExecutionContext ExecutionContext { 82 get { return executionContexts.Value.Value; } 83 set { 84 if (value != executionContexts.Value.Value) { 85 executionContexts.Value.Value = value; 86 cachedActualValues.Value.Value = null; 87 } 88 } 69 get { return GetActualValue(); } 70 set { SetActualValue(value); } 89 71 } 90 72 … … 92 74 protected Parameter(bool deserializing) 93 75 : 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);96 76 } 97 77 protected Parameter(Parameter original, Cloner cloner) … … 99 79 dataType = original.dataType; 100 80 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);103 81 } 104 82 protected Parameter() … … 106 84 dataType = typeof(IItem); 107 85 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);110 86 } 111 87 protected Parameter(string name, Type dataType) … … 114 90 this.dataType = dataType; 115 91 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);118 92 } 119 93 protected Parameter(string name, string description, Type dataType) … … 122 96 this.dataType = dataType; 123 97 hidden = false; 124 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);125 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);126 }127 128 public virtual void InitializeState() { }129 public virtual void ClearState() {130 cachedActualValues = new Lazy<ThreadLocal<IItem>>(() => { return new ThreadLocal<IItem>(); }, LazyThreadSafetyMode.ExecutionAndPublication);131 executionContexts = new Lazy<ThreadLocal<IExecutionContext>>(() => { return new ThreadLocal<IExecutionContext>(); }, LazyThreadSafetyMode.ExecutionAndPublication);132 98 } 133 99 -
branches/OaaS/HeuristicLab.Parameters/3.3/Plugin.cs.frame
r7259 r9363 26 26 /// Plugin class for HeuristicLab.Parameters plugin. 27 27 /// </summary> 28 [Plugin("HeuristicLab.Parameters", "3.3. 6.$WCREV$")]28 [Plugin("HeuristicLab.Parameters", "3.3.7.$WCREV$")] 29 29 [PluginFile("HeuristicLab.Parameters-3.3.dll", PluginFileType.Assembly)] 30 30 [PluginDependency("HeuristicLab.Collections", "3.3")] -
branches/OaaS/HeuristicLab.Parameters/3.3/Properties/AssemblyInfo.cs.frame
r7259 r9363 54 54 // by using the '*' as shown below: 55 55 [assembly: AssemblyVersion("3.3.0.0")] 56 [assembly: AssemblyFileVersion("3.3. 6.$WCREV$")]56 [assembly: AssemblyFileVersion("3.3.7.$WCREV$")] -
branches/OaaS/HeuristicLab.Parameters/3.3/ScopeParameter.cs
r7259 r9363 21 21 22 22 using System; 23 using System.Threading; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 31 32 [Item("ScopeParameter", "A parameter which represents the current scope.")] 32 33 [StorableClass] 33 public class ScopeParameter : Parameter{34 public class ScopeParameter : LookupParameter<IScope> { 34 35 public new IScope ActualValue { 35 36 get { return ExecutionContext.Scope; } 36 37 } 38 37 39 38 40 [StorableConstructor] … … 40 42 protected ScopeParameter(ScopeParameter original, Cloner cloner) : base(original, cloner) { } 41 43 public ScopeParameter() 42 : base("Anonymous" , typeof(IScope)) {44 : base("Anonymous") { 43 45 this.Hidden = true; 44 46 } 45 47 public ScopeParameter(string name) 46 : base(name , typeof(IScope)) {48 : base(name) { 47 49 this.Hidden = true; 48 50 } 49 51 public ScopeParameter(string name, string description) 50 : base(name, description , typeof(IScope)) {52 : base(name, description) { 51 53 this.Hidden = true; 52 54 }
Note: See TracChangeset
for help on using the changeset viewer.