Changeset 10990
- Timestamp:
- 06/11/14 14:47:42 (11 years ago)
- Location:
- branches/DataPreprocessing
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing.Views/3.4/DataPreprocessingView.cs
r10987 r10990 98 98 viewShortcutListView.Enabled = Content != null; 99 99 applyInNewTabButton.Enabled = Content != null; 100 exportProblemButton.Enabled = Content != null ;100 exportProblemButton.Enabled = Content != null && Content.Problem != null; 101 101 undoButton.Enabled = Content != null; 102 102 } … … 120 120 121 121 private void applyInNewTabButton_Click(object sender, EventArgs e) { 122 var item = Content.Export AlgorithmOrProblem();122 var item = Content.Export(); 123 123 124 124 MainFormManager.MainForm.ShowContent(item); -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Implementations/PreprocessingContext.cs
r10978 r10990 33 33 : Item, IPreprocessingContext { 34 34 35 35 36 public IFilteredPreprocessingData Data { get; private set; } 37 36 38 public IAlgorithm Algorithm { get; private set; } 37 39 public IDataAnalysisProblem Problem { get; private set; } 40 public IDataAnalysisProblemData ProblemData { get; private set; } 41 42 private readonly ProblemDataCreator creator; 38 43 39 44 public PreprocessingContext(IDataAnalysisProblemData dataAnalysisProblemData, IAlgorithm algorithm, IDataAnalysisProblem problem) { 40 TransactionalPreprocessingData transactionalPreprocessingData = new TransactionalPreprocessingData(dataAnalysisProblemData); 45 var transactionalPreprocessingData = new TransactionalPreprocessingData(dataAnalysisProblemData); 46 Data = new FilteredPreprocessingData(transactionalPreprocessingData); 41 47 42 Data = new FilteredPreprocessingData(transactionalPreprocessingData);48 ProblemData = dataAnalysisProblemData; 43 49 Algorithm = algorithm; 44 50 Problem = problem; 51 52 creator = new ProblemDataCreator(this); 45 53 } 46 54 … … 56 64 } 57 65 58 public IItem Export AlgorithmOrProblem() {59 if (Algorithm != null) {66 public IItem Export() { 67 if (Algorithm != null) 60 68 return ExportAlgorithm(); 61 } 62 return ExportProblem(); 69 else if (Problem != null) 70 return ExportProblem(); 71 return ExportProblemData(); 72 } 73 public IAlgorithm ExportAlgorithm() { 74 var preprocessedAlgorithm = (IAlgorithm)Algorithm.Clone(new Cloner()); 75 preprocessedAlgorithm.Name = preprocessedAlgorithm.Name + "(Preprocessed)"; 76 Algorithm.Runs.Clear(); 77 var problem = (IDataAnalysisProblem)preprocessedAlgorithm.Problem; 78 SetNewProblemData(problem); 79 return preprocessedAlgorithm; 80 } 81 public IDataAnalysisProblem ExportProblem() { 82 var preprocessedProblem = (IDataAnalysisProblem)Problem.Clone(new Cloner()); 83 SetNewProblemData(preprocessedProblem); 84 return preprocessedProblem; 63 85 } 64 86 65 public IProblem ExportProblem() { 66 return Export(Problem, SetupProblem); 67 } 68 public IAlgorithm ExportAlgorithm() { 69 return Export(Algorithm, SetupAlgorithm); 87 public IDataAnalysisProblemData ExportProblemData() { 88 return creator.CreateProblemData(); 70 89 } 71 90 72 private IDataAnalysisProblem SetupProblem(IProblem problem) { 73 return (IDataAnalysisProblem)problem; 74 } 75 private IDataAnalysisProblem SetupAlgorithm(IAlgorithm algorithm) { 76 algorithm.Name = algorithm.Name + "(Preprocessed)"; 77 algorithm.Runs.Clear(); 78 return (IDataAnalysisProblem)algorithm.Problem; 79 } 80 private T Export<T>(T original, Func<T, IDataAnalysisProblem> setup) 81 where T : IItem { 82 var creator = new ProblemDataCreator(this); 91 private void SetNewProblemData(IDataAnalysisProblem problem) { 83 92 var data = creator.CreateProblemData(); 84 85 var clone = (T)original.Clone(new Cloner());86 87 var problem = setup(clone);88 93 problem.ProblemDataParameter.ActualValue = data; 89 94 problem.Name = "Preprocessed " + problem.Name; 90 return clone;91 95 } 92 96 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/Interfaces/IPreprocessingContext.cs
r10978 r10990 28 28 namespace HeuristicLab.DataPreprocessing { 29 29 public interface IPreprocessingContext : IItem { 30 IFilteredPreprocessingData Data { get; } 30 31 31 IFilteredPreprocessingData Data { get; }32 32 IAlgorithm Algorithm { get; } 33 33 IDataAnalysisProblem Problem { get; } 34 IDataAnalysisProblemData ProblemData { get; } 34 35 35 IItem Export AlgorithmOrProblem();36 IItem Export(); 36 37 IAlgorithm ExportAlgorithm(); 37 IProblem ExportProblem(); 38 IDataAnalysisProblem ExportProblem(); 39 IDataAnalysisProblemData ExportProblemData(); 38 40 } 39 41 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.4/ProblemDataCreator.cs
r10982 r10990 43 43 44 44 public IDataAnalysisProblemData CreateProblemData() { 45 var oldProblemData = context.Problem .ProblemData;45 var oldProblemData = context.ProblemData; 46 46 47 IDataAnalysisProblemData problemData = null;47 IDataAnalysisProblemData problemData; 48 48 49 49 if (oldProblemData is RegressionProblemData) {
Note: See TracChangeset
for help on using the changeset viewer.