- Timestamp:
- 11/27/14 11:23:37 (10 years ago)
- Location:
- branches/Breadcrumbs
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/Breadcrumbs
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/Breadcrumbs/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs
r9819 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 29 29 [StorableClass] 30 30 public class EngineTask : ItemTask { 31 public override HiveTask CreateHiveTask() { 32 //only used when deserializing, so no problem with parentscope 33 return new EngineHiveTask(this, null); 34 } 35 31 36 [Storable] 32 37 protected IOperation initialOperation; … … 54 59 this.Item = engine; 55 60 } 61 62 public EngineTask(IEngine engine) : base(engine) { } 56 63 57 64 [StorableConstructor] -
branches/Breadcrumbs/HeuristicLab.Clients.Hive/3.3/Tasks/ItemTask.cs
r9456 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using System; 23 23 using System.Drawing; 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Hive; 27 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.PluginInfrastructure; 28 30 29 31 namespace HeuristicLab.Clients.Hive { … … 31 33 [StorableClass] 32 34 public abstract class ItemTask : NamedItem, ITask { 35 public virtual HiveTask CreateHiveTask() { 36 return new HiveTask(this, true); 37 } 38 33 39 public virtual bool IsParallelizable { 34 40 get { return true; } 41 set { } 35 42 } 36 43 … … 71 78 this.Item = cloner.Clone(original.Item); 72 79 } 80 public ItemTask(IItem item) { 81 Item = item; 82 } 73 83 74 84 [StorableHook(HookType.AfterDeserialization)] … … 211 221 return Name; 212 222 } 223 224 #region Helpers 225 public static bool IsTypeSupported(Type itemType) { 226 var supportedHiveTaskTypes = ApplicationManager.Manager.GetTypes(typeof(ItemTask)) 227 .Select(t => t.GetProperties().Single(x => x.Name == "Item" && x.PropertyType != typeof(IItem)).PropertyType); 228 return supportedHiveTaskTypes.Any(x => x.IsAssignableFrom(itemType)); 229 } 230 231 public static Type GetHiveTaskType(Type itemType) { 232 if (!IsTypeSupported(itemType)) throw new Exception("Item " + itemType + " is not supported for Hive."); 233 234 var typeHiveTaskMap = ApplicationManager.Manager.GetTypes(typeof(ItemTask)) 235 .Select(t => new Tuple<Type, Type>(t.GetProperties().Single(x => x.Name == "Item" && x.PropertyType != typeof(IItem)).PropertyType, t)); 236 237 return typeHiveTaskMap.Single(x => x.Item1.IsAssignableFrom(itemType)).Item2; 238 } 239 240 public static ItemTask GetItemTaskForItem(IItem item) { 241 Type itemType = item.GetType(); 242 Type hiveTaskType = GetHiveTaskType(itemType); 243 return Activator.CreateInstance(hiveTaskType, new object[] { item }) as ItemTask; 244 } 245 #endregion 213 246 } 214 247 } -
branches/Breadcrumbs/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs
r9819 r11594 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 3Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 30 30 [StorableClass] 31 31 public class OptimizerTask : ItemTask { 32 public override HiveTask CreateHiveTask() { 33 return new OptimizerHiveTask(this); 34 } 35 32 36 public override bool IsParallelizable { 33 37 get { return this.Item is Experiment || this.Item is BatchRun; } … … 46 50 } 47 51 48 public OptimizerTask(IOptimizer optimizer) {49 this.Item = optimizer;50 51 if (optimizer is Experiment ) {52 public OptimizerTask(IOptimizer optimizer) 53 : base(optimizer) { 54 55 if (optimizer is Experiment || optimizer is BatchRun) { 52 56 this.ComputeInParallel = true; 53 } else if (optimizer is BatchRun) {54 this.ComputeInParallel = false;55 57 } else { 56 58 this.ComputeInParallel = false;
Note: See TracChangeset
for help on using the changeset viewer.