- Timestamp:
- 07/18/14 12:35:00 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll11 10 HeuristicLab 3.3.5.1.ReSharper.user 12 11 HeuristicLab 3.3.6.0.ReSharper.user 13 12 HeuristicLab.4.5.resharper.user 14 13 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development16 14 HeuristicLab.resharper.user 17 15 ProtoGen.exe … … 19 17 _ReSharper.HeuristicLab 20 18 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests22 19 _ReSharper.HeuristicLab.ExtLibs 23 20 bin 24 21 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests 23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Clients.Hive/3.3/Tasks/EngineTask.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 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 parentscope33 return new EngineHiveTask(this, null);34 }35 36 31 [Storable] 37 32 protected IOperation initialOperation; … … 55 50 56 51 #region constructors and cloning 52 public EngineTask() { } 57 53 public EngineTask(IOperation initialOperation, IEngine engine) { 58 54 this.initialOperation = initialOperation; 59 55 this.Item = engine; 60 56 } 61 62 public EngineTask(IEngine engine) : base(engine) { }63 57 64 58 [StorableConstructor] … … 150 144 151 145 public override string Name { 152 get { return Item != null ? Item.ToString() : "Engine Task"; }146 get { return Item != null ? Item.ToString() : null; } 153 147 set { throw new NotSupportedException(); } 154 148 } … … 159 153 160 154 public override string ItemName { 161 get { return "Engine 155 get { return "EngineTask"; } 162 156 } 163 157 } -
branches/HiveStatistics/sources/HeuristicLab.Clients.Hive/3.3/Tasks/ItemTask.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 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;25 24 using HeuristicLab.Common; 26 25 using HeuristicLab.Core; 27 26 using HeuristicLab.Hive; 28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.PluginInfrastructure;30 28 31 29 namespace HeuristicLab.Clients.Hive { … … 33 31 [StorableClass] 34 32 public abstract class ItemTask : NamedItem, ITask { 35 public virtual HiveTask CreateHiveTask() {36 return new HiveTask(this, true);37 }38 39 33 public virtual bool IsParallelizable { 40 34 get { return true; } 41 set { }42 35 } 43 36 … … 78 71 this.Item = cloner.Clone(original.Item); 79 72 } 80 public ItemTask(IItem item) {81 Item = item;82 }83 73 84 74 [StorableHook(HookType.AfterDeserialization)] … … 221 211 return Name; 222 212 } 223 224 #region Helpers225 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 #endregion246 213 } 247 214 } -
branches/HiveStatistics/sources/HeuristicLab.Clients.Hive/3.3/Tasks/OptimizerTask.cs
r11202 r11203 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 4Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 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 36 32 public override bool IsParallelizable { 37 33 get { return this.Item is Experiment || this.Item is BatchRun; } … … 50 46 } 51 47 48 public OptimizerTask() : base() { } 52 49 public OptimizerTask(IOptimizer optimizer) 53 : base(optimizer) { 54 55 if (optimizer is Experiment || optimizer is BatchRun) { 50 : this() { 51 this.Item = optimizer; 52 53 if (optimizer is Experiment) { 56 54 this.ComputeInParallel = true; 55 } else if (optimizer is BatchRun) { 56 this.ComputeInParallel = false; 57 57 } else { 58 58 this.ComputeInParallel = false; … … 210 210 get { 211 211 if (Item == null) 212 return "Optimizer Task";212 return string.Empty; 213 213 else 214 214 return Item.Name;
Note: See TracChangeset
for help on using the changeset viewer.