Index: /addons/HeuristicLab.DataImporter/Build.cmd
===================================================================
--- /addons/HeuristicLab.DataImporter/Build.cmd (revision 15690)
+++ /addons/HeuristicLab.DataImporter/Build.cmd (revision 15690)
@@ -0,0 +1,94 @@
+@ECHO OFF
+
+SET CLEANBEFOREBUILD=1
+
+SET SELECTED=
+SET CONFIGURATION=
+SET PLATFORM=
+
+IF "%~1"=="" GOTO :prompt_solution
+
+SET SELECTED=%1
+IF NOT EXIST %SELECTED% (
+ ECHO Solution file %SELECTED% could not be found.
+ GOTO :end
+)
+ECHO Building solution %SELECTED% ...
+GOTO :config_selection
+
+:prompt_solution
+SET /A COUNT=0
+FOR /F "tokens=*" %%A IN ('dir /B *.sln') DO (
+ CALL :forloopbody "%%A"
+)
+
+IF "%COUNT%"=="1" (
+ SET SELECTED=%SOLUTIONS.1%
+ ECHO Building %SOLUTIONS.1% as it is the only solution that was found ...
+ GOTO :config_selection
+)
+
+ECHO Found the following solutions:
+FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO ECHO %%A = %%B
+ECHO.
+SET /P SOLUTIONINDEX=Which solution to build? Type the number:
+
+SET SELECTED=""
+FOR /F "tokens=2* delims=.=" %%A IN ('SET SOLUTIONS.') DO (
+ IF "%%A"=="%SOLUTIONINDEX%" SET SELECTED=%%B
+)
+
+IF %SELECTED%=="" GOTO :eof
+
+:config_selection
+IF "%~2"=="" GOTO :prompt_config
+
+SET CONFIGURATION=%~2
+ECHO Building configuration %CONFIGURATION% ...
+GOTO :platform_selection
+
+:prompt_config
+SET /P CONFIGURATION=Which configuration to build [Release]:
+IF "%CONFIGURATION%"=="" SET CONFIGURATION=Release
+
+:platform_selection
+IF "%~3"=="" GOTO :prompt_platform
+
+SET PLATFORM=%~3
+ECHO Building platform %PLATFORM% ...
+GOTO :main
+
+:prompt_platform
+SET /P PLATFORM=Which platform to build [Any CPU]:
+IF "%PLATFORM%"=="" SET PLATFORM=Any CPU
+
+:main
+REM First find the path to the msbuild.exe by performing a registry query
+FOR /F "tokens=1,3 delims= " %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0"') DO (
+ IF "%%A"=="MSBuildToolsPath" SET MSBUILDPATH=%%B)
+
+REM Then execute msbuild to clean and build the solution
+REM Disable that msbuild creates a cache file of the solution
+SET MSBuildUseNoSolutionCache=1
+REM Run msbuild to clean and then build
+IF "%CLEANBEFOREBUILD%"=="1" (
+ ECHO Cleaning ...
+ %MSBUILDPATH%msbuild.exe %SELECTED% /target:Clean /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly
+)
+ECHO Building ...
+%MSBUILDPATH%msbuild.exe %SELECTED% /target:Build /p:Configuration="%CONFIGURATION%",Platform="%PLATFORM%" /m:2 /nologo /verbosity:q /clp:ErrorsOnly
+
+ECHO.
+ECHO DONE.
+
+:end
+
+PAUSE
+
+GOTO :eof
+
+REM This workaround is necessary so that COUNT gets reevaluated
+:forloopbody
+SET /A COUNT+=1
+SET SOLUTIONS.%COUNT%=%1
+GOTO :eof
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporter.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporter.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporter.cs (revision 15690)
@@ -0,0 +1,85 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Globalization;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.DataImporter.DataProcessor;
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ public class CsvExporter : IExporter{
+ public string Description {
+ get { return "Export as CSV file"; }
+ }
+
+ private CsvExporterView view;
+ public System.Windows.Forms.UserControl SettingsControl {
+ get {
+ if (view == null)
+ view = new CsvExporterView();
+ return view;
+ }
+ }
+
+ public void Export(DataSet dataSet) {
+ StreamWriter stream = new StreamWriter(view.FileName, false);
+ if (dataSet.ColumnGroups.Count() != 0) {
+ StringBuilder sb = new StringBuilder();
+ if (view.IncludeColumnNames) {
+ foreach (ColumnGroup grp in dataSet.ColumnGroups)
+ foreach (ColumnBase col in grp.Columns)
+ sb.Append(col.Name + ';');
+ sb.Remove(sb.Length - 1, 1);
+ sb.Append(Environment.NewLine);
+ stream.Write(sb);
+ sb.Remove(0, sb.Length);
+ }
+
+ IComparable value;
+ for (int i = 0; i < dataSet.ColumnGroups.Max(x => x.RowCount); i++) {
+ foreach (ColumnGroup grp in dataSet.ColumnGroups) {
+ foreach (ColumnBase col in grp.Columns) {
+ value = col.GetValue(i);
+ if (value == null)
+ sb.Append(';');
+ else if (value is double)
+ sb.Append(((double)value).ToString(CultureInfo.InvariantCulture) + ';');
+ else
+ sb.Append(value.ToString() + ';');
+ }
+ } //foreach columngroup
+ sb.Remove(sb.Length - 1, 1);
+ sb.Append(Environment.NewLine);
+ if (i % 100 == 0) {
+ stream.Write(sb.ToString());
+ sb.Remove(0, sb.Length);
+ }
+ } //foreach row
+ stream.Write(sb);
+ }
+ stream.Close();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporterView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporterView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporterView.Designer.cs (revision 15690)
@@ -0,0 +1,114 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ partial class CsvExporterView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.chbIncludeColumnNames = new System.Windows.Forms.CheckBox();
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtFileName = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // chbIncludeColumnNames
+ //
+ this.chbIncludeColumnNames.AutoSize = true;
+ this.chbIncludeColumnNames.Checked = true;
+ this.chbIncludeColumnNames.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.chbIncludeColumnNames.Location = new System.Drawing.Point(54, 30);
+ this.chbIncludeColumnNames.Name = "chbIncludeColumnNames";
+ this.chbIncludeColumnNames.Size = new System.Drawing.Size(133, 17);
+ this.chbIncludeColumnNames.TabIndex = 3;
+ this.chbIncludeColumnNames.Text = "Include Column names";
+ this.chbIncludeColumnNames.UseVisualStyleBackColor = true;
+ //
+ // btnBrowse
+ //
+ this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowse.Location = new System.Drawing.Point(323, 3);
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(75, 23);
+ this.btnBrowse.TabIndex = 17;
+ this.btnBrowse.Text = "Browse";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(1, 7);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(49, 13);
+ this.label1.TabIndex = 16;
+ this.label1.Text = "Filename";
+ //
+ // txtFileName
+ //
+ this.txtFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtFileName.Location = new System.Drawing.Point(54, 4);
+ this.txtFileName.Name = "txtFileName";
+ this.txtFileName.Size = new System.Drawing.Size(263, 20);
+ this.txtFileName.TabIndex = 15;
+ //
+ // CsvExporterView
+ //
+ this.Controls.Add(this.btnBrowse);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtFileName);
+ this.Controls.Add(this.chbIncludeColumnNames);
+ this.Name = "CsvExporterView";
+ this.Size = new System.Drawing.Size(400, 57);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.CheckBox chbIncludeColumnNames;
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtFileName;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporterView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporterView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvExporterView.cs (revision 15690)
@@ -0,0 +1,56 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ public partial class CsvExporterView : UserControl {
+ private SaveFileDialog saveFileDialog;
+ public CsvExporterView() {
+ InitializeComponent();
+ this.saveFileDialog = new SaveFileDialog();
+ saveFileDialog.AddExtension = true;
+ saveFileDialog.RestoreDirectory = true;
+ saveFileDialog.DefaultExt = "csv";
+ saveFileDialog.Filter = "Comma-Separated-Values file (*.csv)|*.csv|All files (*.*)|*.*";
+ }
+
+ public string FileName {
+ get { return txtFileName.Text; }
+ }
+
+ public bool IncludeColumnNames {
+ get { return this.chbIncludeColumnNames.Checked; }
+ }
+
+ private void btnBrowse_Click(object sender, EventArgs e) {
+ if (saveFileDialog.ShowDialog() == DialogResult.OK) {
+ this.txtFileName.Text = saveFileDialog.FileName;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImportCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImportCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImportCommand.cs (revision 15690)
@@ -0,0 +1,97 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.IO;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ [StorableClass]
+ public class CsvImportCommand : DataSetCommandBase {
+ private ColumnGroup newColumnGroup;
+
+ [StorableConstructor]
+ protected CsvImportCommand(bool deserializing) : base(deserializing) { }
+
+ public CsvImportCommand(DataSet dataSet)
+ : base(dataSet) {
+ }
+
+ [Storable]
+ private string fileName;
+ public string FileName {
+ get { return fileName; }
+ set { this.fileName = value; }
+ }
+
+ [Storable]
+ private char[] delimiter;
+ public char[] Delimiter {
+ get { return this.delimiter; }
+ set { this.delimiter = value; }
+ }
+
+ [Storable]
+ private bool columnNamesInFirstRow;
+ public bool ColumnNamesInFirstRow {
+ get { return this.columnNamesInFirstRow; }
+ set { this.columnNamesInFirstRow = value; }
+ }
+
+ public override string Description {
+ get { return "Import CSV file"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ newColumnGroup = new ColumnGroup(fileName.Substring(fileName.LastIndexOf('\\') + 1));
+ StreamReader reader = new StreamReader(fileName);
+ string firstLine = reader.ReadLine();
+
+ int i = 1;
+ string[] values = firstLine.Split(delimiter);
+ foreach (string value in values) {
+ if (columnNamesInFirstRow)
+ newColumnGroup.AddColumn(new StringColumn(value));
+ else {
+ newColumnGroup.AddColumn(new StringColumn("Column " + i));
+ }
+ i++;
+ }
+ if (!columnNamesInFirstRow)
+ newColumnGroup.AddRow(values);
+ while (!reader.EndOfStream) {
+ newColumnGroup.AddRow(reader.ReadLine().Split(delimiter));
+ }
+ reader.Close();
+ DataSet.AddColumnGroup(newColumnGroup);
+ DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DataSet.RemoveColumnGroup(newColumnGroup);
+ newColumnGroup = null;
+ DataSet.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporter.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporter.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporter.cs (revision 15690)
@@ -0,0 +1,50 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.DataImporter.DataProcessor;
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ public class CsvImporter : IImporter {
+
+ public string Description {
+ get { return "Import CSV file"; }
+ }
+
+ private CsvImporterView view;
+ public System.Windows.Forms.UserControl SettingsControl {
+ get {
+ if (view == null)
+ view = new CsvImporterView();
+ return view;
+ }
+ }
+
+ public ICommand CreateImportCommand(DataSet dataSet) {
+ CsvImportCommand cmd = new CsvImportCommand(dataSet);
+ cmd.FileName = view.FileName;
+ cmd.ColumnNamesInFirstRow = view.ColumnNamesInFirstRow;
+ cmd.Delimiter = view.Delimiter;
+ return cmd;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporterView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporterView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporterView.Designer.cs (revision 15690)
@@ -0,0 +1,137 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ partial class CsvImporterView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.chbIncludeColumnNames = new System.Windows.Forms.CheckBox();
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtFileName = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtDelimiter = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // chbIncludeColumnNames
+ //
+ this.chbIncludeColumnNames.AutoSize = true;
+ this.chbIncludeColumnNames.Checked = true;
+ this.chbIncludeColumnNames.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.chbIncludeColumnNames.Location = new System.Drawing.Point(54, 56);
+ this.chbIncludeColumnNames.Name = "chbIncludeColumnNames";
+ this.chbIncludeColumnNames.Size = new System.Drawing.Size(151, 17);
+ this.chbIncludeColumnNames.TabIndex = 3;
+ this.chbIncludeColumnNames.Text = "Column names in first row?";
+ this.chbIncludeColumnNames.UseVisualStyleBackColor = true;
+ //
+ // btnBrowse
+ //
+ this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowse.Location = new System.Drawing.Point(323, 3);
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(75, 23);
+ this.btnBrowse.TabIndex = 17;
+ this.btnBrowse.Text = "Browse";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(1, 7);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(49, 13);
+ this.label1.TabIndex = 16;
+ this.label1.Text = "Filename";
+ //
+ // txtFileName
+ //
+ this.txtFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtFileName.Location = new System.Drawing.Point(54, 4);
+ this.txtFileName.Name = "txtFileName";
+ this.txtFileName.Size = new System.Drawing.Size(263, 20);
+ this.txtFileName.TabIndex = 15;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(1, 33);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(47, 13);
+ this.label2.TabIndex = 21;
+ this.label2.Text = "Delimiter";
+ //
+ // txtDelimiter
+ //
+ this.txtDelimiter.Location = new System.Drawing.Point(54, 30);
+ this.txtDelimiter.MaxLength = 1;
+ this.txtDelimiter.Name = "txtDelimiter";
+ this.txtDelimiter.Size = new System.Drawing.Size(66, 20);
+ this.txtDelimiter.TabIndex = 20;
+ //
+ // CsvImporterView
+ //
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.txtDelimiter);
+ this.Controls.Add(this.btnBrowse);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtFileName);
+ this.Controls.Add(this.chbIncludeColumnNames);
+ this.Name = "CsvImporterView";
+ this.Size = new System.Drawing.Size(400, 83);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.CheckBox chbIncludeColumnNames;
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtFileName;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtDelimiter;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporterView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporterView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/CsvImporterView.cs (revision 15690)
@@ -0,0 +1,61 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ public partial class CsvImporterView : UserControl {
+ private OpenFileDialog openFileDialog;
+ public CsvImporterView() {
+ InitializeComponent();
+ this.openFileDialog = new OpenFileDialog();
+ openFileDialog.AddExtension = true;
+ openFileDialog.RestoreDirectory = true;
+ openFileDialog.DefaultExt = "csv";
+ openFileDialog.Filter = "Comma-Separated-Values file (*.csv)|*.csv|All files (*.*)|*.*";
+ txtDelimiter.Text = ";";
+ }
+
+ public string FileName {
+ get { return txtFileName.Text; }
+ }
+
+ public bool ColumnNamesInFirstRow {
+ get { return this.chbIncludeColumnNames.Checked; }
+ }
+
+ public char[] Delimiter {
+ get { return new char[] { txtDelimiter.Text[0] }; }
+ }
+
+ private void btnBrowse_Click(object sender, EventArgs e) {
+ if (openFileDialog.ShowDialog() == DialogResult.OK) {
+ this.txtFileName.Text = openFileDialog.FileName;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/HeuristicLab.DataImporter.Backend.Csv.csproj
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/HeuristicLab.DataImporter.Backend.Csv.csproj (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/HeuristicLab.DataImporter.Backend.Csv.csproj (revision 15690)
@@ -0,0 +1,192 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {F83B3E02-FCAA-46CA-8712-C41B960D19C3}
+ Library
+ Properties
+ HeuristicLab.DataImporter.Backend.Csv
+ HeuristicLab.DataImporter.Backend.Csv-1.0
+ v4.5
+ 512
+ true
+ HeuristicLab.snk
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ ..\..\..\trunk\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ ..\..\..\trunk\bin
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll
+ False
+
+
+ ..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll
+ False
+
+
+
+ 3.5
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ CsvImporterView.cs
+
+
+
+ UserControl
+
+
+ CsvExporterView.cs
+
+
+
+
+
+
+
+
+
+
+
+ {D7EE47DB-4D07-4BAC-9E9F-3F0393AEF605}
+ HeuristicLab.DataImporter.DataProcessor
+ False
+
+
+ {4A0EE09A-6D8A-458A-8FB0-3D18F88F7FEE}
+ HeuristicLab.DataImporter.Data
+ False
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+
+
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/Plugin.cs.frame
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/Plugin.cs.frame (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/Plugin.cs.frame (revision 15690)
@@ -0,0 +1,35 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.DataImporter.Backend.Csv {
+ [Plugin("HeuristicLab.DataImporter.Backend.Csv","1.0.0.$WCREV$")]
+ [PluginFile("HeuristicLab.DataImporter.Backend.Csv-1.0.dll", PluginFileType.Assembly)]
+ [PluginDependency("HeuristicLab.DataImporter.DataProcessor","1.0")]
+ [PluginDependency("HeuristicLab.Persistence","3.3")]
+ public class HeuristicLabDataImporterBackendCsvPlugin : PluginBase {
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/Properties/AssemblyInfo.cs.frame
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/Properties/AssemblyInfo.cs.frame (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Csv/Properties/AssemblyInfo.cs.frame (revision 15690)
@@ -0,0 +1,57 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HeuristicLab.PluginInfrastructure;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.DataImporter.Backends.Csv")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(C) 2008-2012 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7d0840b8-3382-4b99-ab4e-5d1eb91fbec1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.$WCREV$")]
+[assembly: AssemblyFileVersion("1.0.0.$WCREV$")]
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat.csproj
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat.csproj (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat.csproj (revision 15690)
@@ -0,0 +1,193 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {67E69744-D0D3-48C3-8F9D-51EE1A64E3F6}
+ Library
+ Properties
+ HeuristicLab.DataImporter.Backend.Hl2ImporterFormat
+ HeuristicLab.DataImporter.Backend.Hl2ImporterFormat-1.0
+ v4.5
+ 512
+ true
+ HeuristicLab.snk
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ ..\..\..\trunk\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ ..\..\..\trunk\bin
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll
+ False
+
+
+ ..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll
+ False
+
+
+
+ 3.5
+
+
+
+
+ 3.5
+
+
+ 3.5
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ Hl2ImporterView.cs
+
+
+
+
+ UserControl
+
+
+ Hl2ExporterView.cs
+
+
+
+
+
+
+ {D7EE47DB-4D07-4BAC-9E9F-3F0393AEF605}
+ HeuristicLab.DataImporter.DataProcessor
+ False
+
+
+ {4A0EE09A-6D8A-458A-8FB0-3D18F88F7FEE}
+ HeuristicLab.DataImporter.Data
+ False
+
+
+
+
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\HeuristicLabDataImporterBackendHl2ImporterFormatPlugin.cs.frame" "%25ProjectDir%25\HeuristicLabDataImporterBackendHl2ImporterFormatPlugin.cs"
+
+
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/HeuristicLabDataImporterBackendHl2ImporterFormatPlugin.cs.frame
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/HeuristicLabDataImporterBackendHl2ImporterFormatPlugin.cs.frame (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/HeuristicLabDataImporterBackendHl2ImporterFormatPlugin.cs.frame (revision 15690)
@@ -0,0 +1,35 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ [Plugin("HeuristicLab.DataImporter.Backend.Hl2ImporterFormat","1.0.0.$WCREV$")]
+ [PluginFile("HeuristicLab.DataImporter.Backend.Hl2ImporterFormat-1.0.dll", PluginFileType.Assembly)]
+ [PluginDependency("HeuristicLab.DataImporter.DataProcessor","1.0")]
+ [PluginDependency("HeuristicLab.Persistence","3.3")]
+ public class HeuristicLabDataImporterBackendHl2ImporterFormatPlugin : PluginBase {
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2Exporter.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2Exporter.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2Exporter.cs (revision 15690)
@@ -0,0 +1,112 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.IO;
+using System.Globalization;
+using HeuristicLab.DataImporter.DataProcessor;
+using HeuristicLab.DataImporter.Data.Model;
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ public class Hl2Exporter : IExporter {
+ public const string METATAG = "@";
+ public const string PROBLEMNAME = "PROBLEMNAME";
+ public const string VARIABLENAMES = "VARIABLENAMES";
+ public const string TARGETVARIABLE = "TARGETVARIABLE";
+ public const string NONINPUTVARIABLES = "NONINPUTVARIABLES";
+ public const string MINIMUMTIMEOFFSET = "MINIMUMTIMEOFFSET";
+ public const string MAXIMUMTIMEOFFSET = "MAXIMUMTIMEOFFSET";
+ public const string MAXIMUMTREEHEIGHT = "MAXIMUMTREEHEIGHT";
+ public const string MAXIMUMTREESIZE = "MAXIMUMTREESIZE";
+ public const string TRAININGSAMPLESSTART = "TRAININGSAMPLESSTART";
+ public const string TRAININGSAMPLESEND = "TRAININGSAMPLESEND";
+ public const string VALIDATIONSAMPLESSTART = "VALIDATIONSAMPLESSTART";
+ public const string VALIDATIONSAMPLESEND = "VALIDATIONSAMPLESEND";
+ public const string TESTSAMPLESSTART = "TESTSAMPLESSTART";
+ public const string TESTSAMPLESEND = "TESTSAMPLESEND";
+
+
+ public string Description {
+ get { return "Export data as HL2 importer file"; }
+ }
+
+ private Hl2ExporterView view;
+ public System.Windows.Forms.UserControl SettingsControl {
+ get {
+ if (view == null)
+ view = new Hl2ExporterView();
+ return view;
+ }
+ }
+
+ public void Export(DataSet dataSet) {
+ StreamWriter stream = new StreamWriter(view.FileName, false);
+ stream.WriteLine(METATAG + PROBLEMNAME + '=' + view.ProblemName);
+ StringBuilder sb = new StringBuilder();
+ foreach (ColumnGroup grp in dataSet.ColumnGroups) {
+ foreach (ColumnBase col in grp.Columns)
+ sb.Append(col.Name + ';');
+ }
+ sb = sb.Remove(sb.Length - 1, 1); //remove last ';'
+ stream.WriteLine(METATAG + VARIABLENAMES + '=' + sb.ToString());
+ sb = sb.Remove(0, sb.Length);
+ stream.WriteLine(METATAG + TARGETVARIABLE + '=' + view.TargetVariable);
+ stream.WriteLine(METATAG + NONINPUTVARIABLES + '=' + view.NonInputVariables);
+ stream.WriteLine(METATAG + MINIMUMTIMEOFFSET + '=' + view.MinimumTimeOffset);
+ stream.WriteLine(METATAG + MAXIMUMTIMEOFFSET + '=' + view.MaximumTimeOffset);
+ stream.WriteLine(METATAG + MAXIMUMTREEHEIGHT + '=' + view.MaximumTreeHeight);
+ stream.WriteLine(METATAG + MAXIMUMTREESIZE + '=' + view.MaximumTreeSize);
+ stream.WriteLine(METATAG + TRAININGSAMPLESSTART + '=' + view.TrainingStart);
+ stream.WriteLine(METATAG + TRAININGSAMPLESEND + '=' + view.TrainingEnd);
+ stream.WriteLine(METATAG + VALIDATIONSAMPLESSTART + '=' + view.ValidationStart);
+ stream.WriteLine(METATAG + VALIDATIONSAMPLESEND + '=' + view.ValidationEnd);
+ stream.WriteLine(METATAG + TESTSAMPLESSTART + '=' + view.TestStart);
+ stream.WriteLine(METATAG + TESTSAMPLESEND + '=' + view.TestEnd);
+
+ for (int i = 0; i < dataSet.ColumnGroups.Max(x => x.RowCount); i++) {
+ foreach (ColumnGroup grp in dataSet.ColumnGroups) {
+ foreach (ColumnBase col in grp.Columns) {
+ if (col.GetValue(i) == null)
+ sb.Append(';');
+ else if (col.DataType == typeof(double?))
+ sb.Append(((double)col.GetValue(i)).ToString("r", CultureInfo.InvariantCulture.NumberFormat) + ';');
+ else if (col.DataType == typeof(DateTime?))
+ sb.Append(((DateTime)col.GetValue(i)).ToString(CultureInfo.InvariantCulture.DateTimeFormat) + ';');
+ else
+ sb.Append(col.GetValue(i).ToString() + ';');
+ }
+ } //foreach columngroup
+ sb = sb.Remove(sb.Length - 1, 1);
+ sb.Append(Environment.NewLine);
+ if (i % 100 == 0) {
+ stream.Write(sb.ToString());
+ sb.Remove(0, sb.Length);
+ }
+ } //foreach row
+ stream.Write(sb);
+ stream.Close();
+ }
+
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ExporterView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ExporterView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ExporterView.Designer.cs (revision 15690)
@@ -0,0 +1,421 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ partial class Hl2ExporterView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.txtProblemName = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.txtNonInputVariables = new System.Windows.Forms.TextBox();
+ this.txtMinimumTimeOffset = new System.Windows.Forms.TextBox();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.label7 = new System.Windows.Forms.Label();
+ this.label8 = new System.Windows.Forms.Label();
+ this.txtMaximumTimeOffset = new System.Windows.Forms.TextBox();
+ this.txtMaximumTreeHeight = new System.Windows.Forms.TextBox();
+ this.txtMaximumTreeSize = new System.Windows.Forms.TextBox();
+ this.label9 = new System.Windows.Forms.Label();
+ this.label10 = new System.Windows.Forms.Label();
+ this.label11 = new System.Windows.Forms.Label();
+ this.txtTrainingStart = new System.Windows.Forms.TextBox();
+ this.txtTrainingEnd = new System.Windows.Forms.TextBox();
+ this.txtValidationEnd = new System.Windows.Forms.TextBox();
+ this.txtValidationStart = new System.Windows.Forms.TextBox();
+ this.label12 = new System.Windows.Forms.Label();
+ this.label13 = new System.Windows.Forms.Label();
+ this.label14 = new System.Windows.Forms.Label();
+ this.txtTestEnd = new System.Windows.Forms.TextBox();
+ this.txtTestStart = new System.Windows.Forms.TextBox();
+ this.label15 = new System.Windows.Forms.Label();
+ this.label16 = new System.Windows.Forms.Label();
+ this.label17 = new System.Windows.Forms.Label();
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtFileName = new System.Windows.Forms.TextBox();
+ this.txtTargetVariable = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // txtProblemName
+ //
+ this.txtProblemName.Location = new System.Drawing.Point(177, 30);
+ this.txtProblemName.Name = "txtProblemName";
+ this.txtProblemName.Size = new System.Drawing.Size(140, 20);
+ this.txtProblemName.TabIndex = 1;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(51, 33);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(71, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Problemname";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(51, 58);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(79, 13);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "Target Variable";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(51, 84);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(100, 13);
+ this.label4.TabIndex = 7;
+ this.label4.Text = "Non-Input Variables";
+ //
+ // txtNonInputVariables
+ //
+ this.txtNonInputVariables.Location = new System.Drawing.Point(177, 81);
+ this.txtNonInputVariables.Name = "txtNonInputVariables";
+ this.txtNonInputVariables.Size = new System.Drawing.Size(140, 20);
+ this.txtNonInputVariables.TabIndex = 3;
+ //
+ // txtMinimumTimeOffset
+ //
+ this.txtMinimumTimeOffset.Location = new System.Drawing.Point(177, 106);
+ this.txtMinimumTimeOffset.Name = "txtMinimumTimeOffset";
+ this.txtMinimumTimeOffset.Size = new System.Drawing.Size(140, 20);
+ this.txtMinimumTimeOffset.TabIndex = 4;
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(51, 109);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(105, 13);
+ this.label5.TabIndex = 10;
+ this.label5.Text = "Minimum Time Offset";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(51, 134);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(108, 13);
+ this.label6.TabIndex = 11;
+ this.label6.Text = "Maximum Time Offset";
+ //
+ // label7
+ //
+ this.label7.AutoSize = true;
+ this.label7.Location = new System.Drawing.Point(51, 159);
+ this.label7.Name = "label7";
+ this.label7.Size = new System.Drawing.Size(110, 13);
+ this.label7.TabIndex = 12;
+ this.label7.Text = "Maximum Tree Height";
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Location = new System.Drawing.Point(51, 184);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(99, 13);
+ this.label8.TabIndex = 13;
+ this.label8.Text = "Maximum Tree Size";
+ //
+ // txtMaximumTimeOffset
+ //
+ this.txtMaximumTimeOffset.Location = new System.Drawing.Point(177, 131);
+ this.txtMaximumTimeOffset.Name = "txtMaximumTimeOffset";
+ this.txtMaximumTimeOffset.Size = new System.Drawing.Size(140, 20);
+ this.txtMaximumTimeOffset.TabIndex = 5;
+ //
+ // txtMaximumTreeHeight
+ //
+ this.txtMaximumTreeHeight.Location = new System.Drawing.Point(177, 156);
+ this.txtMaximumTreeHeight.Name = "txtMaximumTreeHeight";
+ this.txtMaximumTreeHeight.Size = new System.Drawing.Size(140, 20);
+ this.txtMaximumTreeHeight.TabIndex = 6;
+ //
+ // txtMaximumTreeSize
+ //
+ this.txtMaximumTreeSize.Location = new System.Drawing.Point(177, 181);
+ this.txtMaximumTreeSize.Name = "txtMaximumTreeSize";
+ this.txtMaximumTreeSize.Size = new System.Drawing.Size(140, 20);
+ this.txtMaximumTreeSize.TabIndex = 7;
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Location = new System.Drawing.Point(51, 209);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(45, 13);
+ this.label9.TabIndex = 14;
+ this.label9.Text = "Training";
+ //
+ // label10
+ //
+ this.label10.AutoSize = true;
+ this.label10.Location = new System.Drawing.Point(130, 210);
+ this.label10.Name = "label10";
+ this.label10.Size = new System.Drawing.Size(29, 13);
+ this.label10.TabIndex = 15;
+ this.label10.Text = "Start";
+ //
+ // label11
+ //
+ this.label11.AutoSize = true;
+ this.label11.Location = new System.Drawing.Point(241, 210);
+ this.label11.Name = "label11";
+ this.label11.Size = new System.Drawing.Size(26, 13);
+ this.label11.TabIndex = 16;
+ this.label11.Text = "End";
+ //
+ // txtTrainingStart
+ //
+ this.txtTrainingStart.Location = new System.Drawing.Point(177, 207);
+ this.txtTrainingStart.Name = "txtTrainingStart";
+ this.txtTrainingStart.Size = new System.Drawing.Size(44, 20);
+ this.txtTrainingStart.TabIndex = 8;
+ //
+ // txtTrainingEnd
+ //
+ this.txtTrainingEnd.Location = new System.Drawing.Point(273, 207);
+ this.txtTrainingEnd.Name = "txtTrainingEnd";
+ this.txtTrainingEnd.Size = new System.Drawing.Size(44, 20);
+ this.txtTrainingEnd.TabIndex = 9;
+ //
+ // txtValidationEnd
+ //
+ this.txtValidationEnd.Location = new System.Drawing.Point(273, 233);
+ this.txtValidationEnd.Name = "txtValidationEnd";
+ this.txtValidationEnd.Size = new System.Drawing.Size(44, 20);
+ this.txtValidationEnd.TabIndex = 11;
+ //
+ // txtValidationStart
+ //
+ this.txtValidationStart.Location = new System.Drawing.Point(177, 233);
+ this.txtValidationStart.Name = "txtValidationStart";
+ this.txtValidationStart.Size = new System.Drawing.Size(44, 20);
+ this.txtValidationStart.TabIndex = 10;
+ //
+ // label12
+ //
+ this.label12.AutoSize = true;
+ this.label12.Location = new System.Drawing.Point(241, 236);
+ this.label12.Name = "label12";
+ this.label12.Size = new System.Drawing.Size(26, 13);
+ this.label12.TabIndex = 24;
+ this.label12.Text = "End";
+ //
+ // label13
+ //
+ this.label13.AutoSize = true;
+ this.label13.Location = new System.Drawing.Point(130, 236);
+ this.label13.Name = "label13";
+ this.label13.Size = new System.Drawing.Size(29, 13);
+ this.label13.TabIndex = 23;
+ this.label13.Text = "Start";
+ //
+ // label14
+ //
+ this.label14.AutoSize = true;
+ this.label14.Location = new System.Drawing.Point(51, 235);
+ this.label14.Name = "label14";
+ this.label14.Size = new System.Drawing.Size(53, 13);
+ this.label14.TabIndex = 22;
+ this.label14.Text = "Validation";
+ //
+ // txtTestEnd
+ //
+ this.txtTestEnd.Location = new System.Drawing.Point(273, 259);
+ this.txtTestEnd.Name = "txtTestEnd";
+ this.txtTestEnd.Size = new System.Drawing.Size(44, 20);
+ this.txtTestEnd.TabIndex = 13;
+ //
+ // txtTestStart
+ //
+ this.txtTestStart.Location = new System.Drawing.Point(177, 259);
+ this.txtTestStart.Name = "txtTestStart";
+ this.txtTestStart.Size = new System.Drawing.Size(44, 20);
+ this.txtTestStart.TabIndex = 12;
+ //
+ // label15
+ //
+ this.label15.AutoSize = true;
+ this.label15.Location = new System.Drawing.Point(241, 262);
+ this.label15.Name = "label15";
+ this.label15.Size = new System.Drawing.Size(26, 13);
+ this.label15.TabIndex = 29;
+ this.label15.Text = "End";
+ //
+ // label16
+ //
+ this.label16.AutoSize = true;
+ this.label16.Location = new System.Drawing.Point(130, 262);
+ this.label16.Name = "label16";
+ this.label16.Size = new System.Drawing.Size(29, 13);
+ this.label16.TabIndex = 28;
+ this.label16.Text = "Start";
+ //
+ // label17
+ //
+ this.label17.AutoSize = true;
+ this.label17.Location = new System.Drawing.Point(51, 261);
+ this.label17.Name = "label17";
+ this.label17.Size = new System.Drawing.Size(28, 13);
+ this.label17.TabIndex = 27;
+ this.label17.Text = "Test";
+ //
+ // btnBrowse
+ //
+ this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowse.Location = new System.Drawing.Point(323, 3);
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(75, 23);
+ this.btnBrowse.TabIndex = 14;
+ this.btnBrowse.Text = "Browse";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(1, 7);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(49, 13);
+ this.label1.TabIndex = 2;
+ this.label1.Text = "Filename";
+ //
+ // txtFileName
+ //
+ this.txtFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtFileName.Location = new System.Drawing.Point(54, 4);
+ this.txtFileName.Name = "txtFileName";
+ this.txtFileName.Size = new System.Drawing.Size(263, 20);
+ this.txtFileName.TabIndex = 0;
+ //
+ // txtTargetVariable
+ //
+ this.txtTargetVariable.Location = new System.Drawing.Point(177, 55);
+ this.txtTargetVariable.Name = "txtTargetVariable";
+ this.txtTargetVariable.Size = new System.Drawing.Size(140, 20);
+ this.txtTargetVariable.TabIndex = 2;
+ //
+ // Hl2ExporterView
+ //
+ this.Controls.Add(this.txtTargetVariable);
+ this.Controls.Add(this.btnBrowse);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtFileName);
+ this.Controls.Add(this.txtTestEnd);
+ this.Controls.Add(this.txtTestStart);
+ this.Controls.Add(this.label15);
+ this.Controls.Add(this.label16);
+ this.Controls.Add(this.label17);
+ this.Controls.Add(this.txtValidationEnd);
+ this.Controls.Add(this.txtValidationStart);
+ this.Controls.Add(this.label12);
+ this.Controls.Add(this.label13);
+ this.Controls.Add(this.label14);
+ this.Controls.Add(this.txtTrainingEnd);
+ this.Controls.Add(this.txtTrainingStart);
+ this.Controls.Add(this.txtMaximumTreeSize);
+ this.Controls.Add(this.txtMaximumTreeHeight);
+ this.Controls.Add(this.txtMaximumTimeOffset);
+ this.Controls.Add(this.label11);
+ this.Controls.Add(this.label10);
+ this.Controls.Add(this.label9);
+ this.Controls.Add(this.label8);
+ this.Controls.Add(this.label7);
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.txtMinimumTimeOffset);
+ this.Controls.Add(this.txtNonInputVariables);
+ this.Controls.Add(this.txtProblemName);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label4);
+ this.Name = "Hl2ExporterView";
+ this.Size = new System.Drawing.Size(401, 293);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtProblemName;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.TextBox txtNonInputVariables;
+ private System.Windows.Forms.TextBox txtMinimumTimeOffset;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.Label label7;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.TextBox txtMaximumTimeOffset;
+ private System.Windows.Forms.TextBox txtMaximumTreeHeight;
+ private System.Windows.Forms.TextBox txtMaximumTreeSize;
+ private System.Windows.Forms.Label label9;
+ private System.Windows.Forms.Label label10;
+ private System.Windows.Forms.Label label11;
+ private System.Windows.Forms.TextBox txtTrainingStart;
+ private System.Windows.Forms.TextBox txtTrainingEnd;
+ private System.Windows.Forms.TextBox txtValidationEnd;
+ private System.Windows.Forms.TextBox txtValidationStart;
+ private System.Windows.Forms.Label label12;
+ private System.Windows.Forms.Label label13;
+ private System.Windows.Forms.Label label14;
+ private System.Windows.Forms.TextBox txtTestEnd;
+ private System.Windows.Forms.TextBox txtTestStart;
+ private System.Windows.Forms.Label label15;
+ private System.Windows.Forms.Label label16;
+ private System.Windows.Forms.Label label17;
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtFileName;
+ private System.Windows.Forms.TextBox txtTargetVariable;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ExporterView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ExporterView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ExporterView.cs (revision 15690)
@@ -0,0 +1,105 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ public partial class Hl2ExporterView : UserControl {
+ private SaveFileDialog saveFileDialog;
+ public Hl2ExporterView() {
+ InitializeComponent();
+ this.saveFileDialog = new SaveFileDialog();
+ saveFileDialog.AddExtension = true;
+ saveFileDialog.RestoreDirectory = true;
+ saveFileDialog.DefaultExt = "hl2";
+ saveFileDialog.Filter = "HL2-Importer file (*.hl2)|*.hl2|All files (*.*)|*.*";
+ }
+
+ public string FileName {
+ get { return txtFileName.Text; }
+ }
+
+ public string ProblemName {
+ get { return txtProblemName.Text; }
+ }
+
+ public string TargetVariable {
+ get { return txtTargetVariable.Text; }
+ }
+
+ public string NonInputVariables {
+ get { return txtNonInputVariables.Text; }
+ }
+
+ public string MinimumTimeOffset {
+ get { return txtMinimumTimeOffset.Text; }
+ }
+
+ public string MaximumTimeOffset {
+ get { return txtMaximumTimeOffset.Text; }
+ }
+
+ public string MaximumTreeHeight {
+ get { return txtMaximumTreeHeight.Text; }
+ }
+
+ public string MaximumTreeSize {
+ get { return txtMaximumTreeSize.Text; }
+ }
+
+ public string TrainingStart {
+ get { return txtTrainingStart.Text; }
+ }
+
+ public string TrainingEnd {
+ get { return txtTrainingEnd.Text; }
+ }
+
+ public string ValidationStart {
+ get { return txtValidationStart.Text; }
+ }
+
+ public string ValidationEnd {
+ get { return txtValidationEnd.Text; }
+ }
+
+ public string TestStart {
+ get { return txtTestStart.Text; }
+ }
+
+ public string TestEnd {
+ get { return txtTestEnd.Text; }
+ }
+
+ private void btnBrowse_Click(object sender, EventArgs e) {
+ if (saveFileDialog.ShowDialog() == DialogResult.OK) {
+ this.txtFileName.Text = saveFileDialog.FileName;
+ }
+ }
+
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2Importer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2Importer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2Importer.cs (revision 15690)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.DataImporter.DataProcessor;
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ public class Hl2Importer : IImporter {
+
+ public string Description {
+ get { return "Import HL2 file"; }
+ }
+
+ Hl2ImporterView view;
+ public System.Windows.Forms.UserControl SettingsControl {
+ get {
+ if (view == null)
+ view = new Hl2ImporterView();
+ return view;
+ }
+ }
+
+ public ICommand CreateImportCommand(DataSet dataSet) {
+ Hl2ImporterCommand cmd = new Hl2ImporterCommand(dataSet);
+ cmd.FileName = view.FileName;
+ return cmd;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterCommand.cs (revision 15690)
@@ -0,0 +1,88 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.IO;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ [StorableClass]
+ public class Hl2ImporterCommand : DataSetCommandBase {
+ private ColumnGroup newColumnGroup;
+
+ [StorableConstructor]
+ protected Hl2ImporterCommand(bool deserializing) : base(deserializing) { }
+
+ public Hl2ImporterCommand(DataSet dataSet)
+ : base(dataSet) {
+ }
+
+ public override string Description {
+ get { return "Import HL2 file"; }
+ }
+
+ [Storable]
+ private string fileName;
+ public string FileName {
+ get { return fileName; }
+ set { this.fileName = value; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ newColumnGroup = new ColumnGroup(fileName.Substring(fileName.LastIndexOf('\\') + 1));
+ StreamReader reader = new StreamReader(fileName);
+ string firstLine = reader.ReadLine();
+ string[] variableNames = new string[0];
+
+ //skip meta information && extract variable/column names
+ while (firstLine.Trim()[0] == Hl2Exporter.METATAG[0]) {
+ if (firstLine.Contains(Hl2Exporter.VARIABLENAMES)) {
+ firstLine = firstLine.Replace(Hl2Exporter.METATAG + Hl2Exporter.VARIABLENAMES + "=", "");
+ variableNames = firstLine.Split(new char[] { ';' });
+ }
+ firstLine = reader.ReadLine();
+ }
+ string[] values = firstLine.Split(new char[] { ';' });
+ for (int i = 0; i < values.Length; i++) {
+ if (i < variableNames.Length)
+ newColumnGroup.AddColumn(new StringColumn(variableNames[i]));
+ else
+ newColumnGroup.AddColumn(new StringColumn("Column " + i));
+ }
+
+ while (!reader.EndOfStream) {
+ newColumnGroup.AddRow(reader.ReadLine().Split(new char[] { ';' }));
+ }
+ reader.Close();
+ DataSet.AddColumnGroup(newColumnGroup);
+ DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DataSet.RemoveColumnGroup(newColumnGroup);
+ newColumnGroup = null;
+ DataSet.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterView.Designer.cs (revision 15690)
@@ -0,0 +1,99 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ partial class Hl2ImporterView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.btnBrowse = new System.Windows.Forms.Button();
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtFileName = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // btnBrowse
+ //
+ this.btnBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
+ this.btnBrowse.Location = new System.Drawing.Point(323, 3);
+ this.btnBrowse.Name = "btnBrowse";
+ this.btnBrowse.Size = new System.Drawing.Size(75, 23);
+ this.btnBrowse.TabIndex = 17;
+ this.btnBrowse.Text = "Browse";
+ this.btnBrowse.UseVisualStyleBackColor = true;
+ this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(1, 7);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(49, 13);
+ this.label1.TabIndex = 16;
+ this.label1.Text = "Filename";
+ //
+ // txtFileName
+ //
+ this.txtFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtFileName.Location = new System.Drawing.Point(54, 4);
+ this.txtFileName.Name = "txtFileName";
+ this.txtFileName.Size = new System.Drawing.Size(263, 20);
+ this.txtFileName.TabIndex = 15;
+ //
+ // Hl2ImporterView
+ //
+ this.Controls.Add(this.btnBrowse);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtFileName);
+ this.Name = "Hl2ImporterView";
+ this.Size = new System.Drawing.Size(400, 32);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Button btnBrowse;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtFileName;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Hl2ImporterView.cs (revision 15690)
@@ -0,0 +1,52 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Backend.Hl2ImporterFormat {
+ public partial class Hl2ImporterView : UserControl {
+ private OpenFileDialog openFileDialog;
+ public Hl2ImporterView() {
+ InitializeComponent();
+ this.openFileDialog = new OpenFileDialog();
+ openFileDialog.AddExtension = true;
+ openFileDialog.RestoreDirectory = true;
+ openFileDialog.DefaultExt = "hl2";
+ openFileDialog.Filter = "HL2-Importer file (*.hl2)|*.hl2|All files (*.*)|*.*";
+ }
+
+ public string FileName {
+ get { return txtFileName.Text; }
+ }
+
+ private void btnBrowse_Click(object sender, EventArgs e) {
+ if (openFileDialog.ShowDialog() == DialogResult.OK) {
+ this.txtFileName.Text = openFileDialog.FileName;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Properties/AssemblyInfo.cs.frame
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Properties/AssemblyInfo.cs.frame (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Backend.Hl2ImporterFormat/Properties/AssemblyInfo.cs.frame (revision 15690)
@@ -0,0 +1,57 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HeuristicLab.PluginInfrastructure;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.DataImporter.Backends.Hl2ImporterFormat")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(C) 2008-2012 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7d0840b8-3382-4b99-ab4e-5d1eb91fbec1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.$WCREV$")]
+[assembly: AssemblyFileVersion("1.0.0.$WCREV$")]
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateCommandBase.cs (revision 15690)
@@ -0,0 +1,130 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class AggregateCommandBase : ColumnGroupCommandWithAffectedColumnsBase {
+ [StorableConstructor]
+ protected AggregateCommandBase(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new List();
+ newColumns = new List();
+ positions = new List();
+ }
+
+ protected AggregateCommandBase(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldColumns = new List();
+ newColumns = new List();
+ positions = new List();
+ changeNullValuesOnly = true;
+ }
+
+ private List oldColumns;
+ protected List OldColumns {
+ get { return this.oldColumns; }
+ }
+
+ private List newColumns;
+ protected List NewColumns {
+ get { return this.newColumns; }
+ }
+
+ private List positions;
+ protected List Positions {
+ get { return this.positions; }
+ }
+
+ [Storable]
+ private bool changeNullValuesOnly;
+ public bool ChangeNullValueOnly {
+ get { return this.changeNullValuesOnly; }
+ set { this.changeNullValuesOnly = value; }
+ }
+
+ protected abstract IComparable AggregationFunction(ColumnBase col, int startIndex, int endIndex);
+
+ public override void Execute() {
+ base.Execute();
+ if (!ColumnGroup.Columns.Any()) return;
+ if (!ColumnGroup.Sorted)
+ throw new CommandExecutionException("ColumnGroup must be sorted to use aggregation commands.", this);
+ ColumnBase col;
+ for (int i = 0; i < AffectedColumns.Length; i++) {
+ col = ColumnGroup.Columns.ElementAt(AffectedColumns[i]);
+ if (col.DataType == typeof(double?) && !ColumnGroup.SortedColumnIndexes.Contains(AffectedColumns[i])) {
+ OldColumns.Add(col);
+ NewColumns.Add(col.CreateCopyOfColumnWithoutValues());
+ Positions.Add(AffectedColumns[i]);
+ }
+ }
+ IComparable keyValue = ColumnGroup.KeyString(0);
+ IComparable aggregatedValue;
+ int startIndex = 0;
+ int endIndex = -1;
+ for (int i = 1; i <= ColumnGroup.RowCount; i++) {
+ if (i == ColumnGroup.RowCount || keyValue.CompareTo(ColumnGroup.KeyString(i)) != 0) {
+ endIndex = i;
+ for (int colIndex = 0; colIndex < OldColumns.Count; colIndex++) {
+ aggregatedValue = AggregationFunction(OldColumns[colIndex], startIndex, endIndex);
+ //add aggregatedValue for each row with the same keyColumnValue
+ for (int j = startIndex; j < endIndex; j++) {
+ if (!changeNullValuesOnly || OldColumns[colIndex].GetValue(j) == null)
+ NewColumns[colIndex].AddValue(aggregatedValue);
+ else
+ NewColumns[colIndex].AddValue(OldColumns[colIndex].GetValue(j));
+ }
+ }
+ if (i != ColumnGroup.RowCount) {
+ startIndex = i;
+ keyValue = ColumnGroup.KeyString(i);
+ }
+ }
+ }
+
+ for (int i = 0; i < Positions.Count; i++) {
+ ColumnGroup.ReplaceColumn(Positions[i], NewColumns[i]);
+ OldColumns[i].Selected = false;
+ }
+ NewColumns.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < Positions.Count; i++) {
+ ColumnGroup.ReplaceColumn(Positions[i], OldColumns[i]);
+ }
+ OldColumns.Clear();
+ Positions.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMaxCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMaxCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMaxCommand.cs (revision 15690)
@@ -0,0 +1,58 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Maximum", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnNotSorted
+ , "Aggregation", Position = 4, OptionsView = typeof(AggregationCommandView))]
+ public class AggregateWithMaxCommand : AggregateCommandBase {
+ [StorableConstructor]
+ protected AggregateWithMaxCommand(bool deserializing) : base(deserializing) { }
+
+ public AggregateWithMaxCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Aggregate with max function"; }
+ }
+
+ protected override IComparable AggregationFunction(ColumnBase col, int startIndex, int endIndex) {
+ IComparable maxValue = null;
+ IComparable val;
+ for (int i = startIndex; i < endIndex; i++) {
+ val = col.GetValue(i);
+ if (val != null) {
+ if (maxValue == null || val.CompareTo(maxValue) > 0)
+ maxValue = val;
+ }
+ }
+ return maxValue;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMeanCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMeanCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMeanCommand.cs (revision 15690)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Mean", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnNotSorted,
+ "Aggregation", Position = 0, OptionsView = typeof(AggregationCommandView))]
+ public class AggregateWithMeanCommand : AggregateCommandBase {
+ [StorableConstructor]
+ protected AggregateWithMeanCommand(bool deserializing) : base(deserializing) { }
+
+ public AggregateWithMeanCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Aggregate with mean function"; }
+ }
+
+ protected override IComparable AggregationFunction(ColumnBase col, int startIndex, int endIndex) {
+ double value = 0;
+ IComparable val;
+ int cnt = 0;
+ for (int i = startIndex; i < endIndex; i++) {
+ val = col.GetValue(i);
+ if (val != null) {
+ value += (double)val;
+ cnt++;
+ }
+ }
+ return cnt != 0 ? value / cnt : (double?)null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMedianCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMedianCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMedianCommand.cs (revision 15690)
@@ -0,0 +1,52 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Median", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnNotSorted,
+ "Aggregation", Position = 1, OptionsView = typeof(AggregationCommandView))]
+ public class AggregateWithMedianCommand : AggregateCommandBase {
+ [StorableConstructor]
+ protected AggregateWithMedianCommand(bool deserializing) : base(deserializing) { }
+
+ public AggregateWithMedianCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Aggregate with median function"; }
+ }
+
+ protected override IComparable AggregationFunction(ColumnBase col, int startIndex, int endIndex) {
+ if (col is DoubleColumn)
+ return ((DoubleColumn)col).GetMedian(startIndex, endIndex);
+ else
+ return null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMinCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMinCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithMinCommand.cs (revision 15690)
@@ -0,0 +1,58 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Minimum", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnNotSorted,
+ "Aggregation", Position = 3, OptionsView = typeof(AggregationCommandView))]
+ public class AggregateWithMinCommand : AggregateCommandBase {
+ [StorableConstructor]
+ protected AggregateWithMinCommand(bool deserializing) : base(deserializing) { }
+
+ public AggregateWithMinCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Aggregate with min function"; }
+ }
+
+ protected override IComparable AggregationFunction(ColumnBase col, int startIndex, int endIndex) {
+ IComparable minValue = null;
+ IComparable val;
+ for (int i = startIndex; i < endIndex; i++) {
+ val = col.GetValue(i);
+ if (val != null) {
+ if (minValue == null || val.CompareTo(minValue) < 0)
+ minValue = val;
+ }
+ }
+ return minValue;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithSumCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithSumCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/AggregateWithSumCommand.cs (revision 15690)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Sum", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnNotSorted,
+ "Aggregation", Position = 2, OptionsView = typeof(AggregationCommandView))]
+ public class AggregateWithSumCommand : AggregateCommandBase {
+ [StorableConstructor]
+ protected AggregateWithSumCommand(bool deserializing) : base(deserializing) { }
+
+ public AggregateWithSumCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Aggregate with sum function"; }
+ }
+
+ protected override IComparable AggregationFunction(ColumnBase col, int startIndex, int endIndex) {
+ double value = 0;
+ bool allNull = true;
+ IComparable val;
+ for (int i = startIndex; i < endIndex; i++) {
+ val = col.GetValue(i);
+ if (val != null) {
+ allNull = false;
+ value += (double)val;
+ }
+ }
+ return allNull ? (double?)null : value;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/DeleteRowsWithDuplicateKeyValuesCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/DeleteRowsWithDuplicateKeyValuesCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Aggregation/DeleteRowsWithDuplicateKeyValuesCommand.cs (revision 15690)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete Rows", 1, ColumnGroupState.Sorted, "Aggregation", Position = 5)]
+ public class DeleteRowsWithDuplicateKeyValuesCommand : ColumnGroupCommandBase {
+ private Dictionary deletedRows;
+ [StorableConstructor]
+ protected DeleteRowsWithDuplicateKeyValuesCommand(bool deserializing)
+ : base(deserializing) {
+ deletedRows = new Dictionary();
+ }
+
+ public DeleteRowsWithDuplicateKeyValuesCommand(DataSet dataSet, string columnGroupName)
+ : base(dataSet, columnGroupName) {
+ deletedRows = new Dictionary();
+ }
+
+ public override string Description {
+ get { return "Delete rows with duplicate key values"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (!ColumnGroup.Columns.Any()) return;
+ if (!ColumnGroup.Sorted)
+ throw new CommandExecutionException("ColumnGroup must be sorted to delete rows with duplicate key.", this);
+
+ for (int i = 0; i < ColumnGroup.RowCount - 1; i++) {
+ if (ColumnGroup.KeyString(i) == ColumnGroup.KeyString(i + 1))
+ deletedRows[i + 1] = ColumnGroup.GetRow(i + 1);
+ }
+
+ foreach (int i in deletedRows.Keys.Reverse())
+ ColumnGroup.DeleteRow(i);
+
+ ColumnGroup.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair deletedRow in deletedRows)
+ ColumnGroup.InsertRow(deletedRow.Key, deletedRow.Value);
+ deletedRows.Clear();
+ ColumnGroup.FireChanged();
+
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewColumnCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewColumnCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewColumnCommandBase.cs (revision 15690)
@@ -0,0 +1,95 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Linq;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class AddNewColumnCommandBase : ColumnGroupCommandBase {
+ [StorableConstructor]
+ protected AddNewColumnCommandBase(bool deserializing) : base(deserializing) { }
+
+ protected AddNewColumnCommandBase(DataSet dataSet, string columnGroupName, string columnName, Type columnType)
+ : base(dataSet, columnGroupName) {
+ this.ColumnName = columnName;
+ if (!columnType.IsSubclassOf(typeof(ColumnBase)) || columnType == null)
+ throw new CommandExecutionException("Added Column must be a subtype of ColumnBase", this);
+ this.ColumnType = columnType;
+ }
+
+ private ColumnBase newColumn;
+ protected ColumnBase NewColumn {
+ get { return this.newColumn; }
+ set { this.newColumn = value; }
+ }
+
+ [Storable]
+ private int columnIndex = -1;
+ protected int ColumnIndex {
+ get { return this.columnIndex; }
+ set { this.columnIndex = value; }
+ }
+
+ [Storable]
+ private string columnName;
+ protected string ColumnName {
+ get { return this.columnName; }
+ set { this.columnName = value; }
+ }
+
+ [Storable]
+ private Type columnType;
+ protected Type ColumnType {
+ get { return this.columnType; }
+ set { this.columnType = value; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ newColumn = (ColumnBase)Activator.CreateInstance(ColumnType, new object[] { this.ColumnName });
+ newColumn.Resize(ColumnGroup.RowCount);
+
+ if (ColumnIndex == -1) {
+ ColumnBase cb = ColumnGroup.Columns.FirstOrDefault(x => x.Selected);
+ if (cb != null) ColumnIndex = ColumnGroup.IndexOfColumn(cb);
+ }
+ if (ColumnIndex != -1) {
+ ColumnGroup.InsertColumn(ColumnIndex + 1, NewColumn);
+ } else {
+ ColumnGroup.AddColumn(NewColumn);
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup.RemoveColumn(NewColumn);
+ newColumn = null;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewDateTimeColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewDateTimeColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewDateTimeColumnCommand.cs (revision 15690)
@@ -0,0 +1,50 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("New DateTimeColumn", 1, ColumnGroupState.Active, "Column Commands", Position = 9)]
+ public class AddNewDateTimeColumnCommand : AddNewColumnCommandBase {
+ [StorableConstructor]
+ protected AddNewDateTimeColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public AddNewDateTimeColumnCommand(DataSet dataSet, string columnGroupName)
+ : this(dataSet, columnGroupName, "New DataTimeColumn") {
+ }
+
+ public AddNewDateTimeColumnCommand(DataSet dataSet, string columnGroupName, string columnName)
+ : base(dataSet, columnGroupName, columnName, typeof(DateTimeColumn)) {
+ }
+
+ public override string Description {
+ get { return "New DateTimeColumn"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewDoubleColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewDoubleColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewDoubleColumnCommand.cs (revision 15690)
@@ -0,0 +1,46 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("New DoubleColumn", 1, ColumnGroupState.Active, "Column Commands", Position = 7)]
+ public class AddNewDoubleColumnCommand : AddNewColumnCommandBase {
+ [StorableConstructor]
+ protected AddNewDoubleColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public AddNewDoubleColumnCommand(DataSet dataSet, string columnGroupName)
+ : this(dataSet, columnGroupName, "New DoubleColumn") {
+ }
+
+ public AddNewDoubleColumnCommand(DataSet dataSet, string columnGroupName, string columnName)
+ : base(dataSet, columnGroupName, columnName, typeof(DoubleColumn)) {
+ }
+
+ public override string Description {
+ get { return "New DoubleColumn"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewProgrammableColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewProgrammableColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewProgrammableColumnCommand.cs (revision 15690)
@@ -0,0 +1,80 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("New ProgrammableColumn", 1, ColumnGroupState.Active, "Column Commands", Position = 10,
+ OptionsView = typeof(ProgrammableColumnCommandView))]
+ public class AddNewProgrammableColumnCommand : AddNewColumnCommandBase {
+ [StorableConstructor]
+ protected AddNewProgrammableColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public AddNewProgrammableColumnCommand(DataSet dataSet, string columnGroupName)
+ : this(dataSet, columnGroupName, "New ProgrammableColumn") {
+ }
+
+ public AddNewProgrammableColumnCommand(DataSet dataSet, string columnGroupName, string columnName)
+ : base(dataSet, columnGroupName, columnName, typeof(ProgrammableColumn)) {
+ }
+
+ public override string Description {
+ get { return "New programmable column"; }
+ }
+
+ [Storable]
+ private string expression;
+ public string Expression {
+ get { return expression; }
+ set { expression = value; }
+ }
+
+ public override void Execute() {
+ this.UpdateColumnGroup();
+ NewColumn = new ProgrammableColumn(ColumnName, ColumnGroup);
+ NewColumn.Resize(ColumnGroup.RowCount);
+ try {
+ ((ProgrammableColumn)NewColumn).Expression = expression;
+ }
+ catch (ParseException ex) {
+ throw new CommandExecutionException("Error occured during parsing of expression.", ex, this);
+ }
+
+ if (ColumnIndex == -1) {
+ ColumnBase cb = ColumnGroup.Columns.FirstOrDefault(x => x.Selected);
+ if (cb != null) ColumnIndex = ColumnGroup.IndexOfColumn(cb);
+ }
+ if (ColumnIndex != -1) {
+ ColumnGroup.InsertColumn(ColumnIndex + 1, NewColumn);
+ } else {
+ ColumnGroup.AddColumn(NewColumn);
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewStringColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewStringColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/AddNewStringColumnCommand.cs (revision 15690)
@@ -0,0 +1,46 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("New StringColumn", 1, ColumnGroupState.Active, "Column Commands", Position = 8)]
+ public class AddNewStringColumnCommand : AddNewColumnCommandBase {
+ [StorableConstructor]
+ protected AddNewStringColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public AddNewStringColumnCommand(DataSet dataSet, string columnGroupName)
+ : this(dataSet, columnGroupName, "New StringColumn") {
+ }
+
+ public AddNewStringColumnCommand(DataSet dataSet, string columnGroupName, string columnName)
+ : base(dataSet, columnGroupName, columnName, typeof(StringColumn)) {
+ }
+
+ public override string Description {
+ get { return "New StringColumn"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnCommandBase.cs (revision 15690)
@@ -0,0 +1,98 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class ChangeColumnCommandBase : ColumnGroupCommandWithAffectedColumnsBase {
+ [Storable]
+ protected Type columnType;
+
+ protected List newColumns;
+ protected List oldColumns;
+ protected List positions;
+ protected ICollection oldSortedColumnIndexes;
+ protected IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected ChangeColumnCommandBase(bool deserializing)
+ : base(deserializing) {
+ newColumns = new List();
+ oldColumns = new List();
+ positions = new List();
+ }
+
+ protected ChangeColumnCommandBase(DataSet dataSet, string columnGroupName, int[] affectedColumns, Type newColumnType) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ if (!newColumnType.IsSubclassOf(typeof(ColumnBase)))
+ throw new CommandExecutionException("Given columntype no subtype of ColumnBase.", this);
+
+ this.columnType = newColumnType;
+ newColumns = new List();
+ oldColumns = new List();
+ positions = new List();
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnBase newCol;
+ ColumnBase oldCol;
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ for (int j = 0; j < AffectedColumns.Length; j++) {
+ oldCol = ColumnGroup.Columns.ElementAt(AffectedColumns[j]);
+ if (oldCol.GetType() != columnType) {
+ positions.Add(AffectedColumns[j]);
+ oldColumns.Add(oldCol);
+ newCol = (ColumnBase)Activator.CreateInstance(columnType, new object[] { oldCol.Name, oldCol.TotalValuesCount });
+ for (int i = 0; i < oldCol.TotalValuesCount; i++)
+ newCol.AddValueOrNull(oldCol.GetValue(i));
+ newColumns.Add(newCol);
+ }
+ }
+
+ for (int i = 0; i < positions.Count; i++)
+ ColumnGroup.ReplaceColumn(positions[i], newColumns[i]);
+ ColumnGroup.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < positions.Count; i++)
+ ColumnGroup.ReplaceColumn(positions[i], oldColumns[i]);
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndexes;
+ oldSortedColumnIndexes = null;
+ oldSortOrder = null;
+ oldColumns.Clear();
+ newColumns.Clear();
+ positions.Clear();
+ ColumnGroup.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToDateTimeColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToDateTimeColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToDateTimeColumnCommand.cs (revision 15690)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Change to DateTimeColumn", 1, ColumnGroupState.ColumnSelected, "Column Commands", Position = 13)]
+ public class ChangeColumnToDateTimeColumnCommand : ChangeColumnCommandBase {
+ [StorableConstructor]
+ protected ChangeColumnToDateTimeColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public ChangeColumnToDateTimeColumnCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns, typeof(DateTimeColumn)) {
+ }
+
+ public override string Description {
+ get { return "Change to DateTimeColumn"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToDoubleColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToDoubleColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToDoubleColumnCommand.cs (revision 15690)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Change to DoubleColumn", 1, ColumnGroupState.ColumnSelected, "Column Commands", Position = 11)]
+ public class ChangeColumnToDoubleColumnCommand : ChangeColumnCommandBase {
+ [StorableConstructor]
+ protected ChangeColumnToDoubleColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public ChangeColumnToDoubleColumnCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns, typeof(DoubleColumn)) {
+ }
+
+ public override string Description {
+ get { return "Change to DoubleColumn"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToStringColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToStringColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/ChangeColumnToStringColumnCommand.cs (revision 15690)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Change to StringColumn", 1, ColumnGroupState.ColumnSelected, "Column Commands", Position = 12)]
+ public class ChangeColumnToStringColumnCommand : ChangeColumnCommandBase {
+ [StorableConstructor]
+ protected ChangeColumnToStringColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public ChangeColumnToStringColumnCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns, typeof(StringColumn)) {
+ }
+
+ public override string Description {
+ get { return "Change to StringColumn"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/CreateTimeSeriesColumnsCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/CreateTimeSeriesColumnsCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/CreateTimeSeriesColumnsCommand.cs (revision 15690)
@@ -0,0 +1,234 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms.DataVisualization.Charting;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Create time series columns", 1, ColumnGroupState.DoubleColumnSelected, "Column Commands",
+ Position = 16, SelectedColumns = 4)]
+ public class CreateTimeSeriesColumnsCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private int addedColumnsCount;
+ [StorableConstructor]
+ protected CreateTimeSeriesColumnsCommand(bool deserializing) : base(deserializing) { }
+ public CreateTimeSeriesColumnsCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Create time series columns"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (AffectedColumns.Length != 4) throw new CommandExecutionException("The selected columns must include high, low, open, and close price.", this);
+ string[] seriesNames = { "high", "low", "open", "close" };
+ Chart chart1 = new Chart();
+ // Y = high
+ // Y2 = low
+ // Y3 = open
+ // Y4 = close
+ List columns = new List();
+ for (int i = 0; i < 4; i++) {
+ int columnIndex = AffectedColumns[i];
+ DoubleColumn doubleColumn = ColumnGroup.GetColumn(columnIndex) as DoubleColumn;
+ if (doubleColumn == null) throw new CommandExecutionException("The selection column does not contain double columns.", this);
+ columns.Add(doubleColumn);
+ }
+ Series series = new Series();
+ series.ChartArea = "Default";
+ series.ChartType = SeriesChartType.Stock;
+ series.Name = "Input";
+ series.YValuesPerPoint = 4;
+ for (int i = 0; i < columns[0].TotalValuesCount; i++) {
+ DataPoint point = new DataPoint();
+ List values = new List();
+ for (int j = 0; j < 4; j++) {
+ double? v = (double?)columns[j].GetValue(i);
+ if (!v.HasValue) throw new CommandExecutionException("Columns must not contain missing values.", this);
+ values.Add(v.Value);
+ }
+ point.YValues = values.ToArray();
+ series.Points.AddXY(i, values[0]);
+ series.Points[i].YValues[1] = values[1];
+ series.Points[i].YValues[2] = values[2];
+ series.Points[i].YValues[3] = values[3];
+ }
+ chart1.Series.Add(series);
+
+
+ DoubleColumn firstAffectedColumn = (DoubleColumn)ColumnGroup.GetColumn(AffectedColumns[0]);
+ int lastAffectedColumn = AffectedColumns[3];
+
+ // formulas using only the close price
+ FinancialFormula[] formulae = new FinancialFormula[] {
+ FinancialFormula.DetrendedPriceOscillator,
+ FinancialFormula.MovingAverageConvergenceDivergence,
+ FinancialFormula.Performance,
+ FinancialFormula.RateOfChange,
+ FinancialFormula.RelativeStrengthIndex,
+ FinancialFormula.StandardDeviation };
+ int currentColumnIndex = lastAffectedColumn + 1;
+ addedColumnsCount = 0;
+ foreach (var formula in formulae) {
+ chart1.DataManipulator.FinancialFormula(formula, "10", "Input:Y4", "Indicators");
+
+ DoubleColumn newColumn = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.Name = formula + "(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["Indicators"].Points.First().XValue; i++) {
+ newColumn.AddValue(null);
+ }
+ foreach (var value in chart1.Series["Indicators"].Points) {
+ newColumn.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumn);
+ currentColumnIndex++;
+ addedColumnsCount++;
+ }
+
+ // Formulas with two input value
+ formulae = new FinancialFormula[] {
+ FinancialFormula.MassIndex,
+ FinancialFormula.VolatilityChaikins
+ };
+ foreach (var formula in formulae) {
+ chart1.DataManipulator.FinancialFormula(formula, "20", "Input:Y,Input:Y2", "Indicators");
+
+ DoubleColumn newColumn = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.Name = formula + "(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["Indicators"].Points.First().XValue; i++) {
+ newColumn.AddValue(null);
+ }
+ foreach (var value in chart1.Series["Indicators"].Points) {
+ newColumn.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumn);
+ currentColumnIndex++;
+ addedColumnsCount++;
+ }
+
+ // Williams %R
+ {
+ chart1.DataManipulator.FinancialFormula(FinancialFormula.WilliamsR, "Input:Y,Input:Y2,Input:Y4", "Indicators");
+ DoubleColumn newColumn = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.Name = "WilliamsR(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["Indicators"].Points.First().XValue; i++) {
+ newColumn.AddValue(null);
+ }
+ foreach (var value in chart1.Series["Indicators"].Points) {
+ newColumn.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumn);
+ currentColumnIndex++;
+ addedColumnsCount++;
+ }
+
+ // StochasticIndicator
+ {
+ chart1.DataManipulator.FinancialFormula(FinancialFormula.StochasticIndicator, "15", "Input:Y,Input:Y2,Input:Y4", "Indicators,SMA");
+ DoubleColumn newColumn = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.Name = "StochasticIndicator(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["Indicators"].Points.First().XValue; i++) {
+ newColumn.AddValue(null);
+ }
+ foreach (var value in chart1.Series["Indicators"].Points) {
+ newColumn.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumn);
+ currentColumnIndex++;
+ addedColumnsCount++;
+
+ DoubleColumn newColumnSma = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumnSma.Name = "StochasticIndicator-SMA(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["SMA"].Points.First().XValue; i++) {
+ newColumnSma.AddValue(null);
+ }
+ foreach (var value in chart1.Series["SMA"].Points) {
+ newColumnSma.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumnSma);
+ currentColumnIndex++;
+ addedColumnsCount++;
+ }
+
+
+ // All other formulas.
+ formulae = new FinancialFormula[] {
+ FinancialFormula.AverageTrueRange,
+ FinancialFormula.CommodityChannelIndex,
+ };
+ foreach (var formula in formulae) {
+ chart1.DataManipulator.FinancialFormula(formula, "Input:Y,Input:Y2,Input:Y4", "Indicators");
+ DoubleColumn newColumn = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.Name = formula + "(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["Indicators"].Points.First().XValue; i++) {
+ newColumn.AddValue(null);
+ }
+ foreach (var value in chart1.Series["Indicators"].Points) {
+ newColumn.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumn);
+ currentColumnIndex++;
+ addedColumnsCount++;
+ }
+
+ // moving averages.
+ formulae = new FinancialFormula[] {
+ FinancialFormula.ExponentialMovingAverage,
+ FinancialFormula.MovingAverage,
+ FinancialFormula.TriangularMovingAverage,
+ FinancialFormula.TripleExponentialMovingAverage,
+ FinancialFormula.WeightedMovingAverage,
+ };
+ foreach (var formula in formulae) {
+ chart1.DataManipulator.FinancialFormula(formula, "15", "Input:Y4", "Indicators");
+ DoubleColumn newColumn = (DoubleColumn)firstAffectedColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.Name = formula + "(" + firstAffectedColumn.Name + ")";
+ for (int i = 0; i < chart1.Series["Indicators"].Points.First().XValue; i++) {
+ newColumn.AddValue(null);
+ }
+ foreach (var value in chart1.Series["Indicators"].Points) {
+ newColumn.AddValue(value.YValues[0]);
+ }
+ this.ColumnGroup.InsertColumn(currentColumnIndex, newColumn);
+ currentColumnIndex++;
+ addedColumnsCount++;
+ }
+
+ ColumnGroup.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ int lastAffectedColumnIndex = AffectedColumns[3];
+ for (int i = 0; i < addedColumnsCount; i++)
+ this.ColumnGroup.RemoveColumn(lastAffectedColumnIndex + 1);
+ addedColumnsCount = 0;
+ ColumnGroup.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/SplitCategorialColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/SplitCategorialColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/SplitCategorialColumnCommand.cs (revision 15690)
@@ -0,0 +1,85 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Split categorial column", 1, ColumnGroupState.ColumnSelected, "Column Commands",
+ Position = 16, SelectedColumns = 1)]
+ public class SplitCategorialColumnCommand : ColumnCommandBase {
+ private int addedColumnsCount;
+ private const double SETVALUE = 1.0;
+ private const double NOTSETVALUE = 0.0;
+
+ [StorableConstructor]
+ protected SplitCategorialColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public SplitCategorialColumnCommand(DataSet dataSet, string columnGroupName, int columnIndex)
+ : base(dataSet, columnGroupName, columnIndex) {
+ }
+
+ public override string Description {
+ get { return "Split categorial column"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (Column.NullValuesCount != 0)
+ throw new CommandExecutionException("Categorial column must not contain null values.", this);
+
+ int columnIndex = this.ColumnGroup.IndexOfColumn(Column);
+ Dictionary addedColumns = new Dictionary();
+ foreach (string value in Column.ValuesEnumerable.Cast().Distinct().OrderBy(c => c).Select(o => o.ToString())) {
+ DoubleColumn doubleColumn = new DoubleColumn(Column.Name + " " + value.ToString());
+ addedColumns[value] = doubleColumn;
+ ColumnGroup.InsertColumn(columnIndex + addedColumnsCount + 1, doubleColumn);
+ addedColumnsCount++;
+ }
+
+ for (int row = 0; row < ColumnGroup.RowCount; row++) {
+ string value = Column.GetValue(row).ToString();
+ foreach (KeyValuePair pair in addedColumns) {
+ if (pair.Key == value)
+ pair.Value.AddValue(SETVALUE);
+ else
+ pair.Value.AddValue(NOTSETVALUE);
+ }
+ }
+ ColumnGroup.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ int columnIndex = this.ColumnGroup.IndexOfColumn(Column);
+ for (int i = 0; i < addedColumnsCount; i++)
+ this.ColumnGroup.RemoveColumn(columnIndex + 1);
+ addedColumnsCount = 0;
+ ColumnGroup.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/SplitDictionaryStyleDataCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/SplitDictionaryStyleDataCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeColumnGroup/SplitDictionaryStyleDataCommand.cs (revision 15690)
@@ -0,0 +1,110 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Split Dictionary-style Data", 1, ColumnGroupState.ColumnSelected | ColumnGroupState.Sorted, "Column Commands",
+ Position = 15)]
+ public class SplitDictionaryStyleDataCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private int addedColumnsCount;
+ [StorableConstructor]
+ protected SplitDictionaryStyleDataCommand(bool deserializing) : base(deserializing) { }
+
+ public SplitDictionaryStyleDataCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Split dictionary style data"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (ColumnGroup.SortedColumnIndexes.Except(AffectedColumns).Count() != 1 &&
+ ColumnGroup.SortedColumnIndexes.Except(AffectedColumns).FirstOrDefault() == ColumnGroup.SortedColumnIndexes.ElementAt(0))
+ throw new CommandExecutionException("Exactly one column must be sorted as first sorted column and not selected to define the equality of the rows.", this);
+ if (AffectedColumns.Intersect(ColumnGroup.SortedColumnIndexes).Count() != 1)
+ throw new CommandExecutionException("Exactly one column must be sorted and selected to define the column which holds the grouping value.", this);
+ if (!AffectedColumns.Except(ColumnGroup.SortedColumnIndexes).Any())
+ throw new CommandExecutionException("At least one column must not be sorted but selected to define the column which holds the values for new columns.", this);
+
+ Dictionary> newColumns = new Dictionary>();
+
+ ColumnBase groupColumn = ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.Except(AffectedColumns).First());
+ if (groupColumn.ContainsNullValues) throw new CommandExecutionException("Column which defines the equality (" + groupColumn.Name + ") must not contain NULL values.", this);
+
+ ColumnBase splitColumn = ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.Intersect(AffectedColumns).First());
+ var valueColumns = AffectedColumns.Except(ColumnGroup.SortedColumnIndexes).Select(index => ColumnGroup.GetColumn(index)).ToList();
+
+ IComparable groupValue = groupColumn.GetValue(0); ;
+ IComparable splitValue;
+ int groupStartIndex = 0;
+ for (int row = 0; row < ColumnGroup.RowCount; row++) {
+ //check if equality value is still the same
+ if (groupValue.CompareTo(groupColumn.GetValue(row)) != 0) {
+ groupValue = groupColumn.GetValue(row);
+ groupStartIndex = row;
+ }
+ splitValue = splitColumn.GetValue(row);
+
+ //create new column if new group value was detected
+ if (!newColumns.ContainsKey(splitValue)) {
+ newColumns.Add(splitValue, new List(valueColumns.Count));
+ int i = 0;
+ foreach (var valueColumn in valueColumns) {
+ var newColumn = valueColumn.CreateCopyOfColumnWithoutValues(valueColumn.TotalValuesCount);
+ newColumn.Name += "_" + splitValue;
+ newColumn.Resize(ColumnGroup.RowCount);
+ newColumns[splitValue].Add(newColumn);
+ i++;
+ }
+ }
+
+
+ for (int i = groupStartIndex; i < ColumnGroup.RowCount && groupValue.CompareTo(groupColumn.GetValue(i)) == 0; i++) {
+ for (int col = 0; col < valueColumns.Count; col++)
+ newColumns[splitValue][col].ChangeValue(i, valueColumns[col].GetValue(row));
+ }
+ }
+
+ ColumnGroup.AddColumns(newColumns.Values.SelectMany(col => col));
+ addedColumnsCount = newColumns.Values.Sum(columns => columns.Count);
+ this.ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < addedColumnsCount; i++)
+ ColumnGroup.RemoveColumn(ColumnGroup.Columns.Count() - 1);
+ this.ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/AddNewColumnGroupCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/AddNewColumnGroupCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/AddNewColumnGroupCommand.cs (revision 15690)
@@ -0,0 +1,80 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("New ColumnGroup", 0, ColumnGroupState.None, "ColumnGroup Commands", Position = 0)]
+ public class AddNewColumnGroupCommand : DataSetCommandBase {
+ [Storable]
+ private string newColumnGroupName;
+
+ private ColumnGroup newColumnGroup;
+
+ [StorableConstructor]
+ protected AddNewColumnGroupCommand(bool deserializing) : base(deserializing) { }
+
+ public AddNewColumnGroupCommand(DataSet dataSet)
+ : base(dataSet) {
+ int i = 0;
+ string columnGroupName = "New ColumnGroup " + i;
+ while (dataSet.ColumnGroups.Any(cg => cg.Name == columnGroupName)) {
+ i++;
+ columnGroupName = "New ColumnGroup " + i;
+ }
+ this.newColumnGroupName = columnGroupName;
+ }
+
+ private AddNewColumnGroupCommand(DataSet dataSet, string name)
+ : base(dataSet) {
+ this.newColumnGroupName = name;
+ }
+
+ public override string Description {
+ get { return "New column group"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ this.newColumnGroup = new ColumnGroup(newColumnGroupName);
+ this.DataSet.AddColumnGroup(newColumnGroup);
+ this.newColumnGroup.Active = true;
+ this.DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ this.DataSet.RemoveColumnGroup(newColumnGroup);
+ this.newColumnGroup = null;
+ this.DataSet.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/AlignColumnGroupsCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/AlignColumnGroupsCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/AlignColumnGroupsCommand.cs (revision 15690)
@@ -0,0 +1,221 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Align ColumnGroups", 2, ColumnGroupState.Sorted, "ColumnGroup Commands", Position = 4)]
+ public class AlignColumnGroupsCommand : DataSetCommandWithAffectedColumnGroupsBase {
+ private ColumnGroup newColumnGroup1;
+ private ColumnGroup newColumnGroup2;
+ private ColumnGroup oldColumnGroup1;
+ private ColumnGroup oldColumnGroup2;
+ private int removePos1;
+ private int removePos2;
+
+ [StorableConstructor]
+ protected AlignColumnGroupsCommand(bool deserializing) : base(deserializing) { }
+
+ public AlignColumnGroupsCommand(DataSet dataSet, List affectedColumnGroupNames)
+ : base(dataSet, affectedColumnGroupNames) {
+ }
+
+ public override void Execute() {
+ base.Execute();
+ this.oldColumnGroup1 = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[0]);
+ this.oldColumnGroup2 = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[1]);
+ this.removePos1 = this.DataSet.IndexOfColumnGroup(oldColumnGroup1);
+ this.removePos2 = this.DataSet.IndexOfColumnGroup(oldColumnGroup2);
+
+ if (!oldColumnGroup1.Columns.Any() || !oldColumnGroup2.Columns.Any()) return;
+
+ if (oldColumnGroup1.SortedColumnsCount < 1 || oldColumnGroup1.SortedColumnsCount != oldColumnGroup2.SortedColumnsCount)
+ throw new CommandExecutionException("Both ColumnGroups must be sorted by at least one column and must be sorted by the same number of columns.", this);
+ for (int i = 0; i < oldColumnGroup1.SortedColumnsCount; i++) {
+ if (this.oldColumnGroup1.SortOrdersForColumns.ElementAt(oldColumnGroup1.SortedColumnIndexes.ElementAt(i)) !=
+ this.oldColumnGroup2.SortOrdersForColumns.ElementAt(oldColumnGroup2.SortedColumnIndexes.ElementAt(i)))
+ throw new CommandExecutionException("Both ColumnGroups must be sorted in the same direction.", this);
+ if (this.oldColumnGroup1.Columns.ElementAt(oldColumnGroup1.SortedColumnIndexes.ElementAt(i)).DataType !=
+ this.oldColumnGroup2.Columns.ElementAt(oldColumnGroup2.SortedColumnIndexes.ElementAt(i)).DataType)
+ throw new CommandExecutionException("Both ColumnGroups must be sorted by columns of the same type", this);
+ }
+
+ foreach (int sortColIndex in oldColumnGroup1.SortedColumnIndexes) {
+ if (oldColumnGroup1.Columns.ElementAt(sortColIndex).ContainsNullValues)
+ throw new CommandExecutionException("KeyColumn " + oldColumnGroup1.GetColumn(sortColIndex).Name + " not contain null values.", this);
+ }
+ foreach (int sortColIndex in oldColumnGroup2.SortedColumnIndexes) {
+ if (oldColumnGroup2.Columns.ElementAt(sortColIndex).ContainsNullValues)
+ throw new CommandExecutionException("KeyColumn " + oldColumnGroup1.GetColumn(sortColIndex).Name + " must not contain null values.", this);
+ }
+ SampleColumnGroup();
+
+ DataSet.ReplaceColumnGroup(removePos1, newColumnGroup1);
+ DataSet.ReplaceColumnGroup(removePos2, newColumnGroup2);
+ newColumnGroup1 = null;
+ newColumnGroup2 = null;
+ DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DataSet.ReplaceColumnGroup(removePos1, oldColumnGroup1);
+ DataSet.ReplaceColumnGroup(removePos2, oldColumnGroup2);
+ oldColumnGroup1 = null;
+ oldColumnGroup2 = null;
+ DataSet.FireChanged();
+ }
+
+
+ public void SampleColumnGroup() {
+ var keyColumnIndex1 = oldColumnGroup1.SortedColumnIndexes;
+ var keyColumnIndex2 = oldColumnGroup2.SortedColumnIndexes;
+
+ this.newColumnGroup1 = new ColumnGroup(this.oldColumnGroup1.Name);
+ this.newColumnGroup2 = new ColumnGroup(this.oldColumnGroup2.Name);
+ this.newColumnGroup1.SortedColumnIndexes = this.oldColumnGroup1.SortedColumnIndexes;
+ this.newColumnGroup2.SortedColumnIndexes = this.oldColumnGroup2.SortedColumnIndexes;
+
+ ColumnBase column;
+ foreach (ColumnBase col in this.oldColumnGroup1.Columns) {
+ column = col.CreateCopyOfColumnWithoutValues();
+ column.SortOrder = col.SortOrder;
+ this.newColumnGroup1.AddColumn(column);
+ }
+ foreach (ColumnBase col in this.oldColumnGroup2.Columns) {
+ column = col.CreateCopyOfColumnWithoutValues();
+ column.SortOrder = col.SortOrder;
+ this.newColumnGroup2.AddColumn(column);
+ }
+
+ int compareDirection = this.oldColumnGroup1.SortOrdersForColumns.ElementAt(oldColumnGroup1.SortedColumnIndexes.ElementAt(0))
+ == SortOrder.Ascending ? -1 : +1;
+ int i = 0;
+ int j = 0;
+ IComparable[] row1;
+ IComparable[] row2;
+ while (i < oldColumnGroup1.RowCount && j < oldColumnGroup2.RowCount) {
+ //key1 < key2
+ int cmpResult = CompareRows(oldColumnGroup1, i, keyColumnIndex1, oldColumnGroup2, j, keyColumnIndex2);
+ if (cmpResult == compareDirection) {//keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(j)) == compareDirection) {
+ row1 = this.oldColumnGroup1.GetRow(i);
+ row2 = this.oldColumnGroup2.GetEmptyRow();
+ CopyRow(row1, keyColumnIndex1, row2, keyColumnIndex2);// row2[keyColumnIndex2] = row1[keyColumnIndex1];
+ i++;
+ }
+ //key1 == key2
+ else if (/*keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(j))*/ cmpResult == 0) {
+ row1 = this.oldColumnGroup1.GetRow(i);
+ row2 = this.oldColumnGroup2.GetRow(j);
+ bool columnGroup1Dup = false;
+ bool columnGroup2Dup = false;
+ if (i + 1 < oldColumnGroup1.RowCount) {
+ columnGroup1Dup = CompareRows(oldColumnGroup1, i, keyColumnIndex1, oldColumnGroup1, i + 1, keyColumnIndex1) == 0;
+ }
+ if (j + 1 < oldColumnGroup2.RowCount) {
+ columnGroup2Dup = CompareRows(oldColumnGroup2, j, keyColumnIndex2, oldColumnGroup2, j + 1, keyColumnIndex2) == 0;
+ }
+ if (columnGroup1Dup && !columnGroup2Dup) {
+ i++; // only advance to the row of the duplicate
+ } else if (!columnGroup1Dup && columnGroup2Dup) {
+ j++;
+ } else {
+ // either both are a duplicates or neither is
+ i++;
+ j++;
+ }
+ }
+ //key1 > key2
+ else {
+ row1 = this.oldColumnGroup1.GetEmptyRow();
+ row2 = this.oldColumnGroup2.GetRow(j);
+ CopyRow(row2, keyColumnIndex2, row1, keyColumnIndex1);// row1[keyColumnIndex1] = row2[keyColumnIndex2];
+ j++;
+ }
+ this.newColumnGroup1.AddRow(row1);
+ this.newColumnGroup2.AddRow(row2);
+ }
+ for (; i < oldColumnGroup1.RowCount; i++) {
+ this.newColumnGroup1.AddRow(this.oldColumnGroup1.GetRow(i));
+ this.newColumnGroup2.AddRow(this.oldColumnGroup2.GetEmptyRow());
+ CopyRow(newColumnGroup2.GetRow(newColumnGroup2.RowCount - 1), keyColumnIndex2, oldColumnGroup1.GetRow(i), keyColumnIndex1);
+ ChangeRow(newColumnGroup2, newColumnGroup2.RowCount - 1, keyColumnIndex2, oldColumnGroup1, i, keyColumnIndex1);
+ }
+ for (; j < oldColumnGroup2.RowCount; j++) {
+ this.newColumnGroup1.AddRow(oldColumnGroup1.GetEmptyRow());
+ this.newColumnGroup2.AddRow(oldColumnGroup2.GetRow(j));
+ ChangeRow(newColumnGroup1, newColumnGroup1.RowCount - 1, keyColumnIndex1, oldColumnGroup2, j, keyColumnIndex2);
+ }
+ }
+
+ private void ChangeRow(ColumnGroup destGroup, int destRowIndex, IEnumerable destColumnIndexes, ColumnGroup srcGroup, int srcRowIndex, IEnumerable srcColumnIndexes) {
+ foreach (var indexPair in Zip(destColumnIndexes, srcColumnIndexes, (d, s) => new { DestIndex = d, SrcIndex = s })) {
+ destGroup.GetColumn(indexPair.DestIndex).ChangeValue(destRowIndex, srcGroup.GetColumn(indexPair.SrcIndex).GetValue(srcRowIndex));
+ }
+ }
+
+ private void CopyRow(IComparable[] src, IEnumerable srcIndexes, IComparable[] dest, IEnumerable destIndexes) {
+ if (srcIndexes.Count() != destIndexes.Count()) throw new ArgumentException();
+ foreach (var indexPair in Zip(srcIndexes, destIndexes, (k, l) => new { First = k, Second = l })) {
+ dest[indexPair.Second] = src[indexPair.First];
+ }
+ }
+
+ int CompareRows(ColumnGroup oldColumnGroup1, int i, IEnumerable keyColumnIndex1, ColumnGroup oldColumnGroup2, int j, IEnumerable keyColumnIndex2) {
+ if (keyColumnIndex1.Count() != keyColumnIndex2.Count()) throw new ArgumentException();
+ var valuePairs = from x in
+ Zip(from index in keyColumnIndex1
+ select oldColumnGroup1.GetColumn(index).GetValue(i),
+ from index in keyColumnIndex2
+ select oldColumnGroup2.GetColumn(index).GetValue(j),
+ (k, l) => new { First = k, Second = l })
+ select x;
+ foreach (var p in valuePairs) {
+ var result = p.First.CompareTo(p.Second);
+ if (result != 0) return result;
+ }
+ return 0;
+ }
+
+
+ private static IEnumerable Zip
+ (IEnumerable first,
+ IEnumerable second,
+ Func resultSelector) {
+ using (IEnumerator e1 = first.GetEnumerator())
+ using (IEnumerator e2 = second.GetEnumerator())
+ while (e1.MoveNext() && e2.MoveNext())
+ yield return resultSelector(e1.Current, e2.Current);
+ }
+
+ public override string Description {
+ get { return "Align column groups"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/DeleteColumnGroupCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/DeleteColumnGroupCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/DeleteColumnGroupCommand.cs (revision 15690)
@@ -0,0 +1,69 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete ColumnGroup", 1, ColumnGroupState.Active, "ColumnGroup Commands", Position = 1, MinActiveColumnGroups = 1)]
+ public class DeleteColumnGroupCommand : DataSetCommandWithAffectedColumnGroupsBase {
+ private List> deletedColumnGroups;
+
+ [StorableConstructor]
+ protected DeleteColumnGroupCommand(bool deserializing)
+ : base(deserializing) {
+ deletedColumnGroups = new List>();
+ }
+
+ public DeleteColumnGroupCommand(DataSet dataSet, List affectedColumnGroupNames)
+ : base(dataSet, affectedColumnGroupNames) {
+ deletedColumnGroups = new List>();
+ }
+
+ public override string Description {
+ get { return "Delete ColumnGroup"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnGroup columnGroup;
+ foreach (string columnGroupName in AffectedColumnGroupNames) {
+ columnGroup = this.DataSet.GetColumnGroup(columnGroupName);
+ deletedColumnGroups.Add(new KeyValuePair(this.DataSet.IndexOfColumnGroup(columnGroup), columnGroup));
+ this.DataSet.RemoveColumnGroup(columnGroup);
+ }
+ this.DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ deletedColumnGroups.Reverse();
+ for (int i = 0; i < deletedColumnGroups.Count; i++)
+ this.DataSet.InsertColumnGroup(deletedColumnGroups[i].Key, deletedColumnGroups[i].Value);
+ deletedColumnGroups.Clear();
+ this.DataSet.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/DeleteColumnsWithTooFewValuesCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/DeleteColumnsWithTooFewValuesCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/DeleteColumnsWithTooFewValuesCommand.cs (revision 15690)
@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete Columns with too few Values", 1, ColumnGroupState.Active, "ColumnGroup Commands",
+ Position = 14, OptionsView = typeof(ThresholdCommandView))]
+ public class DeleteColumnsWithTooFewValuesCommand : ColumnGroupCommandBase {
+ private SortedDictionary deletedColumns;
+ private ICollection oldSortedColumnIndices;
+ [StorableConstructor]
+ protected DeleteColumnsWithTooFewValuesCommand(bool deserializing)
+ : base(deserializing) {
+ deletedColumns = new SortedDictionary();
+ }
+
+ public DeleteColumnsWithTooFewValuesCommand(DataSet dataSet, string columnGroupName)
+ : base(dataSet, columnGroupName) {
+ deletedColumns = new SortedDictionary();
+ }
+
+ [Storable]
+ private double threshold;
+ public double Threshold {
+ get { return this.threshold; }
+ set { this.threshold = value; }
+ }
+
+ public override string Description {
+ get { return "Delete Columns with too few values"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnBase column;
+ for (int i = 0; i < ColumnGroup.Columns.Count(); i++) {
+ column = ColumnGroup.GetColumn(i);
+ if ((1 - ((double)column.NullValuesCount) / column.TotalValuesCount) < threshold)
+ deletedColumns.Add(i, column);
+ }
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (ColumnBase col in deletedColumns.Values)
+ ColumnGroup.RemoveColumn(col);
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair pair in deletedColumns)
+ ColumnGroup.InsertColumn(pair.Key, pair.Value);
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ deletedColumns.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MergeColumnGroupsCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MergeColumnGroupsCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MergeColumnGroupsCommand.cs (revision 15690)
@@ -0,0 +1,96 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Merge ColumnGroups", 2, ColumnGroupState.Active, "ColumnGroup Commands", Position = 5, MinActiveColumnGroups = 2)]
+ public class MergeColumnGroupsCommand : DataSetCommandWithAffectedColumnGroupsBase {
+ private SortedDictionary oldColumnGroups;
+ private List oldRowCounts;
+ private ColumnGroup newColumnGroup;
+
+ [StorableConstructor]
+ protected MergeColumnGroupsCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumnGroups = new SortedDictionary();
+ oldRowCounts = new List();
+ }
+
+ public MergeColumnGroupsCommand(DataSet dataSet, List affectedColumnGroupNames)
+ : base(dataSet, affectedColumnGroupNames) {
+ oldColumnGroups = new SortedDictionary();
+ oldRowCounts = new List();
+ }
+
+ public override void Execute() {
+ base.Execute();
+ string name = "";
+ ColumnGroup columnGroup;
+ foreach (string columnGroupName in AffectedColumnGroupNames) {
+ columnGroup = this.DataSet.GetColumnGroup(columnGroupName);
+ oldColumnGroups.Add(this.DataSet.IndexOfColumnGroup(columnGroup), columnGroup);
+ oldRowCounts.Add(columnGroup.RowCount);
+ name = name + " & " + columnGroup.Name;
+ }
+ name = name.Remove(0, 3);
+ this.newColumnGroup = new ColumnGroup(name);
+ foreach (ColumnGroup grp in oldColumnGroups.Values) {
+ newColumnGroup.AddColumns(grp.Columns);
+ DataSet.RemoveColumnGroup(grp);
+ }
+
+ foreach (ColumnBase col in this.newColumnGroup.Columns) {
+ col.Resize(oldRowCounts.Max());
+ col.SortOrder = SortOrder.None;
+ }
+ DataSet.InsertColumnGroup(oldColumnGroups.Keys.ElementAt(0), this.newColumnGroup);
+ DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DataSet.RemoveColumnGroup(newColumnGroup);
+ int col;
+ for (int i = 0; i < oldColumnGroups.Count; i++) {
+ col = oldColumnGroups.Keys.ElementAt(i);
+ DataSet.InsertColumnGroup(col, oldColumnGroups[col]);
+ foreach (ColumnBase column in oldColumnGroups[col].Columns)
+ column.Resize(oldRowCounts[i]);
+ }
+ oldColumnGroups.Clear();
+ newColumnGroup = null;
+ oldRowCounts.Clear();
+ DataSet.FireChanged();
+ }
+
+ public override string Description {
+ get { return "Merge column groups"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MoveColumnGroupLeftCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MoveColumnGroupLeftCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MoveColumnGroupLeftCommand.cs (revision 15690)
@@ -0,0 +1,67 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Move ColumnGroup left", 1, ColumnGroupState.Active, "ColumnGroup Commands", Position = 2)]
+ public class MoveColumnGroupLeftCommand : DataSetCommandWithAffectedColumnGroupsBase {
+ [StorableConstructor]
+ protected MoveColumnGroupLeftCommand(bool deserializing) : base(deserializing) { }
+ public MoveColumnGroupLeftCommand(DataSet dataSet, List affectedColumnGroups)
+ : base(dataSet, affectedColumnGroups) {
+ }
+
+ public override string Description {
+ get { return "Move column group left"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnGroup cg = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[0]);
+ int columnGroupIndex = DataSet.IndexOfColumnGroup(cg);
+ if (columnGroupIndex != 0) {
+ DataSet.RemoveColumnGroup(cg);
+ DataSet.InsertColumnGroup(columnGroupIndex - 1, cg);
+ DataSet.FireChanged();
+ }
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup cg = this.DataSet.GetColumnGroup(this.AffectedColumnGroupNames[0]);
+ int columnGroupIndex = this.DataSet.IndexOfColumnGroup(cg);
+ if (columnGroupIndex != this.DataSet.ColumnGroups.Count() - 1) {
+ DataSet.RemoveColumnGroup(cg);
+ DataSet.InsertColumnGroup(columnGroupIndex + 1, cg);
+ DataSet.FireChanged();
+ }
+ this.DataSet.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MoveColumnGroupRightCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MoveColumnGroupRightCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/MoveColumnGroupRightCommand.cs (revision 15690)
@@ -0,0 +1,68 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Move ColumnGroup right", 1, ColumnGroupState.Active, "ColumnGroup Commands", Position = 3)]
+ public class MoveColumnGroupRightCommand : DataSetCommandWithAffectedColumnGroupsBase {
+ [StorableConstructor]
+ protected MoveColumnGroupRightCommand(bool deserializing) : base(deserializing) { }
+
+ public MoveColumnGroupRightCommand(DataSet dataSet, List affectedColumnGroups)
+ : base(dataSet, affectedColumnGroups) {
+ }
+
+ public override string Description {
+ get { return "Move column group right"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnGroup cg = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[0]);
+ int columnGroupIndex = DataSet.IndexOfColumnGroup(cg);
+ if (columnGroupIndex != DataSet.ColumnGroups.Count() - 1) {
+ DataSet.RemoveColumnGroup(cg);
+ DataSet.InsertColumnGroup(columnGroupIndex + 1, cg);
+ DataSet.FireChanged();
+ }
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup cg = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[0]);
+ int columnGroupIndex = DataSet.IndexOfColumnGroup(cg);
+ if (columnGroupIndex == 0) {
+ DataSet.RemoveColumnGroup(cg);
+ DataSet.InsertColumnGroup(columnGroupIndex - 1, cg);
+ DataSet.FireChanged();
+ }
+ this.DataSet.FireChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/SplitColumnGroupCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/SplitColumnGroupCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeDataset/SplitColumnGroupCommand.cs (revision 15690)
@@ -0,0 +1,85 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Split ColumnGroup", 1, ColumnGroupState.ColumnSelected, "ColumnGroup Commands", Position = 6, SelectedColumns = 2)]
+ public class SplitColumnGroupsCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private IEnumerable oldSortOrder;
+ private ColumnGroup oldColumnGroup;
+ private int oldColumnGroupIndex;
+ private ColumnGroup newColumnGroup1;
+ private ColumnGroup newColumnGroup2;
+
+ [StorableConstructor]
+ protected SplitColumnGroupsCommand(bool deserializing) : base(deserializing) { }
+ public SplitColumnGroupsCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override void Execute() {
+ base.Execute();
+ int splitPosition = AffectedColumns[0] + 1;
+ oldColumnGroup = this.ColumnGroup;
+ oldColumnGroupIndex = this.DataSet.IndexOfColumnGroup(oldColumnGroup);
+ oldSortOrder = oldColumnGroup.SortOrdersForColumns.ToList();
+ newColumnGroup1 = new ColumnGroup(oldColumnGroup.Name);
+ newColumnGroup2 = new ColumnGroup(oldColumnGroup.Name);
+
+ for (int i = 0; i < splitPosition; i++)
+ newColumnGroup1.AddColumn(oldColumnGroup.Columns.ElementAt(i));
+ for (int i = splitPosition; i < oldColumnGroup.Columns.Count(); i++)
+ newColumnGroup2.AddColumn(oldColumnGroup.Columns.ElementAt(i));
+
+ newColumnGroup1.ResetSorting();
+ newColumnGroup2.ResetSorting();
+ this.DataSet.RemoveColumnGroup(oldColumnGroup);
+ this.DataSet.InsertColumnGroup(oldColumnGroupIndex, newColumnGroup1);
+ this.DataSet.InsertColumnGroup(oldColumnGroupIndex + 1, newColumnGroup2);
+ this.DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ this.DataSet.RemoveColumnGroup(newColumnGroup1);
+ this.DataSet.RemoveColumnGroup(newColumnGroup2);
+ this.DataSet.InsertColumnGroup(oldColumnGroupIndex, oldColumnGroup);
+ oldColumnGroup.SortOrdersForColumns = oldSortOrder;
+ newColumnGroup1 = null;
+ newColumnGroup2 = null;
+ oldSortOrder = null;
+ oldColumnGroup = null;
+ this.DataSet.FireChanged();
+ }
+
+ public override string Description {
+ get { return "Split column group"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/BoxCoxTransformationCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/BoxCoxTransformationCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/BoxCoxTransformationCommand.cs (revision 15690)
@@ -0,0 +1,98 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Box-Cox Transformation", 1, ColumnGroupState.DoubleColumnSelected, "Change Values",
+ Position = 6, OptionsView = typeof(BoxCoxTransformationCommandView))]
+ public class BoxCoxTransformationCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ [StorableConstructor]
+ protected BoxCoxTransformationCommand(bool deserializing) : base(deserializing) { }
+
+ public BoxCoxTransformationCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ [Storable]
+ private double lambda;
+ public double Lambda {
+ get { return this.lambda; }
+ set { this.lambda = value; }
+ }
+ [Storable]
+ private double c;
+ public double C {
+ get { return this.c; }
+ set { this.c = value; }
+ }
+
+ public override string Description {
+ get { return "Box-Cox Transformation"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ DoubleColumn column;
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ for (int i = 0; i < column.TotalValuesCount; i++)
+ if (column.GetValue(i) != null) {
+ if (lambda != 0.0) {
+ column.ChangeValue(i, Math.Pow((double)column.GetValue(i) + c, lambda) - 1);
+ } else {
+ column.ChangeValue(i, Math.Log((double)column.GetValue(i) + c));
+ }
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DoubleColumn column;
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ for (int i = 0; i < column.TotalValuesCount; i++)
+ if (column.GetValue(i) != null) {
+ if (lambda != 0.0) {
+ column.ChangeValue(i, Math.Pow((double)column.GetValue(i) + 1, 1.0 / lambda) - c);
+ } else {
+ column.ChangeValue(i, Math.Exp((double)column.GetValue(i)) - c);
+ }
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/DeleteRowsWithGivenValueCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/DeleteRowsWithGivenValueCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/DeleteRowsWithGivenValueCommand.cs (revision 15690)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Search and Remove Rows", 1, ColumnGroupState.ColumnSelected, "Change Values",
+ Position = 1, OptionsView = typeof(SearchWithMatchOperationCommandView))]
+ public class DeleteRowsWithGivenValueCommand : SearchWithMatchOperationCommandBase {
+ private Dictionary deletedRows;
+
+ [StorableConstructor]
+ protected DeleteRowsWithGivenValueCommand(bool deserializing)
+ : base(deserializing) {
+ deletedRows = new Dictionary();
+ }
+
+ public DeleteRowsWithGivenValueCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ deletedRows = new Dictionary();
+ }
+
+ public override string Description {
+ get { return "Delete rows which match given value"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ Point[] affectedCells = this.GetAffectedCells();
+ int[] rows = affectedCells.Select(c => c.Y).Distinct().OrderBy(x => x).Reverse().ToArray();
+
+ foreach (int rowIndex in rows) {
+ deletedRows[rowIndex] = ColumnGroup.GetRow(rowIndex);
+ ColumnGroup.DeleteRow(rowIndex);
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair row in deletedRows.OrderBy(x => x.Key))
+ ColumnGroup.InsertRow(row.Key, row.Value);
+ deletedRows.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterCommandBase.cs (revision 15690)
@@ -0,0 +1,43 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class FilterCommandBase : ColumnGroupCommandWithAffectedColumnsBase {
+ [StorableConstructor]
+ protected FilterCommandBase(bool deserializing) : base(deserializing) { }
+
+ public FilterCommandBase(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ [Storable]
+ private int windowSize;
+ public int WindowSize {
+ get { return this.windowSize; }
+ set { this.windowSize = value; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterMovingAverageCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterMovingAverageCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterMovingAverageCommand.cs (revision 15690)
@@ -0,0 +1,119 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Moving Average", 1, ColumnGroupState.DoubleColumnSelected, "Change Values", Position = 2,
+ OptionsView = typeof(FilterCommandView))]
+ public class FilterMovingAverageCommand : FilterCommandBase {
+ private Dictionary oldColumns;
+ private ICollection oldSortedColumnIndices;
+
+ [StorableConstructor]
+ protected FilterMovingAverageCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new Dictionary();
+ }
+
+ public FilterMovingAverageCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldColumns = new Dictionary();
+ }
+
+ public override string Description {
+ get { return "Filter Column - Moving Average"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (this.WindowSize < 1)
+ throw new CommandExecutionException("Window size for filter commands must no be smaller than 1.", this);
+ DoubleColumn column;
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ oldColumns.Add(col, column);
+ ColumnGroup.ReplaceColumn(col, CalcNewColumn(column, this.WindowSize));
+ }
+ }
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair pair in oldColumns)
+ ColumnGroup.ReplaceColumn(pair.Key, pair.Value);
+
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldColumns.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ private DoubleColumn CalcNewColumn(DoubleColumn oldColumn, int windowSize) {
+ DoubleColumn newCol = (DoubleColumn)oldColumn.CreateCopyOfColumnWithoutValues();
+ int left = windowSize / 2;
+ int right = windowSize / 2;
+ if (windowSize % 2 == 0) left--;
+
+ double sum = 0;
+ double? val;
+ int cnt = 0;
+ //initialize sum and count for iterative moving average
+ for (int i = 0; i <= right; i++) {
+ val = (double?)oldColumn.GetValue(i);
+ if (val != null) {
+ sum += val.Value;
+ cnt++;
+ }
+ }
+ //first value newColumn[0]
+ newCol.AddValue(cnt == 0 ? null : (IComparable)(sum / cnt));
+ for (int i = 1; i < oldColumn.TotalValuesCount; i++) {
+ val = (double?)oldColumn.GetValue(i - left - 1);
+ if (val != null) {
+ sum -= val.Value;
+ cnt--;
+ }
+ val = (double?)oldColumn.GetValue(i + right);
+ if (val != null) {
+ sum += val.Value;
+ cnt++;
+ }
+ newCol.AddValue(cnt == 0 ? null : (IComparable)(sum / cnt));
+ }
+ newCol.SortOrder = oldColumn.SortOrder;
+ return newCol;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterMovingMedianCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterMovingMedianCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterMovingMedianCommand.cs (revision 15690)
@@ -0,0 +1,104 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Moving Median", 1, ColumnGroupState.DoubleColumnSelected, "Change Values", Position = 3,
+ OptionsView = typeof(FilterCommandView))]
+ public class FilterMovingMedianCommand : FilterCommandBase {
+ private Dictionary oldColumns;
+ private ICollection oldSortedColumnIndices;
+
+ [StorableConstructor]
+ protected FilterMovingMedianCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new Dictionary();
+ }
+
+ public FilterMovingMedianCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldColumns = new Dictionary();
+ }
+
+ public override string Description {
+ get { return "Filter Column - Moving Median"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (this.WindowSize < 1)
+ throw new CommandExecutionException("Window size for filter commands must no be smaller than 1.", this);
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ DoubleColumn column;
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ oldColumns.Add(col, column);
+ ColumnGroup.ReplaceColumn(col, CalcNewColumn(column, this.WindowSize));
+ }
+ }
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair pair in oldColumns)
+ ColumnGroup.ReplaceColumn(pair.Key, pair.Value);
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldColumns.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ private DoubleColumn CalcNewColumn(DoubleColumn oldColumn, int windowSize) {
+ DoubleColumn newCol = (DoubleColumn)oldColumn.CreateCopyOfColumnWithoutValues();
+ int left = windowSize / 2;
+ int right = windowSize / 2;
+ if (windowSize % 2 == 0) left--;
+
+ int startIndex = -1;
+ int endIndex = oldColumn.TotalValuesCount;
+ //first value newColumn[0]
+ newCol.AddValue(oldColumn.GetMedian(0, right >= oldColumn.TotalValuesCount ? oldColumn.TotalValuesCount : right + 1));
+ for (int i = 1; i < oldColumn.TotalValuesCount; i++) {
+ startIndex = i - left;
+ if (startIndex < 0)
+ startIndex = 0;
+ endIndex = i + right;
+ if (endIndex >= oldColumn.TotalValuesCount)
+ endIndex = oldColumn.TotalValuesCount - 1;
+ newCol.AddValue(oldColumn.GetMedian(startIndex, endIndex + 1));
+ }
+ newCol.SortOrder = oldColumn.SortOrder;
+ return newCol;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterSavitzkyGolayCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterSavitzkyGolayCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/FilterSavitzkyGolayCommand.cs (revision 15690)
@@ -0,0 +1,164 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Savitzky Golay", 1, ColumnGroupState.DoubleColumnSelected, "Change Values", Position = 2,
+ OptionsView = typeof(FilterSavitzkyGolayCommandView))]
+ public class FilterSavitzkyGolayCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private Dictionary oldColumns;
+ private ICollection oldSortedColumnIndices;
+
+ [Storable]
+ public int WindowLeft { get; set; }
+ [Storable]
+ public int WindowRight { get; set; }
+ [Storable]
+ public int Order { get; set; }
+ [Storable]
+ public int OrderOfDerivative { get; set; }
+
+ [StorableConstructor]
+ protected FilterSavitzkyGolayCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new Dictionary();
+ }
+
+ public FilterSavitzkyGolayCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldColumns = new Dictionary();
+ this.WindowLeft = -16;
+ this.WindowRight = 16;
+ this.Order = 2;
+ this.OrderOfDerivative = 0;
+ }
+
+ public override string Description {
+ get { return "Filter Column - Savitzky Golay"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (this.WindowLeft >= WindowRight)
+ throw new CommandExecutionException("Window size for filter commands must no be smaller than 1.", this);
+ foreach (int col in AffectedColumns) {
+ DoubleColumn doubleCol = ColumnGroup.GetColumn(col) as DoubleColumn;
+ if (doubleCol == null) throw new CommandExecutionException("Filtering is only supported for double columns.", this);
+ }
+ DoubleColumn column;
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ oldColumns.Add(col, column);
+ ColumnGroup.ReplaceColumn(col, CalcNewColumn(column, this.WindowLeft, this.WindowRight, this.OrderOfDerivative, this.Order));
+ }
+ }
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair pair in oldColumns)
+ ColumnGroup.ReplaceColumn(pair.Key, pair.Value);
+
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldColumns.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ private DoubleColumn CalcNewColumn(DoubleColumn oldColumn, int windowLeft, int windowRight, int derivativeOrder, int order) {
+ double[] c;
+ SavitzkyGolay(Math.Abs(windowLeft), Math.Abs(windowRight), derivativeOrder, order, out c);
+
+ DoubleColumn newCol = (DoubleColumn)oldColumn.CreateCopyOfColumnWithoutValues();
+ double[] data = oldColumn.ValuesEnumerable.Cast().Select(x => x.HasValue ? x.Value : double.NaN).ToArray();
+ double[] ans = new double[oldColumn.TotalValuesCount];
+ alglib.convr1d(data, data.Length, c, c.Length, out ans);
+ for (int i = Math.Abs(windowRight); i < ans.Length - Math.Abs(windowLeft); i++) {
+ if (!double.IsNaN(ans[i]))
+ newCol.AddValue(ans[i]);
+ else
+ newCol.AddValueOrNull(null);
+ }
+ newCol.SortOrder = oldColumn.SortOrder;
+ return newCol;
+ }
+
+ ///
+ /// Calculates coefficients for Savitzky-Golay filtering. (Numerical Recipes, page 769), one important change is that the coefficients are returned in normal order instead of wraparound order
+ ///
+ /// number of samples to the left
+ /// number of samples to the right
+ /// order of derivative (smoothing=0)
+ /// order of the polynomial to fit
+ /// resulting coefficients for convolution, in correct order (t-nl, ... t-1, t+0, t+1, ... t+nr)
+ private void SavitzkyGolay(int nl, int nr, int ld, int order, out double[] c) {
+ int np = nl + nr + 1;
+
+ int j, k, imj, ipj, kk, mm;
+ double fac = 0;
+ double sum = 0;
+ if (nl < 0 || nr < 0 || ld > order || nl + nr < order) throw new ArgumentException();
+
+ double[,] a = new double[order + 1, order + 1];
+ double[] b = new double[order + 1];
+ c = new double[np];
+
+ for (ipj = 0; ipj <= (order << 1); ipj++) {
+ sum = (ipj > 0 ? 0.0 : 1.0);
+ for (k = 1; k <= nr; k++) sum += Math.Pow((double)k, (double)ipj);
+ for (k = 1; k <= nl; k++) sum += Math.Pow((double)-k, (double)ipj);
+ mm = Math.Min(ipj, 2 * order - ipj);
+ for (imj = -mm; imj <= mm; imj += 2)
+ a[(ipj + imj) / 2, (ipj - imj) / 2] = sum;
+ }
+ for (j = 0; j < order + 1; j++) b[j] = 0;
+ b[ld] = 1.0;
+ alglib.densesolverreport rep;
+ int info;
+ double[] x = new double[b.Length];
+ alglib.rmatrixsolve(a, b.Length, b, out info, out rep, out x);
+
+ for (kk = 0; kk < np; kk++) c[kk] = 0.0;
+ for (k = -nl; k <= nr; k++) {
+ sum = x[0];
+ fac = 1.0;
+ for (mm = 1; mm <= order; mm++) sum += x[mm] * (fac *= k);
+ kk = k + nl;
+ c[kk] = sum;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/LinearTransformationCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/LinearTransformationCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/LinearTransformationCommand.cs (revision 15690)
@@ -0,0 +1,88 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Linear Transformation", 1, ColumnGroupState.DoubleColumnSelected, "Change Values",
+ Position = 6, OptionsView = typeof(LinearTransformationCommandView))]
+ public class LinearTransformationCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ [StorableConstructor]
+ protected LinearTransformationCommand(bool deserializing) : base(deserializing) { }
+
+ public LinearTransformationCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ [Storable]
+ private double slope;
+ public double Slope {
+ get { return this.slope; }
+ set { this.slope = value; }
+ }
+
+ [Storable]
+ private double offset;
+ public double Offset {
+ get { return this.offset; }
+ set { this.offset = value; }
+ }
+
+ public override string Description {
+ get { return "Lineare Transformation"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ DoubleColumn column;
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ for (int i = 0; i < column.TotalValuesCount; i++)
+ if (column.GetValue(i) != null)
+ column.ChangeValue(i, (double)column.GetValue(i) * slope + offset);
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DoubleColumn column;
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ for (int i = 0; i < column.TotalValuesCount; i++)
+ if (column.GetValue(i) != null)
+ column.ChangeValue(i, ((double)column.GetValue(i) - offset) / slope);
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/NormalDistributionScalingCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/NormalDistributionScalingCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/NormalDistributionScalingCommand.cs (revision 15690)
@@ -0,0 +1,123 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Scale to normal distribution", 1, ColumnGroupState.DoubleColumnSelected, "Change Values",
+ Position = 5, OptionsView = typeof(NormalDistributionCommandView))]
+ public class NormalDistributionScalingCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private List> oldNormalDistribution;
+
+ [StorableConstructor]
+ protected NormalDistributionScalingCommand(bool deserializing)
+ : base(deserializing) {
+ oldNormalDistribution = new List>();
+ }
+
+ public NormalDistributionScalingCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldNormalDistribution = new List>();
+ }
+
+ public override string Description {
+ get { return "Scale to normal distribution"; }
+ }
+
+ [Storable]
+ private double newMean;
+ public double Mean {
+ get { return this.newMean; }
+ set { this.newMean = value; }
+ }
+
+ [Storable]
+ private double newStddev;
+ public double StandardDeviation {
+ get { return this.newStddev; }
+ set { this.newStddev = value; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ DoubleColumn column;
+ double oldMean;
+ double oldStddev;
+ for (int i = 0; i < AffectedColumns.Length; i++) {
+ if (ColumnGroup.GetColumn(AffectedColumns[i]) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(AffectedColumns[i]);
+ if (column.NonNullValuesCount == 0)
+ continue;
+ oldMean = (double)column.Mean;
+ oldStddev = (double)column.StandardDeviation;
+ CalculateNewColumn(column, newMean, newStddev, oldMean, oldStddev);
+ oldNormalDistribution.Add(new KeyValuePair(oldMean, oldStddev));
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DoubleColumn column;
+ double oldMean;
+ double oldStddev;
+ int j = 0;
+ for (int i = 0; i < AffectedColumns.Length; i++) {
+ if (ColumnGroup.GetColumn(AffectedColumns[i]) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(AffectedColumns[i]);
+ if (column.NonNullValuesCount == 0)
+ continue;
+ oldMean = oldNormalDistribution[j].Key;
+ oldStddev = oldNormalDistribution[j].Value;
+ CalculateNewColumn(column, oldMean, oldStddev, newMean, newStddev);
+ j++;
+ }
+ }
+ oldNormalDistribution.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+
+ }
+
+ private void CalculateNewColumn(DoubleColumn column, double newMean, double newStddev, double oldMean, double oldStddev) {
+ double newValue;
+ double oldValue;
+ for (int val = 0; val < column.TotalValuesCount; val++) {
+ if (column.GetValue(val) == null)
+ continue;
+ oldValue = (double)column.GetValue(val);
+ if (oldStddev == 0)
+ newValue = oldValue - oldMean + newMean;
+ else
+ newValue = ((oldValue - oldMean) / oldStddev) * newStddev + newMean;
+ column.ChangeValue(val, newValue);
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/PercentalChangeCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/PercentalChangeCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/PercentalChangeCommand.cs (revision 15690)
@@ -0,0 +1,98 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Percental Change", 1, ColumnGroupState.DoubleColumnSelected, "Change Values", Position = 3)]
+ public class PercentalChangeCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private Dictionary oldColumns;
+ private ICollection oldSortedColumnIndices;
+
+ [StorableConstructor]
+ protected PercentalChangeCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new Dictionary();
+ }
+
+ public PercentalChangeCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldColumns = new Dictionary();
+ }
+
+ public override string Description {
+ get { return "Calculate the percental change from last to the current value"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ foreach (int col in AffectedColumns) {
+ DoubleColumn doubleCol = ColumnGroup.GetColumn(col) as DoubleColumn;
+ if (doubleCol == null) throw new CommandExecutionException("Filtering is only supported for double columns.", this);
+ }
+ DoubleColumn column;
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(col);
+ oldColumns.Add(col, column);
+ ColumnGroup.ReplaceColumn(col, CalcNewColumn(column));
+ }
+ }
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair pair in oldColumns)
+ ColumnGroup.ReplaceColumn(pair.Key, pair.Value);
+
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldColumns.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ private DoubleColumn CalcNewColumn(DoubleColumn oldColumn) {
+ DoubleColumn newCol = (DoubleColumn)oldColumn.CreateCopyOfColumnWithoutValues();
+ var data = oldColumn.ValuesEnumerable.Cast();
+
+ var ans = new double?[] { null } // insert an empty value at the beginning
+ .Concat(data)
+ .Zip(data, (prev, cur) => (cur.HasValue && prev.HasValue) ? (cur - prev) / prev : null)
+ .ToArray();
+
+ foreach (var e in ans) newCol.AddValue(e);
+
+ newCol.SortOrder = oldColumn.SortOrder;
+ return newCol;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/ScalingBetweenMinAndMaxCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/ScalingBetweenMinAndMaxCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/ScalingBetweenMinAndMaxCommand.cs (revision 15690)
@@ -0,0 +1,123 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Scaling between Min/Max", 1, ColumnGroupState.DoubleColumnSelected, "Change Values",
+ Position = 4, OptionsView = typeof(MinMaxCommandView))]
+ public class ScalingBetweenMinAndMaxCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private List oldMinValues;
+ private List oldMaxValues;
+
+ [StorableConstructor]
+ protected ScalingBetweenMinAndMaxCommand(bool deserializing)
+ : base(deserializing) {
+ oldMinValues = new List();
+ oldMaxValues = new List();
+ }
+
+ public ScalingBetweenMinAndMaxCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldMinValues = new List();
+ oldMaxValues = new List();
+ }
+
+ public override string Description {
+ get { return "Scale Values between minimum and maximum"; }
+ }
+
+ [Storable]
+ private double minValue;
+ public double MinValue {
+ get { return this.minValue; }
+ set { this.minValue = value; }
+ }
+
+ [Storable]
+ private double maxValue;
+ public double MaxValue {
+ get { return maxValue; }
+ set { this.maxValue = value; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (maxValue < minValue)
+ throw new CommandExecutionException("Minimum must be smaller or equal than Maximum.", this);
+ DoubleColumn column;
+ int j = 0;
+ for (int i = 0; i < AffectedColumns.Length; i++) {
+ if (ColumnGroup.GetColumn(AffectedColumns[i]) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(AffectedColumns[i]);
+ if (column.ContainsNotNullValues) {
+ oldMinValues.Add((double)column.Minimum);
+ oldMaxValues.Add((double)column.Maximum);
+ ScaleLinear(column, oldMinValues[j], oldMaxValues[j], minValue, maxValue);
+ j++;
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ DoubleColumn column;
+ int j = 0;
+ for (int i = 0; i < AffectedColumns.Length; i++) {
+ if (ColumnGroup.GetColumn(i) is DoubleColumn) {
+ column = (DoubleColumn)ColumnGroup.GetColumn(AffectedColumns[i]);
+ if (column.ContainsNotNullValues) {
+ oldMinValues.Add((double)column.Minimum);
+ oldMaxValues.Add((double)column.Maximum);
+ ScaleLinear(column, minValue, maxValue, oldMinValues[j], oldMaxValues[j]);
+ j++;
+ }
+ }
+ }
+ oldMinValues.Clear();
+ oldMaxValues.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ private void ScaleLinear(DoubleColumn column, double oldMin, double oldMax, double newMin, double newMax) {
+ double newRange = newMax - newMin;
+ double? actValue;
+ double oldRange = oldMax - oldMin;
+ if (oldRange == 0)
+ oldRange = 1;
+ for (int i = 0; i < column.TotalValuesCount; i++) {
+ actValue = (double?)column.GetValue(i);
+ if (actValue != null)
+ column.ChangeValue(i, newMin + newRange * (((double)actValue) - oldMin) / oldRange);
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchAndReplaceCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchAndReplaceCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchAndReplaceCommand.cs (revision 15690)
@@ -0,0 +1,107 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Search and Replace", 1, ColumnGroupState.ColumnSelected, "Change Values",
+ Position = 0, OptionsView = typeof(SearchAndReplaceCommandView))]
+ public class SearchAndReplaceCommand : SearchWithMatchOperationCommandBase {
+ private Dictionary changedCells;
+ private List oldSorteColumnIndices;
+ private Dictionary oldSortOrder;
+
+ [StorableConstructor]
+ protected SearchAndReplaceCommand(bool deserializing)
+ : base(deserializing) {
+ changedCells = new Dictionary();
+ oldSorteColumnIndices = new List();
+ oldSortOrder = new Dictionary();
+ }
+
+ public SearchAndReplaceCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ changedCells = new Dictionary();
+ oldSorteColumnIndices = new List();
+ oldSortOrder = new Dictionary();
+ }
+
+ public override string Description {
+ get { return "Search and Replace"; }
+ }
+
+ [Storable]
+ private string replaceValue;
+ public string ReplaceValue {
+ get { return this.replaceValue; }
+ set { this.replaceValue = string.IsNullOrEmpty(value) ? null : value.Trim(); }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ Point[] affectedCells = this.GetAffectedCells();
+ ColumnBase column;
+ foreach (Point cell in affectedCells) {
+ column = this.ColumnGroup.GetColumn(cell.X);
+ changedCells[cell] = column.GetValue(cell.Y);
+ column.ChangeValueOrLeaveOldValue(cell.Y, ReplaceValue);
+ }
+
+ foreach (ColumnBase col in this.ColumnGroup.Columns)
+ oldSortOrder.Add(col, col.SortOrder);
+
+ oldSorteColumnIndices = new List(this.ColumnGroup.SortedColumnIndexes);
+ this.ColumnGroup.ResetSorting();
+
+ this.ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ //needed because otherwise unchanged cells with the same replaceValue would also be affected
+ ColumnBase column;
+ foreach (KeyValuePair cell in changedCells) {
+ column = this.ColumnGroup.GetColumn(cell.Key.X);
+ column.ChangeValueOrLeaveOldValue(cell.Key.Y, cell.Value);
+ }
+
+ this.ColumnGroup.SortedColumnIndexes = this.oldSorteColumnIndices;
+ foreach (KeyValuePair pair in oldSortOrder)
+ pair.Key.SortOrder = pair.Value;
+
+ oldSortOrder.Clear();
+ oldSorteColumnIndices.Clear();
+ changedCells.Clear();
+ this.ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchCommandBase.cs (revision 15690)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class SearchCommandBase : ColumnGroupCommandWithAffectedColumnsBase {
+ [StorableConstructor]
+ protected SearchCommandBase(bool deserializing) : base(deserializing) { }
+ protected SearchCommandBase(DataSet dataSet, string columnGroupName, int[] affectedColumns) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ [Storable]
+ private string searchValue;
+ public string SearchValue {
+ get { return this.searchValue; }
+ set { this.searchValue = string.IsNullOrEmpty(value) ? null : value.Trim(); }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchWithMatchOperationCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchWithMatchOperationCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/ChangeValues/SearchWithMatchOperationCommandBase.cs (revision 15690)
@@ -0,0 +1,132 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ public enum MatchOperation {
+ Equal = 0,
+ NotEqual = 1,
+ Smaller = 2,
+ Larger = 3,
+ }
+
+ [StorableClass]
+ public abstract class SearchWithMatchOperationCommandBase : SearchCommandBase {
+ [StorableConstructor]
+ protected SearchWithMatchOperationCommandBase(bool deserializing) : base(deserializing) { }
+ protected SearchWithMatchOperationCommandBase(DataSet dataSet, string columnGroupName, int[] affectedColumns) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ [Storable]
+ private MatchOperation matchOperation;
+ public MatchOperation MatchOperation {
+ get { return this.matchOperation; }
+ set { this.matchOperation = value; }
+ }
+
+ protected Point[] GetAffectedCells() {
+ List affectedCells = new List();
+ Func compareFunction = this.GetCompareFunction(this.matchOperation);
+ ColumnBase column;
+ IComparable compareValue;
+ IComparable value;
+
+ for (int col = 0; col < AffectedColumns.Length; col++) {
+ column = ColumnGroup.GetColumn(AffectedColumns[col]);
+ compareValue = this.GetCompareValue(column, SearchValue);
+ for (int row = 0; row < column.TotalValuesCount; row++) {
+ value = column.GetValue(row);
+ if (compareFunction(compareValue, value))
+ affectedCells.Add(new Point(AffectedColumns[col], row));
+ }
+ }
+
+ return affectedCells.ToArray();
+ }
+
+ private IComparable GetCompareValue(ColumnBase column, string searchValue) {
+ if (string.IsNullOrEmpty(searchValue))
+ return null;
+
+ IComparable compareValue;
+ if (column is DoubleColumn) {
+ double v;
+ if (!double.TryParse(SearchValue, out v)) throw new CommandExecutionException("Can't use value " + SearchValue + " to filter a DoubleColumn.", this);
+ compareValue = v;
+ } else if (column is DateTimeColumn) {
+ DateTime d;
+ if (!DateTime.TryParse(SearchValue, out d)) throw new CommandExecutionException("Can't use value " + SearchValue + " to filter a DateTimeColumn.", this);
+ compareValue = d;
+ } else if (column is StringColumn) {
+ compareValue = SearchValue;
+ } else throw new CommandExecutionException("Column type " + column.GetType() + " is not supported.", this);
+ return compareValue;
+ }
+
+ private Func GetCompareFunction(MatchOperation matchOperation) {
+ Func compareFunction;
+ switch (matchOperation) {
+ case MatchOperation.Equal:
+ compareFunction = (left, right) => {
+ if (left == null && right == null) return true;
+ else if (left != null && right == null) return false;
+ else if (left == null && right != null) return false;
+ return left.CompareTo(right) == 0;
+ };
+ break;
+ case MatchOperation.NotEqual:
+ compareFunction = (left, right) => {
+ if (left == null && right == null) return false;
+ else if (left != null && right == null) return true;
+ else if (left == null && right != null) return true;
+ return left.CompareTo(right) != 0;
+ };
+ break;
+ case MatchOperation.Smaller:
+ compareFunction = (left, right) => {
+ if (left == null && right == null) return false;
+ else if (left != null && right == null) return false;
+ else if (left == null && right != null) return false;
+ return left.CompareTo(right) > 0;
+ };
+ break;
+ case MatchOperation.Larger:
+ compareFunction = (left, right) => {
+ if (left == null && right == null) return false;
+ else if (left != null && right == null) return false;
+ else if (left == null && right != null) return false;
+ return left.CompareTo(right) < 0;
+ };
+ break;
+ default:
+ throw new ArgumentException("Undefined compare function.");
+ }
+ return compareFunction;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/HeuristicLab.DataImporter.Command.csproj
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/HeuristicLab.DataImporter.Command.csproj (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/HeuristicLab.DataImporter.Command.csproj (revision 15690)
@@ -0,0 +1,318 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {62625144-AC9E-4970-A79C-882B72A1601C}
+ Library
+ Properties
+ HeuristicLab.DataImporter.Command
+ HeuristicLab.DataImporter.Command-1.0
+ v4.5
+ 512
+ true
+ HeuristicLab.snk
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ ..\..\..\trunk\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ ..\..\..\trunk\bin
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\trunk\bin\ALGLIB-3.7.0.dll
+ False
+
+
+ ..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll
+ False
+
+
+ ..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll
+ False
+
+
+
+ 3.5
+
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+
+ Code
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ AggregationCommandView.cs
+
+
+ UserControl
+
+
+ ChangeDateTimeCommandView.cs
+
+
+ UserControl
+
+
+ BoxCoxTransformationCommandView.cs
+
+
+ UserControl
+
+
+ DeleteWithThresholdView.cs
+
+
+ UserControl
+
+
+ FilterSavitzkyGolayCommandView.cs
+
+
+ UserControl
+
+
+ SearchWithMatchOperationCommandView.cs
+
+
+ UserControl
+
+
+ SearchCommandView.cs
+
+
+ UserControl
+
+
+ LinearTransformationCommandView.cs
+
+
+ UserControl
+
+
+ NormalDistribuationCommandView.cs
+
+
+ UserControl
+
+
+ MinMaxCommandView.cs
+
+
+ UserControl
+
+
+ ProgrammableColumnCommandView.cs
+
+
+ UserControl
+
+
+ TimeBasedWithoutOffsetCommandView.cs
+
+
+ UserControl
+
+
+ FilterCommandView.cs
+
+
+ UserControl
+
+
+ SearchAndReplaceCommandView.cs
+
+
+ UserControl
+
+
+ TimeBasedCommandView.cs
+
+
+
+
+
+
+
+
+ {4A0EE09A-6D8A-458A-8FB0-3D18F88F7FEE}
+ HeuristicLab.DataImporter.Data
+ False
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+
+
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteColumnsWithMissingValuesThresholdCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteColumnsWithMissingValuesThresholdCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteColumnsWithMissingValuesThresholdCommand.cs (revision 15690)
@@ -0,0 +1,78 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete Columns beneath Threshold", 1, ColumnGroupState.AnySelectedColumnContainsNull,
+ "Handle Missing Values", Position = 6, OptionsView = typeof(DeleteWithThresholdView))]
+ public class DeleteColumnsWithMissingValuesThresholdCommand : ColumnGroupCommandWithAffectedColumnsBase, IThresholdCommand {
+ private ColumnBase oldColumn;
+ private int oldColumnIndex;
+
+ [Storable]
+ private double threshold = 0.8;
+ public double Threshold { get { return threshold; } set { threshold = value; } }
+
+ [StorableConstructor]
+ protected DeleteColumnsWithMissingValuesThresholdCommand(bool deserializing) : base(deserializing) { }
+
+ public DeleteColumnsWithMissingValuesThresholdCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override void Execute() {
+ base.Execute();
+
+ oldColumnIndex = AffectedColumns[0];
+
+ oldColumn = ColumnGroup.GetColumn(oldColumnIndex);
+ if ((double)oldColumn.NonNullValuesCount / (double)oldColumn.TotalValuesCount < Threshold) {
+ ColumnGroup.RemoveColumn(oldColumn);
+ } else {
+ oldColumn = null;
+ }
+
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ if (oldColumn != null) {
+ ColumnGroup.InsertColumn(oldColumnIndex, oldColumn);
+ }
+ oldColumn = null;
+ oldColumnIndex = -1;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Delete columns with a missing value percentage beneath a certain threshold"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteRowsWithMissingValuesCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteRowsWithMissingValuesCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteRowsWithMissingValuesCommand.cs (revision 15690)
@@ -0,0 +1,97 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete Rows", 1, ColumnGroupState.AnySelectedColumnContainsNull,
+ "Handle Missing Values", Position = 4)]
+ public class DeleteRowsWithMissingValuesCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private List oldColumns;
+ private ICollection oldSortedColumnIndices;
+
+ [StorableConstructor]
+ protected DeleteRowsWithMissingValuesCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new List();
+ }
+
+ public DeleteRowsWithMissingValuesCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ oldColumns = new List();
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnGroup tempColumnGroup = new ColumnGroup();
+ HashSet positions = new HashSet();
+ ColumnBase column;
+
+ for (int col = 0; col < AffectedColumns.Length; col++) {
+ column = ColumnGroup.GetColumn(AffectedColumns[col]);
+ for (int row = 0; row < ColumnGroup.RowCount; row++) {
+ if (column.GetValue(row) == null && !positions.Contains(row))
+ positions.Add(row);
+ }
+ }
+
+ foreach (ColumnBase x in ColumnGroup.Columns) {
+ oldColumns.Add(x);
+ tempColumnGroup.AddColumn(x.CreateCopyOfColumnWithoutValues());
+ }
+
+ for (int i = 0; i < ColumnGroup.RowCount; i++)
+ if (!positions.Contains(i))
+ tempColumnGroup.AddRow(ColumnGroup.GetRow(i));
+
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ for (int i = 0; i < ColumnGroup.Columns.Count(); i++) {
+ tempColumnGroup.Columns.ElementAt(i).SortOrder = ColumnGroup.GetColumn(i).SortOrder;
+ ColumnGroup.ReplaceColumn(i, tempColumnGroup.Columns.ElementAt(i));
+ }
+
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < ColumnGroup.Columns.Count(); i++)
+ ColumnGroup.ReplaceColumn(i, oldColumns[i]);
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldColumns.Clear();
+ oldSortedColumnIndices = null;
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Delete rows with missing values"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteRowsWithMissingValuesThresholdCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteRowsWithMissingValuesThresholdCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/DeleteRowsWithMissingValuesThresholdCommand.cs (revision 15690)
@@ -0,0 +1,88 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete Rows beneath Threshold", 1, ColumnGroupState.Active,
+ "Handle Missing Values", Position = 5, OptionsView = typeof(DeleteWithThresholdView))]
+ public class DeleteRowsWithMissingValuesThresholdCommand : ColumnGroupCommandBase, IThresholdCommand {
+ private Dictionary deletedRows;
+
+ [Storable]
+ private double threshold = 0.8;
+ public double Threshold { get { return threshold; } set { threshold = value; } }
+
+ [StorableConstructor]
+ protected DeleteRowsWithMissingValuesThresholdCommand(bool deserializing)
+ : base(deserializing) {
+ deletedRows = new Dictionary();
+ }
+
+ public DeleteRowsWithMissingValuesThresholdCommand(DataSet dataSet, string columnGroupName)
+ : base(dataSet, columnGroupName) {
+ deletedRows = new Dictionary();
+ }
+
+ public override void Execute() {
+ base.Execute();
+ IComparable[] row;
+
+ double columnsCount = ColumnGroup.Columns.Count();
+ for (int rowInd = 0; rowInd < ColumnGroup.RowCount; rowInd++) {
+ row = ColumnGroup.GetRow(rowInd);
+ double setValues = ColumnGroup.GetRow(rowInd).Where(x => x != null).Count();
+ if (setValues / columnsCount < Threshold) {
+ deletedRows[rowInd] = row;
+ }
+ }
+
+ foreach (int rowInd in deletedRows.Select(x => x.Key).Reverse()) {
+ ColumnGroup.DeleteRow(rowInd);
+ }
+
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (KeyValuePair pair in deletedRows) {
+ ColumnGroup.InsertRow(pair.Key, pair.Value);
+ }
+ deletedRows.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Delete rows with a missing value percentage beneath a certain threshold"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValueCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValueCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValueCommandBase.cs (revision 15690)
@@ -0,0 +1,63 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class FillMissingValueCommandBase : ColumnGroupCommandWithAffectedColumnsBase {
+ protected Dictionary> nullValues;
+ protected ICollection oldSortedColumnIndexes;
+ protected IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected FillMissingValueCommandBase(bool deserializing)
+ : base(deserializing) {
+ nullValues = new Dictionary>();
+ }
+
+ protected FillMissingValueCommandBase(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ nullValues = new Dictionary>();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnBase column;
+ foreach (int col in nullValues.Keys) {
+ column = ColumnGroup.GetColumn(col);
+ for (int j = 0; j < this.nullValues[col].Count; j++)
+ column.ChangeValue(this.nullValues[col][j], null);
+ }
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndexes;
+ oldSortedColumnIndexes = null;
+ oldSortOrder = null;
+ nullValues.Clear();
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithLinearInterpolation.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithLinearInterpolation.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithLinearInterpolation.cs (revision 15690)
@@ -0,0 +1,95 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Linear Interpolation", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnContainsNull,
+ "Handle Missing Values", Position = 2)]
+ public class FillMissingValuesWithLinearInterpolation : FillMissingValueCommandBase {
+ [StorableConstructor]
+ protected FillMissingValuesWithLinearInterpolation(bool deserializing) : base(deserializing) { }
+ public FillMissingValuesWithLinearInterpolation(DataSet dataSet, string columnGroupName, int[] affectedColumns) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Interpolate missing values"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ DoubleColumn column;
+ int startIndex = -1;
+ int endIndex = -1;
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn && ColumnGroup.GetColumn(col).ContainsNullValues) {
+ column = (DoubleColumn)ColumnGroup.Columns.ElementAt(col);
+ if (column.SortOrder != SortOrder.None)
+ ColumnGroup.ResetSorting();
+ nullValues.Add(col, new List());
+ startIndex = FindNextNotNullValueIndex(column, startIndex);
+ endIndex = FindNextNotNullValueIndex(column, startIndex);
+ while (endIndex != -1) {
+ if (endIndex - startIndex != 1) {
+ nullValues[col].AddRange(Enumerable.Range(startIndex + 1, endIndex - startIndex - 1));
+ InterpolateValues(column, startIndex, endIndex);
+ }
+ startIndex = endIndex;
+ endIndex = FindNextNotNullValueIndex(column, endIndex);
+ }
+ startIndex = -1;
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ private int FindNextNotNullValueIndex(DoubleColumn column, int startIndex) {
+ int endIndex = -1;
+ for (int i = startIndex + 1; i < column.TotalValuesCount && endIndex == -1; i++)
+ if (column.GetValue(i) != null)
+ endIndex = i;
+ return endIndex;
+ }
+
+ private void InterpolateValues(DoubleColumn column, int startIndex, int endIndex) {
+ double startValue = (double)column.GetValue(startIndex);
+ double endValue = (double)column.GetValue(endIndex);
+ double stepwidth = (endValue - startValue) / (endIndex - startIndex);
+
+ for (int i = startIndex + 1; i < endIndex; i++) {
+ if (column.GetValue(i) != null)
+ throw new CommandExecutionException("Tried to manipulate non null value!", this);
+ column.ChangeValue(i, startValue + stepwidth * (i - startIndex));
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithMeanCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithMeanCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithMeanCommand.cs (revision 15690)
@@ -0,0 +1,70 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Mean", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnContainsNull,
+ "Handle Missing Values", Position = 0)]
+ public class FillMissingValuesWithMeanCommand : FillMissingValueCommandBase {
+ [StorableConstructor]
+ protected FillMissingValuesWithMeanCommand(bool deserializing) : base(deserializing) { }
+ public FillMissingValuesWithMeanCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override void Execute() {
+ base.Execute();
+ DoubleColumn column;
+ double? mean;
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn && ColumnGroup.GetColumn(col).ContainsNullValues) {
+ column = (DoubleColumn)ColumnGroup.Columns.ElementAt(col);
+ if (column.SortOrder != SortOrder.None)
+ ColumnGroup.ResetSorting();
+ nullValues.Add(col, new List());
+ mean = column.Mean;
+ for (int j = 0; j < column.TotalValuesCount; j++) {
+ if (column.GetValue(j) == null) {
+ column.ChangeValue(j, mean);
+ this.nullValues[col].Add(j);
+ }
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Fill missing values with mean"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithMedianCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithMedianCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithMedianCommand.cs (revision 15690)
@@ -0,0 +1,70 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Median", 1, ColumnGroupState.DoubleColumnSelected | ColumnGroupState.AnySelectedColumnContainsNull,
+ "Handle Missing Values", Position = 1)]
+ public class FillMissingValuesWithMedianCommand : FillMissingValueCommandBase {
+ [StorableConstructor]
+ protected FillMissingValuesWithMedianCommand(bool deserializing) : base(deserializing) { }
+ public FillMissingValuesWithMedianCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Fill missing values with median"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ DoubleColumn column;
+ double? median;
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn && ColumnGroup.GetColumn(col).ContainsNullValues) {
+ column = (DoubleColumn)ColumnGroup.Columns.ElementAt(col);
+ if (column.SortOrder != SortOrder.None)
+ ColumnGroup.ResetSorting();
+ nullValues.Add(col, new List());
+ median = column.Median;
+ for (int j = 0; j < column.TotalValuesCount; j++) {
+ if (column.GetValue(j) == null) {
+ column.ChangeValue(j, median);
+ this.nullValues[col].Add(j);
+ }
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithPreviousValuesCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithPreviousValuesCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/FillMissingValuesWithPreviousValuesCommand.cs (revision 15690)
@@ -0,0 +1,72 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Previous Value", 1, ColumnGroupState.AnySelectedColumnContainsNull, "Handle Missing Values", Position = 3)]
+ public class FillMissingValuesWithPreviousValuesCommand : FillMissingValueCommandBase {
+ [StorableConstructor]
+ protected FillMissingValuesWithPreviousValuesCommand(bool deserializing) : base(deserializing) { }
+ public FillMissingValuesWithPreviousValuesCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns) :
+ base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override void Execute() {
+ base.Execute();
+ IComparable val = null;
+ ColumnBase column;
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ foreach (int col in AffectedColumns) {
+ column = ColumnGroup.GetColumn(col);
+ if (column.ContainsNullValues) {
+ if (column.SortOrder != SortOrder.None)
+ ColumnGroup.ResetSorting();
+ nullValues.Add(col, new List());
+ val = null;
+ for (int j = 0; j < column.TotalValuesCount; j++) {
+ if (column.GetValue(j) != null)
+ val = column.GetValue(j);
+ else {
+ column.ChangeValue(j, val);
+ this.nullValues[col].Add(j);
+ }
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Fill missing values with previous value"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/IThresholdCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/IThresholdCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/MissingValues/IThresholdCommand.cs (revision 15690)
@@ -0,0 +1,28 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.CommandBase;
+
+namespace HeuristicLab.DataImporter.Command {
+ public interface IThresholdCommand : ICommand {
+ double Threshold { get; set; }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Properties/AssemblyInfo.cs.frame
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Properties/AssemblyInfo.cs.frame (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/Properties/AssemblyInfo.cs.frame (revision 15690)
@@ -0,0 +1,57 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using HeuristicLab.PluginInfrastructure;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("HeuristicLab.DataImporter.Command")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("HeuristicLab")]
+[assembly: AssemblyCopyright("(C) 2008-2012 HEAL")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("7d0840b8-3382-4b99-ab4e-5d1eb91fbec1")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.0.$WCREV$")]
+[assembly: AssemblyFileVersion("1.0.0.$WCREV$")]
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/ChangeDateTimeColumnToDoubleColumn.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/ChangeDateTimeColumnToDoubleColumn.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/ChangeDateTimeColumnToDoubleColumn.cs (revision 15690)
@@ -0,0 +1,136 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Change DateTimeColumn to DoubleColumn", 1, ColumnGroupState.DateTimeColumnSelected, "Time Series",
+Position = 5, OptionsView = typeof(ChangeDateTimeCommandView))]
+ public class ChangeDateTimeColumnToDoubleColumn : ColumnGroupCommandWithAffectedColumnsBase {
+ private List newColumns;
+ private List oldColumns;
+ private List positions;
+ private ICollection oldSortedColumnIndexes;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected ChangeDateTimeColumnToDoubleColumn(bool deserializing)
+ : base(deserializing) {
+ newColumns = new List();
+ oldColumns = new List();
+ positions = new List();
+ }
+
+ public ChangeDateTimeColumnToDoubleColumn(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ newColumns = new List();
+ oldColumns = new List();
+ positions = new List();
+ }
+
+ public override string Description {
+ get { return "Changes the date values to double by substracting from a given date and converting the result to the given unit."; }
+ }
+
+ [Storable]
+ private DateTimeSpan frequency;
+ public DateTimeSpan Frequency {
+ get { return this.frequency; }
+ set { this.frequency = value; }
+ }
+
+ [Storable]
+ private DateTime startTime;
+ public DateTime StartTime {
+ get { return this.startTime; }
+ set { this.startTime = value; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+
+ DateTimeColumn oldColumn;
+ DoubleColumn newColumn;
+ DateTime? value;
+ double newValue;
+ for (int j = 0; j < AffectedColumns.Length; j++) {
+ oldColumn = (DateTimeColumn)ColumnGroup.Columns.ElementAt(AffectedColumns[j]);
+ positions.Add(AffectedColumns[j]);
+ oldColumns.Add(oldColumn);
+
+ newColumn = new DoubleColumn(oldColumn.Name, oldColumn.TotalValuesCount);
+ for (int i = 0; i < oldColumn.TotalValuesCount; i++) {
+ value = (DateTime?)oldColumn.GetValue(i);
+ if (!value.HasValue)
+ newColumn.AddValue(null);
+ else {
+ TimeSpan elapsedTime = value.Value - startTime;
+ if (frequency.Seconds == 1)
+ newValue = elapsedTime.TotalSeconds;
+ else if (frequency.Minutes == 1)
+ newValue = elapsedTime.TotalMinutes;
+ else if (frequency.Hours == 1)
+ newValue = elapsedTime.TotalHours;
+ else if (frequency.Days == 1)
+ newValue = elapsedTime.TotalDays;
+ else
+ throw new CommandExecutionException("Unit for ChangeDateTimeColumnToDoubleColumn not correclty set.", this);
+ newColumn.AddValue(newValue);
+ }
+ }
+ newColumns.Add(newColumn);
+ }
+
+ for (int i = 0; i < positions.Count; i++)
+ ColumnGroup.ReplaceColumn(positions[i], newColumns[i]);
+ ColumnGroup.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+
+ for (int i = 0; i < positions.Count; i++)
+ ColumnGroup.ReplaceColumn(positions[i], oldColumns[i]);
+
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndexes;
+ oldSortedColumnIndexes = null;
+ oldSortOrder = null;
+ oldColumns.Clear();
+ newColumns.Clear();
+ positions.Clear();
+
+ ColumnGroup.FireChanged();
+ }
+
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/DeleteNotEquidistantRowsCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/DeleteNotEquidistantRowsCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/DeleteNotEquidistantRowsCommand.cs (revision 15690)
@@ -0,0 +1,115 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Delete not equidistant rows", 1, ColumnGroupState.Sorted, "Time Series",
+Position = 1, OptionsView = typeof(TimeBasedCommandView))]
+ public class DeleteNotEquidistantRowsCommand : EquidistantTimeSeriesCommandBase {
+ private DateTimeColumn columnToSample;
+ private List oldColumns;
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected DeleteNotEquidistantRowsCommand(bool deserializing)
+ : base(deserializing) {
+ oldColumns = new List();
+ }
+
+ public DeleteNotEquidistantRowsCommand(DataSet dataSet, string columnGroupName)
+ : base(dataSet, columnGroupName) {
+ oldColumns = new List();
+ }
+
+ public override string Description {
+ get { return "Delete not equidistant rows"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (!(ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.ElementAt(0)) is DateTimeColumn)
+ || ColumnGroup.SortedColumnIndexes.Count != 1)
+ throw new CommandExecutionException("ColumnGroup must be sorted after a datetime column.", this);
+ columnToSample = (DateTimeColumn)ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.ElementAt(0));
+ if (columnToSample.SortOrder != SortOrder.Ascending)
+ throw new CommandExecutionException("ColumnGroup must be sorted ascending after the selected datetime column.", this);
+ if (columnToSample.ContainsNullValues)
+ throw new CommandExecutionException("The datetime column must not contain null values.", this);
+
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+
+ DateTime value;
+ DateTime actPoint = StartTime;
+ ColumnGroup tempColumnGroup = new ColumnGroup();
+ List positions = new List();
+
+ for (int i = 0; i < ColumnGroup.RowCount; i++) {
+ value = (DateTime)columnToSample.GetValue(i);
+ while (actPoint < value)
+ actPoint += SampleFrequency;
+ if (actPoint == value) {
+ positions.Add(i);
+ }
+ }
+
+ foreach (ColumnBase x in ColumnGroup.Columns) {
+ oldColumns.Add(x);
+ tempColumnGroup.AddColumn(x.CreateCopyOfColumnWithoutValues());
+ }
+
+ for (int i = 0; i < positions.Count; i++)
+ tempColumnGroup.AddRow(ColumnGroup.GetRow(positions[i]));
+
+ for (int i = 0; i < ColumnGroup.Columns.Count(); i++)
+ ColumnGroup.ReplaceColumn(i, tempColumnGroup.Columns.ElementAt(i));
+
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < ColumnGroup.Columns.Count(); i++)
+ ColumnGroup.ReplaceColumn(i, oldColumns[i]);
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldSortOrder = null;
+ oldColumns.Clear();
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/EquidistantSamplingCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/EquidistantSamplingCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/EquidistantSamplingCommand.cs (revision 15690)
@@ -0,0 +1,96 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Equidistant Sampling", 1, ColumnGroupState.Sorted, "Time Series",
+Position = 0, OptionsView = typeof(TimeBasedCommandView))]
+ public class EquidistantSamplingCommand : EquidistantTimeSeriesCommandBase {
+ private List insertedRows;
+ private DateTimeColumn columnToSample;
+
+ [StorableConstructor]
+ protected EquidistantSamplingCommand(bool deserializing) : base(deserializing) { }
+ public EquidistantSamplingCommand(DataSet dataSet, string columnGroupName)
+ : base(dataSet, columnGroupName) {
+ }
+
+ public override string Description {
+ get { return "Equidistant Sampling"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (!(ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.ElementAt(0)) is DateTimeColumn)
+ || ColumnGroup.SortedColumnIndexes.Count != 1)
+ throw new CommandExecutionException("ColumnGroup mus be sorted a the datetime column.", this);
+
+ columnToSample = (DateTimeColumn)ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.ElementAt(0));
+ if (columnToSample.SortOrder != SortOrder.Ascending)
+ throw new CommandExecutionException("ColumnGroup must be sorted ascending after the selected datetime column.", this);
+ if (columnToSample.ContainsNullValues)
+ throw new CommandExecutionException("The datetime column must not contain null values.", this);
+
+ for (int i = 1; i < columnToSample.TotalValuesCount; i++) {
+ if (columnToSample.GetValue(i) == columnToSample.GetValue(i - 1))
+ throw new CommandExecutionException("The datetime column must not contain duplicate values.", this);
+ }
+
+ insertedRows = new List();
+ DateTime actPoint = StartTime;
+ int j = 0;
+ IComparable[] row;
+ while (j < columnToSample.TotalValuesCount &&
+ actPoint <= ((DateTime)columnToSample.GetValue(columnToSample.TotalValuesCount - 1)) + SampleFrequency) {
+ if (actPoint < (DateTime)columnToSample.GetValue(j)) {
+ row = ColumnGroup.GetEmptyRow();
+ row[ColumnGroup.SortedColumnIndexes.ElementAt(0)] = actPoint;
+ ColumnGroup.InsertRow(j, row);
+ actPoint = actPoint + SampleFrequency;
+ insertedRows.Add(j);
+ } else if (actPoint == (DateTime)columnToSample.GetValue(j))
+ actPoint = actPoint + SampleFrequency;
+ j++;
+ }
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = insertedRows.Count - 1; i >= 0; i--)
+ ColumnGroup.DeleteRow(insertedRows[i]);
+ insertedRows.Clear();
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/EquidistantTimeSeriesCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/EquidistantTimeSeriesCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/EquidistantTimeSeriesCommandBase.cs (revision 15690)
@@ -0,0 +1,51 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ public abstract class EquidistantTimeSeriesCommandBase : ColumnGroupCommandBase {
+ [StorableConstructor]
+ protected EquidistantTimeSeriesCommandBase(bool deserializing) : base(deserializing) { }
+ public EquidistantTimeSeriesCommandBase(DataSet dataSet, string columnGroupName)
+ : base(dataSet, columnGroupName) {
+ }
+
+ [Storable]
+ private DateTimeSpan sampleFrequency;
+ public DateTimeSpan SampleFrequency {
+ get { return this.sampleFrequency; }
+ set { this.sampleFrequency = value; }
+ }
+
+ [Storable]
+ private DateTime startTime;
+ public DateTime StartTime {
+ get { return this.startTime; }
+ set { this.startTime = value; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/FuzzyLinkColumnGroupsCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/FuzzyLinkColumnGroupsCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/FuzzyLinkColumnGroupsCommand.cs (revision 15690)
@@ -0,0 +1,138 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfo("Fuzzy-link ColumnGroups", 2, ColumnGroupState.Sorted, "Time Series", Position = 4)]
+ public class FuzzyLinkColumnGroupsCommand : DataSetCommandWithAffectedColumnGroupsBase {
+ private ColumnGroup newColumnGroup;
+ private ColumnGroup oldColumnGroup;
+ private int removePos;
+
+ private FuzzyLinkColumnGroupsCommand()
+ : base(null, null) {
+ }
+
+ public FuzzyLinkColumnGroupsCommand(DataSet dataSet, List affectedColumnGroups)
+ : base(dataSet, affectedColumnGroups) {
+ }
+
+ //IMPORTANT this method has not been tested and therefore it is not guaranteed that it works as expected
+ public override void Execute() {
+ if (AffectedColumnGroupNames.Count != 2)
+ throw new CommandExecutionException("This command only works if excatly two column groups are activated.", this);
+ ColumnGroup leftColumnGroup = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[0]);
+ ColumnGroup rightColumnGroup = this.DataSet.GetColumnGroup(AffectedColumnGroupNames[1]);
+ int leftIndex = this.DataSet.IndexOfColumnGroup(leftColumnGroup);
+ int rightIndex = this.DataSet.IndexOfColumnGroup(rightColumnGroup);
+
+ this.oldColumnGroup = rightColumnGroup;
+ this.removePos = rightIndex;
+
+ if (leftColumnGroup.SortedColumnsCount != 2 || rightColumnGroup.SortedColumnsCount != 2)
+ throw new CommandExecutionException("Both ColumnGroups must be sorted by exactly two columns.", this);
+
+ if (leftColumnGroup.SortOrdersForColumns.ElementAt(leftColumnGroup.SortedColumnIndexes.ElementAt(0)) !=
+ rightColumnGroup.SortOrdersForColumns.ElementAt(rightColumnGroup.SortedColumnIndexes.ElementAt(0)) ||
+ leftColumnGroup.SortOrdersForColumns.ElementAt(leftColumnGroup.SortedColumnIndexes.ElementAt(1)) !=
+ rightColumnGroup.SortOrdersForColumns.ElementAt(rightColumnGroup.SortedColumnIndexes.ElementAt(1)) ||
+ leftColumnGroup.SortOrdersForColumns.ElementAt(leftColumnGroup.SortedColumnIndexes.ElementAt(0)) != SortOrder.Ascending ||
+ leftColumnGroup.SortOrdersForColumns.ElementAt(leftColumnGroup.SortedColumnIndexes.ElementAt(1)) != SortOrder.Ascending
+ )
+ throw new CommandExecutionException("Both ColumnGroups must be sorted in the same direction and ascending.", this);
+
+ foreach (int sortColIndex in leftColumnGroup.SortedColumnIndexes) {
+ if (leftColumnGroup.Columns.ElementAt(sortColIndex).ContainsNullValues)
+ throw new CommandExecutionException("KeyColumns must not contain null values.", this);
+ }
+ foreach (int sortColIndex in rightColumnGroup.SortedColumnIndexes) {
+ if (rightColumnGroup.Columns.ElementAt(sortColIndex).ContainsNullValues)
+ throw new CommandExecutionException("KeyColumns must not contain null values.", this);
+ }
+ FuzzyLinkColumnGroups(leftColumnGroup, rightColumnGroup);
+
+ DataSet.ReplaceColumnGroup(removePos, newColumnGroup);
+ DataSet.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ DataSet.ReplaceColumnGroup(removePos, oldColumnGroup);
+ DataSet.FireChanged();
+ }
+
+
+ public void FuzzyLinkColumnGroups(ColumnGroup left, ColumnGroup right) {
+ ColumnBase keyColumn1 = left.Columns.ElementAt(left.SortedColumnIndexes.ElementAt(0));
+ ColumnBase keyColumn2 = right.Columns.ElementAt(right.SortedColumnIndexes.ElementAt(0));
+ ColumnBase fuzzyKeyColumn1 = left.Columns.ElementAt(left.SortedColumnIndexes.ElementAt(1));
+ ColumnBase fuzzyKeyColumn2 = right.Columns.ElementAt(right.SortedColumnIndexes.ElementAt(1));
+
+ this.newColumnGroup = new ColumnGroup(right.Name);
+ foreach (ColumnBase col in right.Columns)
+ newColumnGroup.AddColumn(col.CreateCopyOfColumnWithoutValues());
+
+ // FOR NOW WE ASSERT THAT SORT ORDER IS ASCENDING
+ //int keyCompareDirection = this.oldColumnGroup1.SortOrdersForColumns.ElementAt(oldColumnGroup1.SortedColumnIndices.ElementAt(0))
+ // == SortOrder.Ascending ? -1 : +1;
+ //int fuzzyKeyCompareDirection = this.oldColumnGroup1.SortOrdersForColumns.ElementAt(oldColumnGroup1.SortedColumnIndices.ElementAt(1))
+ // == SortOrder.Ascending ? -1 : +1;
+
+ IComparable[] row2;
+ int[] firstMatchingColumn = new int[left.RowCount];
+ int j = 0;
+ // for all keys on left side fuzzy link to right side
+ // first pass find indices of last rows on the right side with matching keys
+ for (int i = 0; i < left.RowCount; i++) {
+ // skip on the right side while the right side key is smaller than the left side key
+ while (j < right.RowCount && keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(j)) > 0) {
+ j++;
+ }
+ // store the first j with the same key
+ if (j < right.RowCount && keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(j)) == 0) {
+ firstMatchingColumn[i] = j;
+ } else {
+ firstMatchingColumn[i] = -1;
+ }
+ }
+ // second pass to find the best fuzzy link (=same or next smaller value)
+ j = firstMatchingColumn[0];
+ for (int i = 0; i < left.RowCount; i++) {
+ if (keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(j)) != 0) j = firstMatchingColumn[i];
+ if (j < 0) {
+ // no matching key => add an empty row
+ newColumnGroup.AddRow(right.GetEmptyRow());
+ } else {
+ int bestMatch = j;
+ // go forward while the fuzzy key on the right is smaller than or equal to the fuzzy key on the left
+ while (j < right.RowCount &&
+ keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(j)) == 0 &&
+ fuzzyKeyColumn1.GetValue(i).CompareTo(fuzzyKeyColumn2.GetValue(j)) >= 0) {
+ bestMatch = j;
+ j++;
+ }
+ // invariant: j = right.RowCount OR best fuzzy-link = fuzzyKeyColumn2(bestMatch)
+ // if we found a match take that row and otherwise use the empty row
+ if (keyColumn1.GetValue(i).CompareTo(keyColumn2.GetValue(bestMatch)) == 0 &&
+ fuzzyKeyColumn1.GetValue(i).CompareTo(fuzzyKeyColumn2.GetValue(bestMatch)) >= 0) {
+ row2 = right.GetRow(bestMatch);
+ j = bestMatch;
+ } else {
+ row2 = right.GetEmptyRow();
+ }
+ newColumnGroup.AddRow(row2);
+ }
+ }
+ }
+
+ public override string Description {
+ get { return "Fuzzy-link column groups"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/InterpolateMissingValues.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/InterpolateMissingValues.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/InterpolateMissingValues.cs (revision 15690)
@@ -0,0 +1,109 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Interpolate Missing Values", 1, ColumnGroupState.Sorted | ColumnGroupState.DoubleColumnSelected, "Time Series",
+Position = 2)]
+ public class InterpolateMissingValues : FillMissingValueCommandBase {
+ private DateTimeColumn columnToSample;
+
+ [StorableConstructor]
+ protected InterpolateMissingValues(bool deserializing) : base(deserializing) { }
+ public InterpolateMissingValues(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ public override string Description {
+ get { return "Interpolate Missing Values"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ if (!(ColumnGroup.GetColumn(ColumnGroup.SortedColumnIndexes.ElementAt(0)) is DateTimeColumn)
+ || ColumnGroup.SortedColumnIndexes.Count != 1)
+ throw new CommandExecutionException("ColumnGroup must be sorted after a datetime column.", this);
+ columnToSample = (DateTimeColumn)ColumnGroup.Columns.ElementAt(ColumnGroup.SortedColumnIndexes.ElementAt(0));
+ if (columnToSample.SortOrder != SortOrder.Ascending)
+ throw new CommandExecutionException("ColumnGroup must be sorted ascending by the datetime column.", this);
+ if (columnToSample.ContainsNullValues)
+ throw new CommandExecutionException("The datetime column must not contain null values.", this);
+
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ DoubleColumn column;
+ int startIndex = -1;
+ int endIndex = -1;
+ foreach (int col in AffectedColumns) {
+ if (ColumnGroup.GetColumn(col) is DoubleColumn && ColumnGroup.GetColumn(col).ContainsNullValues) {
+ column = (DoubleColumn)ColumnGroup.Columns.ElementAt(col);
+ nullValues.Add(col, new List());
+ startIndex = FindNextNotNullValueIndex(column, startIndex);
+ endIndex = FindNextNotNullValueIndex(column, startIndex);
+ while (endIndex != -1) {
+ if (endIndex - startIndex != 1) {
+ nullValues[col].AddRange(Enumerable.Range(startIndex + 1, endIndex - startIndex - 1));
+ InterpolateValues(column, startIndex, endIndex);
+ }
+ startIndex = endIndex;
+ endIndex = FindNextNotNullValueIndex(column, endIndex);
+ }
+ startIndex = -1;
+ }
+ }
+ ColumnGroup.FireChanged();
+ columnToSample = null;
+ this.ColumnGroup = null;
+ }
+
+ private int FindNextNotNullValueIndex(DoubleColumn column, int startIndex) {
+ int endIndex = -1;
+ for (int i = startIndex + 1; i < column.TotalValuesCount && endIndex == -1; i++)
+ if (column.GetValue(i) != null)
+ endIndex = i;
+ return endIndex;
+ }
+
+ private void InterpolateValues(DoubleColumn column, int startIndex, int endIndex) {
+ double startValue = (double)column.GetValue(startIndex);
+ double endValue = (double)column.GetValue(endIndex);
+ DateTime start = (DateTime)columnToSample.GetValue(startIndex);
+ DateTime end = (DateTime)columnToSample.GetValue(endIndex);
+
+ for (int i = startIndex + 1; i < endIndex; i++) {
+ if (column.GetValue(i) != null)
+ throw new CommandExecutionException("Tried to manipulate non null value.", this);
+ column.ChangeValue(i, ((double)(((DateTime)columnToSample.GetValue(i) - start).TotalSeconds / (end - start).TotalSeconds)) *
+ (endValue - startValue) + startValue);
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/SetPartOfDateTimeCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/SetPartOfDateTimeCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/TimeSeries/SetPartOfDateTimeCommand.cs (revision 15690)
@@ -0,0 +1,105 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Command.View;
+using HeuristicLab.DataImporter.Data;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Command {
+ [StorableClass]
+ [ViewableCommandInfoAttribute("Set Part of DateTime", 1, ColumnGroupState.DateTimeColumnSelected, "Time Series",
+Position = 2, SelectedColumns = 1, OptionsView = typeof(TimeBasedWithoutOffsetCommandView))]
+ public class SetPartOfDateTimeCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private DateTimeColumn oldColumn;
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected SetPartOfDateTimeCommand(bool deserializing) : base(deserializing) { }
+ public SetPartOfDateTimeCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ }
+
+ [Storable]
+ private DateTimeSpan dateTimePart;
+ public DateTimeSpan DateTimePart {
+ get { return this.dateTimePart; }
+ set { this.dateTimePart = value; }
+ }
+
+ public override string Description {
+ get { return "Set specific part of datetime"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldColumn = (DateTimeColumn)ColumnGroup.GetColumn(AffectedColumns[0]);
+ DateTimeColumn newColumn = (DateTimeColumn)oldColumn.CreateCopyOfColumnWithoutValues();
+ DateTime? value;
+ DateTimeSpan newValue;
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+
+ for (int i = 0; i < oldColumn.TotalValuesCount; i++) {
+ newValue = (DateTimeSpan)dateTimePart.Clone();
+ value = (DateTime?)oldColumn.GetValue(i);
+ if (value != null) {
+ if (newValue.Seconds == -1)
+ newValue.Seconds = value.Value.Second;
+ if (newValue.Minutes == -1)
+ newValue.Minutes = value.Value.Minute;
+ if (newValue.Hours == -1)
+ newValue.Hours = value.Value.Hour;
+ if (newValue.Days == -1)
+ newValue.Days = value.Value.Day;
+ if (newValue.Months == -1)
+ newValue.Months = value.Value.Month;
+ if (newValue.Years == -1)
+ newValue.Years = value.Value.Year;
+
+ newColumn.AddValue(new DateTime(newValue.Years, newValue.Months, newValue.Days, newValue.Hours, newValue.Minutes, newValue.Seconds));
+ } else
+ newColumn.AddValue(null);
+ }
+ ColumnGroup.ReplaceColumn(AffectedColumns[0], newColumn);
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup.ReplaceColumn(AffectedColumns[0], oldColumn);
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldSortOrder = null;
+ oldColumn = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/AggregationCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/AggregationCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/AggregationCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class AggregationCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.chbChangeNullValues = new System.Windows.Forms.CheckBox();
+ this.SuspendLayout();
+ //
+ // chbChangeNullValues
+ //
+ this.chbChangeNullValues.AutoSize = true;
+ this.chbChangeNullValues.Checked = true;
+ this.chbChangeNullValues.CheckState = System.Windows.Forms.CheckState.Checked;
+ this.chbChangeNullValues.Location = new System.Drawing.Point(19, 12);
+ this.chbChangeNullValues.Name = "chbChangeNullValues";
+ this.chbChangeNullValues.Size = new System.Drawing.Size(138, 17);
+ this.chbChangeNullValues.TabIndex = 0;
+ this.chbChangeNullValues.Text = "Change only null values";
+ this.chbChangeNullValues.UseVisualStyleBackColor = true;
+ this.chbChangeNullValues.CheckedChanged += new System.EventHandler(chbChangeNullValues_CheckedChanged);
+ //
+ // AggregationCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.chbChangeNullValues);
+ this.Name = "AggregationCommandView";
+ this.Size = new System.Drawing.Size(176, 41);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+ #endregion
+
+ private System.Windows.Forms.CheckBox chbChangeNullValues;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/AggregationCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/AggregationCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/AggregationCommandView.cs (revision 15690)
@@ -0,0 +1,60 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class AggregationCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private AggregationCommandView()
+ : base() {
+ InitializeComponent();
+ }
+
+ public AggregationCommandView(AggregateCommandBase command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new AggregateCommandBase Command {
+ get { return (AggregateCommandBase)base.Command; }
+ protected set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public bool ChangeNullValueOnly {
+ get { return this.Command.ChangeNullValueOnly; }
+ }
+
+ private void chbChangeNullValues_CheckedChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null)
+ this.Command.ChangeNullValueOnly = this.chbChangeNullValues.Checked;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,110 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class BoxCoxTransformationCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtLambda = new System.Windows.Forms.TextBox();
+ this.txtC = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // label2
+ //
+ this.label2.Location = new System.Drawing.Point(8, 11);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(48, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "Lambda";
+ //
+ // txtLambda
+ //
+ this.txtLambda.Location = new System.Drawing.Point(62, 8);
+ this.txtLambda.Name = "txtLambda";
+ this.txtLambda.Size = new System.Drawing.Size(100, 20);
+ this.txtLambda.TabIndex = 1;
+ this.txtLambda.Text = "0";
+ this.txtLambda.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // txtC
+ //
+ this.txtC.Location = new System.Drawing.Point(62, 34);
+ this.txtC.Name = "txtC";
+ this.txtC.Size = new System.Drawing.Size(100, 20);
+ this.txtC.TabIndex = 3;
+ this.txtC.Text = "1";
+ //
+ // label1
+ //
+ this.label1.Location = new System.Drawing.Point(8, 37);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(48, 13);
+ this.label1.TabIndex = 4;
+ this.label1.Text = "C";
+ //
+ // BoxCoxTransformationCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.txtC);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtLambda);
+ this.Controls.Add(this.label2);
+ this.Name = "BoxCoxTransformationCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(170, 62);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtLambda;
+ private System.Windows.Forms.TextBox txtC;
+ private System.Windows.Forms.Label label1;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/BoxCoxTransformationCommandView.cs (revision 15690)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class BoxCoxTransformationCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private BoxCoxTransformationCommandView() {
+ InitializeComponent();
+ }
+
+ public BoxCoxTransformationCommandView(BoxCoxTransformationCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new BoxCoxTransformationCommand Command {
+ get { return (BoxCoxTransformationCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public double Lambda {
+ get { return this.Command.Lambda; }
+ }
+ public double C {
+ get { return this.Command.C; }
+ }
+
+ private void textBox_Validating(object sender, CancelEventArgs e) {
+ TextBox textBox = (TextBox)sender;
+ double value;
+ if (!double.TryParse(textBox.Text, out value)) {
+ e.Cancel = true;
+ MessageBox.Show("A numeric value must be entered!");
+ } else
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ double value;
+ if (double.TryParse(this.txtLambda.Text, out value))
+ this.Command.Lambda = value;
+ if (double.TryParse(this.txtC.Text, out value)) {
+ this.Command.C = value;
+ }
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ChangeDateTimeCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ChangeDateTimeCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ChangeDateTimeCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,115 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class ChangeDateTimeCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.cmbUnit = new System.Windows.Forms.ComboBox();
+ this.txtStartTime = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // cmbUnit
+ //
+ this.cmbUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbUnit.FormattingEnabled = true;
+ this.cmbUnit.Items.AddRange(new object[] {
+ "Seconds",
+ "Minutes",
+ "Hours",
+ "Days"});
+ this.cmbUnit.Location = new System.Drawing.Point(38, 29);
+ this.cmbUnit.Name = "cmbUnit";
+ this.cmbUnit.Size = new System.Drawing.Size(188, 21);
+ this.cmbUnit.TabIndex = 2;
+ this.cmbUnit.SelectedIndexChanged += new System.EventHandler(this.cmbUnit_SelectedIndexChanged);
+ //
+ // txtStartTime
+ //
+ this.txtStartTime.Location = new System.Drawing.Point(38, 3);
+ this.txtStartTime.Name = "txtStartTime";
+ this.txtStartTime.Size = new System.Drawing.Size(188, 20);
+ this.txtStartTime.TabIndex = 0;
+ this.txtStartTime.Validating += new System.ComponentModel.CancelEventHandler(this.txtStartTime_Validating);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(3, 6);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(29, 13);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Start";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(3, 32);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(26, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Unit";
+ //
+ // ChangeDateTimeCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtStartTime);
+ this.Controls.Add(this.cmbUnit);
+ this.Name = "ChangeDateTimeCommandView";
+ this.Size = new System.Drawing.Size(235, 59);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.ComboBox cmbUnit;
+ private System.Windows.Forms.TextBox txtStartTime;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ChangeDateTimeCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ChangeDateTimeCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ChangeDateTimeCommandView.cs (revision 15690)
@@ -0,0 +1,100 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class ChangeDateTimeCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private ChangeDateTimeCommandView() {
+ InitializeComponent();
+ cmbUnit.SelectedIndex = 0;
+ startTime = new DateTime(1900, 1, 1);
+ txtStartTime.Text = startTime.ToString();
+ UpdateCommand();
+ }
+
+ public ChangeDateTimeCommandView(ChangeDateTimeColumnToDoubleColumn command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new ChangeDateTimeColumnToDoubleColumn Command {
+ get { return (ChangeDateTimeColumnToDoubleColumn)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ private DateTimeSpan frequency;
+ public DateTimeSpan Frequency {
+ get { return this.frequency; }
+ }
+
+ private DateTime startTime;
+ public DateTime StartTime {
+ get { return this.startTime; }
+ }
+
+ private void UpdateCommand() {
+ if(this.Command != null) {
+ this.Command.StartTime = this.startTime;
+ this.Command.Frequency = this.Frequency;
+ }
+ }
+
+ private void txtStartTime_Validating(object sender, CancelEventArgs e) {
+ if (!DateTime.TryParse(txtStartTime.Text, out startTime)) {
+ e.Cancel = true;
+ MessageBox.Show("A date value must be entered (e.g. " + DateTime.Now.ToString() + ").");
+ } else
+ this.UpdateCommand();
+ }
+
+ private void cmbUnit_SelectedIndexChanged(object sender, EventArgs e) {
+ CalculateNewFrequency();
+ }
+
+ private void CalculateNewFrequency() {
+ frequency = new DateTimeSpan();
+ switch (cmbUnit.SelectedIndex) {
+ case 0:
+ frequency.Seconds = 1;
+ break;
+ case 1:
+ frequency.Minutes = 1;
+ break;
+ case 2:
+ frequency.Hours = 1;
+ break;
+ case 3:
+ frequency.Days = 1;
+ break;
+ }
+ this.UpdateCommand();
+ }
+
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/DeleteWithThresholdView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/DeleteWithThresholdView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/DeleteWithThresholdView.Designer.cs (revision 15690)
@@ -0,0 +1,67 @@
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class DeleteWithThresholdView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.txtThreshold = new System.Windows.Forms.TextBox();
+ this.lblThreshold = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // txtThreshold
+ //
+ this.txtThreshold.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.txtThreshold.Location = new System.Drawing.Point(66, 3);
+ this.txtThreshold.Name = "txtThreshold";
+ this.txtThreshold.Size = new System.Drawing.Size(100, 20);
+ this.txtThreshold.TabIndex = 0;
+ this.txtThreshold.Validating += new System.ComponentModel.CancelEventHandler(this.txtThreshold_Validating);
+ //
+ // lblThreshold
+ //
+ this.lblThreshold.AutoSize = true;
+ this.lblThreshold.Location = new System.Drawing.Point(3, 6);
+ this.lblThreshold.Name = "lblThreshold";
+ this.lblThreshold.Size = new System.Drawing.Size(57, 13);
+ this.lblThreshold.TabIndex = 1;
+ this.lblThreshold.Text = "Threshold:";
+ //
+ // DeleteWithThreshold
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Controls.Add(this.lblThreshold);
+ this.Controls.Add(this.txtThreshold);
+ this.Name = "DeleteWithThreshold";
+ this.Size = new System.Drawing.Size(173, 28);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtThreshold;
+ private System.Windows.Forms.Label lblThreshold;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/DeleteWithThresholdView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/DeleteWithThresholdView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/DeleteWithThresholdView.cs (revision 15690)
@@ -0,0 +1,65 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class DeleteWithThresholdView : CommandViewBase {
+ public DeleteWithThresholdView() {
+ InitializeComponent();
+ }
+
+ public DeleteWithThresholdView(IThresholdCommand command)
+ : this() {
+ if (command != null) {
+ threshold = command.Threshold;
+ txtThreshold.Text = command.Threshold.ToString();
+ }
+ this.Command = command;
+ }
+
+ public new IThresholdCommand Command {
+ get { return (IThresholdCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ private double threshold;
+
+ private void txtThreshold_Validating(object sender, System.ComponentModel.CancelEventArgs e) {
+ TextBox textBox = (TextBox)sender;
+ e.Cancel = !Double.TryParse(textBox.Text, out threshold);
+ e.Cancel = e.Cancel || threshold < 0.0 || threshold > 1.0;
+ if (e.Cancel) {
+ MessageBox.Show("Threshold has to be between 0.0 and 1.0");
+ } else {
+ UpdateCommand();
+ }
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ Command.Threshold = this.threshold;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,98 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class FilterCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.numWindowSize = new System.Windows.Forms.NumericUpDown();
+ this.label1 = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.numWindowSize)).BeginInit();
+ this.SuspendLayout();
+ //
+ // numWindowSize
+ //
+ this.numWindowSize.Location = new System.Drawing.Point(83, 8);
+ this.numWindowSize.Minimum = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.numWindowSize.Name = "numWindowSize";
+ this.numWindowSize.Size = new System.Drawing.Size(120, 20);
+ this.numWindowSize.TabIndex = 0;
+ this.numWindowSize.Value = new decimal(new int[] {
+ 1,
+ 0,
+ 0,
+ 0});
+ this.numWindowSize.ValueChanged += new System.EventHandler(numWindowSize_ValueChanged);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 10);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(69, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Window Size";
+ //
+ // FilterCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.numWindowSize);
+ this.Name = "FilterCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(211, 36);
+ ((System.ComponentModel.ISupportInitialize)(this.numWindowSize)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+ #endregion
+
+ private System.Windows.Forms.NumericUpDown numWindowSize;
+ private System.Windows.Forms.Label label1;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterCommandView.cs (revision 15690)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class FilterCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private FilterCommandView() {
+ InitializeComponent();
+ }
+
+ public FilterCommandView(FilterCommandBase command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new FilterCommandBase Command {
+ get { return (FilterCommandBase)base.Command; }
+ protected set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public int WindowSize {
+ get { return this.Command.WindowSize; }
+ }
+
+ private void numWindowSize_ValueChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (Command != null)
+ this.Command.WindowSize = (int)this.numWindowSize.Value;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterSavitzkyGolayCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterSavitzkyGolayCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterSavitzkyGolayCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,203 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class FilterSavitzkyGolayCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.numWindowLeft = new System.Windows.Forms.NumericUpDown();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.numWindowRight = new System.Windows.Forms.NumericUpDown();
+ this.label3 = new System.Windows.Forms.Label();
+ this.numOrder = new System.Windows.Forms.NumericUpDown();
+ this.numOrderOfDerivative = new System.Windows.Forms.NumericUpDown();
+ this.label4 = new System.Windows.Forms.Label();
+ ((System.ComponentModel.ISupportInitialize)(this.numWindowLeft)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numWindowRight)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numOrder)).BeginInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numOrderOfDerivative)).BeginInit();
+ this.SuspendLayout();
+ //
+ // numWindowLeft
+ //
+ this.numWindowLeft.Location = new System.Drawing.Point(115, 8);
+ this.numWindowLeft.Maximum = new decimal(new int[] {
+ 0,
+ 0,
+ 0,
+ 0});
+ this.numWindowLeft.Minimum = new decimal(new int[] {
+ 128,
+ 0,
+ 0,
+ -2147483648});
+ this.numWindowLeft.Name = "numWindowLeft";
+ this.numWindowLeft.Size = new System.Drawing.Size(120, 20);
+ this.numWindowLeft.TabIndex = 1;
+ this.numWindowLeft.Value = new decimal(new int[] {
+ 4,
+ 0,
+ 0,
+ -2147483648});
+ this.numWindowLeft.ValueChanged += new System.EventHandler(this.numWindowLeft_ValueChanged);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 10);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(101, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Window start offset:";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(8, 36);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(99, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "Window end offset:";
+ //
+ // numWindowRight
+ //
+ this.numWindowRight.Location = new System.Drawing.Point(115, 34);
+ this.numWindowRight.Maximum = new decimal(new int[] {
+ 128,
+ 0,
+ 0,
+ 0});
+ this.numWindowRight.Name = "numWindowRight";
+ this.numWindowRight.Size = new System.Drawing.Size(120, 20);
+ this.numWindowRight.TabIndex = 3;
+ this.numWindowRight.Value = new decimal(new int[] {
+ 4,
+ 0,
+ 0,
+ 0});
+ this.numWindowRight.ValueChanged += new System.EventHandler(this.numWindowRight_ValueChanged);
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(9, 89);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(100, 13);
+ this.label3.TabIndex = 6;
+ this.label3.Text = "Order of polynomial:";
+ //
+ // numOrder
+ //
+ this.numOrder.Location = new System.Drawing.Point(115, 87);
+ this.numOrder.Maximum = new decimal(new int[] {
+ 8,
+ 0,
+ 0,
+ 0});
+ this.numOrder.Name = "numOrder";
+ this.numOrder.Size = new System.Drawing.Size(120, 20);
+ this.numOrder.TabIndex = 7;
+ this.numOrder.Value = new decimal(new int[] {
+ 2,
+ 0,
+ 0,
+ 0});
+ this.numOrder.ValueChanged += new System.EventHandler(this.numOrder_ValueChanged);
+ //
+ // numOrderOfDerivative
+ //
+ this.numOrderOfDerivative.Location = new System.Drawing.Point(115, 60);
+ this.numOrderOfDerivative.Maximum = new decimal(new int[] {
+ 3,
+ 0,
+ 0,
+ 0});
+ this.numOrderOfDerivative.Name = "numOrderOfDerivative";
+ this.numOrderOfDerivative.Size = new System.Drawing.Size(120, 20);
+ this.numOrderOfDerivative.TabIndex = 5;
+ this.numOrderOfDerivative.ValueChanged += new System.EventHandler(this.numOrderOfDerivative_ValueChanged);
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(8, 62);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(97, 13);
+ this.label4.TabIndex = 4;
+ this.label4.Text = "Order of derivative:";
+ //
+ // FilterSavitzkyGolayCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.numOrderOfDerivative);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.numOrder);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.numWindowRight);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.numWindowLeft);
+ this.Name = "FilterSavitzkyGolayCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(246, 117);
+ ((System.ComponentModel.ISupportInitialize)(this.numWindowLeft)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numWindowRight)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numOrder)).EndInit();
+ ((System.ComponentModel.ISupportInitialize)(this.numOrderOfDerivative)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+ #endregion
+
+ private System.Windows.Forms.NumericUpDown numWindowLeft;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.NumericUpDown numWindowRight;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.NumericUpDown numOrder;
+ private System.Windows.Forms.NumericUpDown numOrderOfDerivative;
+ private System.Windows.Forms.Label label4;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterSavitzkyGolayCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterSavitzkyGolayCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/FilterSavitzkyGolayCommandView.cs (revision 15690)
@@ -0,0 +1,84 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class FilterSavitzkyGolayCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private FilterSavitzkyGolayCommandView() {
+ InitializeComponent();
+ }
+
+ public FilterSavitzkyGolayCommandView(FilterSavitzkyGolayCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new FilterSavitzkyGolayCommand Command {
+ get { return (FilterSavitzkyGolayCommand)base.Command; }
+ protected set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public int WindowLeft {
+ get { return this.Command.WindowLeft; }
+ }
+ public int WindowRight {
+ get { return this.Command.WindowRight; }
+ }
+ public int Order {
+ get { return this.Command.Order; }
+ }
+ public int OrderOfDerivative {
+ get { return this.Command.OrderOfDerivative; }
+ }
+
+ private void numWindowLeft_ValueChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void numWindowRight_ValueChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void numOrder_ValueChanged(object sender, EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void numOrderOfDerivative_ValueChanged(object sender, EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (Command != null) {
+ this.Command.WindowLeft = (int)this.numWindowLeft.Value;
+ this.Command.WindowRight = (int)this.numWindowRight.Value;
+ this.Command.Order = (int)this.numOrder.Value;
+ this.Command.OrderOfDerivative = (int) this.numOrderOfDerivative.Value;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/LinearTransformationCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/LinearTransformationCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/LinearTransformationCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,112 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class LinearTransformationCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtSlope = new System.Windows.Forms.TextBox();
+ this.txtOffset = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 10);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(34, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Slope";
+ //
+ // label2
+ //
+ this.label2.Location = new System.Drawing.Point(8, 36);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(48, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "Offset";
+ //
+ // txtSlope
+ //
+ this.txtSlope.Location = new System.Drawing.Point(62, 7);
+ this.txtSlope.Name = "txtSlope";
+ this.txtSlope.Size = new System.Drawing.Size(100, 20);
+ this.txtSlope.TabIndex = 0;
+ this.txtSlope.Text = "0";
+ this.txtSlope.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // txtOffset
+ //
+ this.txtOffset.Location = new System.Drawing.Point(62, 33);
+ this.txtOffset.Name = "txtOffset";
+ this.txtOffset.Size = new System.Drawing.Size(100, 20);
+ this.txtOffset.TabIndex = 1;
+ this.txtOffset.Text = "0";
+ this.txtOffset.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // LinearTransformationCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.txtOffset);
+ this.Controls.Add(this.txtSlope);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "LinearTransformationCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(170, 61);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtSlope;
+ private System.Windows.Forms.TextBox txtOffset;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/LinearTransformationCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/LinearTransformationCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/LinearTransformationCommandView.cs (revision 15690)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class LinearTransformationCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private LinearTransformationCommandView() {
+ InitializeComponent();
+ }
+
+ public LinearTransformationCommandView(LinearTransformationCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new LinearTransformationCommand Command {
+ get { return (LinearTransformationCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public double Slope {
+ get { return this.Command.Offset; }
+ }
+
+ public double Offset {
+ get { return this.Command.Slope; }
+ }
+
+ private void textBox_Validating(object sender, CancelEventArgs e) {
+ TextBox textBox = (TextBox)sender;
+ double value;
+ if (!double.TryParse(textBox.Text, out value)) {
+ e.Cancel = true;
+ MessageBox.Show("A numeric value must be entered!");
+ } else
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ double value;
+ if (double.TryParse(this.txtOffset.Text, out value))
+ this.Command.Offset = value;
+ if (double.TryParse(this.txtSlope.Text, out value))
+ this.Command.Slope = value;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/MinMaxCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/MinMaxCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/MinMaxCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,112 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class MinMaxCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtMin = new System.Windows.Forms.TextBox();
+ this.txtMax = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 10);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(48, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Minimum";
+ //
+ // label2
+ //
+ this.label2.Location = new System.Drawing.Point(8, 36);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(48, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "Maximum";
+ //
+ // txtMin
+ //
+ this.txtMin.Location = new System.Drawing.Point(62, 7);
+ this.txtMin.Name = "txtMin";
+ this.txtMin.Size = new System.Drawing.Size(100, 20);
+ this.txtMin.TabIndex = 0;
+ this.txtMin.Text = "0";
+ this.txtMin.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // txtMax
+ //
+ this.txtMax.Location = new System.Drawing.Point(62, 33);
+ this.txtMax.Name = "txtMax";
+ this.txtMax.Size = new System.Drawing.Size(100, 20);
+ this.txtMax.TabIndex = 1;
+ this.txtMax.Text = "0";
+ this.txtMax.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // MinMaxCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.txtMax);
+ this.Controls.Add(this.txtMin);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "MinMaxCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(170, 61);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtMin;
+ private System.Windows.Forms.TextBox txtMax;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/MinMaxCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/MinMaxCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/MinMaxCommandView.cs (revision 15690)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class MinMaxCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private MinMaxCommandView() {
+ InitializeComponent();
+ }
+
+ public MinMaxCommandView(ScalingBetweenMinAndMaxCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new ScalingBetweenMinAndMaxCommand Command {
+ get { return (ScalingBetweenMinAndMaxCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public double MinValue {
+ get { return Command.MinValue; }
+ }
+
+ public double MaxValue {
+ get { return Command.MaxValue; }
+ }
+
+ private void textBox_Validating(object sender, CancelEventArgs e) {
+ TextBox textBox = (TextBox)sender;
+ double value;
+ if (!double.TryParse(textBox.Text, out value)) {
+ e.Cancel = true;
+ MessageBox.Show("A numeric value must be entered!");
+ } else
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ double value;
+ if (double.TryParse(this.txtMin.Text, out value))
+ this.Command.MinValue = value;
+ if (double.TryParse(this.txtMax.Text, out value))
+ this.Command.MaxValue = value;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/NormalDistribuationCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/NormalDistribuationCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/NormalDistribuationCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,112 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class NormalDistributionCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtMean = new System.Windows.Forms.TextBox();
+ this.txtStandardDeviation = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 10);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(34, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Mean";
+ //
+ // label2
+ //
+ this.label2.Location = new System.Drawing.Point(8, 36);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(48, 13);
+ this.label2.TabIndex = 2;
+ this.label2.Text = "StdDev";
+ //
+ // txtMean
+ //
+ this.txtMean.Location = new System.Drawing.Point(62, 7);
+ this.txtMean.Name = "txtMean";
+ this.txtMean.Size = new System.Drawing.Size(100, 20);
+ this.txtMean.TabIndex = 0;
+ this.txtMean.Text = "0";
+ this.txtMean.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // txtStandardDeviation
+ //
+ this.txtStandardDeviation.Location = new System.Drawing.Point(62, 33);
+ this.txtStandardDeviation.Name = "txtStandardDeviation";
+ this.txtStandardDeviation.Size = new System.Drawing.Size(100, 20);
+ this.txtStandardDeviation.TabIndex = 1;
+ this.txtStandardDeviation.Text = "0";
+ this.txtStandardDeviation.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // NormalDistributionCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.txtStandardDeviation);
+ this.Controls.Add(this.txtMean);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Name = "NormalDistributionCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(170, 61);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtMean;
+ private System.Windows.Forms.TextBox txtStandardDeviation;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/NormalDistribuationCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/NormalDistribuationCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/NormalDistribuationCommandView.cs (revision 15690)
@@ -0,0 +1,74 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class NormalDistributionCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private NormalDistributionCommandView() {
+ InitializeComponent();
+ }
+
+ public NormalDistributionCommandView(NormalDistributionScalingCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new NormalDistributionScalingCommand Command {
+ get { return (NormalDistributionScalingCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public double Mean {
+ get { return Command.Mean; }
+ }
+
+ public double StandardDeviation {
+ get { return Command.StandardDeviation; }
+ }
+
+ private void textBox_Validating(object sender, CancelEventArgs e) {
+ TextBox textBox = (TextBox)sender;
+ double value;
+ if (!double.TryParse(textBox.Text, out value)) {
+ e.Cancel = true;
+ MessageBox.Show("A numeric value must be entered!");
+ } else
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ double value;
+ if (double.TryParse(this.txtMean.Text, out value))
+ this.Command.Mean = value;
+ if (double.TryParse(this.txtStandardDeviation.Text, out value))
+ this.Command.StandardDeviation = value;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ProgrammableColumnCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ProgrammableColumnCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ProgrammableColumnCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,88 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class ProgrammableColumnCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.expressionLabel = new System.Windows.Forms.Label();
+ this.expressionTextBox = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // expressionLabel
+ //
+ this.expressionLabel.AutoSize = true;
+ this.expressionLabel.Location = new System.Drawing.Point(8, 10);
+ this.expressionLabel.Name = "expressionLabel";
+ this.expressionLabel.Size = new System.Drawing.Size(61, 13);
+ this.expressionLabel.TabIndex = 1;
+ this.expressionLabel.Text = "Expression:";
+ //
+ // expressionTextBox
+ //
+ this.expressionTextBox.Location = new System.Drawing.Point(79, 7);
+ this.expressionTextBox.Name = "expressionTextBox";
+ this.expressionTextBox.Size = new System.Drawing.Size(187, 20);
+ this.expressionTextBox.TabIndex = 2;
+ this.expressionTextBox.TextChanged += new System.EventHandler(this.expressionTextBox_TextChanged);
+ //
+ // ProgrammableColumnCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.expressionTextBox);
+ this.Controls.Add(this.expressionLabel);
+ this.Name = "ProgrammableColumnCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(274, 35);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label expressionLabel;
+ private System.Windows.Forms.TextBox expressionTextBox;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ProgrammableColumnCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ProgrammableColumnCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ProgrammableColumnCommandView.cs (revision 15690)
@@ -0,0 +1,60 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class ProgrammableColumnCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private ProgrammableColumnCommandView() {
+ InitializeComponent();
+ this.expressionTextBox.Text = "A";
+ }
+
+ public ProgrammableColumnCommandView(AddNewProgrammableColumnCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new AddNewProgrammableColumnCommand Command {
+ get { return (AddNewProgrammableColumnCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public string Expression {
+ get { return expressionTextBox.Text; }
+ }
+
+ private void UpdateCommand() {
+ if (Command != null)
+ Command.Expression = this.expressionTextBox.Text;
+ }
+
+ private void expressionTextBox_TextChanged(object sender, EventArgs e) {
+ this.UpdateCommand();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchAndReplaceCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchAndReplaceCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchAndReplaceCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,97 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class SearchAndReplaceCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.txtReplaceValue = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // txtReplaceValue
+ //
+ this.txtReplaceValue.Location = new System.Drawing.Point(100, 66);
+ this.txtReplaceValue.Name = "txtReplaceValue";
+ this.txtReplaceValue.Size = new System.Drawing.Size(130, 20);
+ this.txtReplaceValue.TabIndex = 2;
+ this.txtReplaceValue.TextChanged += new System.EventHandler(this.txtReplaceValue_TextChanged);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(8, 69);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(69, 13);
+ this.label2.TabIndex = 5;
+ this.label2.Text = "Replace with";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(8, 69);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(77, 13);
+ this.label4.TabIndex = 8;
+ this.label4.Text = "Replace Value";
+ //
+ // SearchAndReplaceCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.txtReplaceValue);
+ this.Name = "SearchAndReplaceCommandView";
+ this.Size = new System.Drawing.Size(240, 98);
+ this.Controls.SetChildIndex(this.txtReplaceValue, 0);
+ this.Controls.SetChildIndex(this.label4, 0);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+ #endregion
+
+ private System.Windows.Forms.TextBox txtReplaceValue;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label4;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchAndReplaceCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchAndReplaceCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchAndReplaceCommandView.cs (revision 15690)
@@ -0,0 +1,61 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class SearchAndReplaceCommandView : SearchWithMatchOperationCommandView {
+ public SearchAndReplaceCommandView()
+ : base() {
+ InitializeComponent();
+ this.txtReplaceValue.Text = "0";
+ }
+
+ public SearchAndReplaceCommandView(SearchAndReplaceCommand command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new SearchAndReplaceCommand Command {
+ get { return (SearchAndReplaceCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public string ReplaceValue {
+ get { return this.Command.ReplaceValue; }
+ }
+
+ private void txtReplaceValue_TextChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null)
+ this.Command.ReplaceValue = this.txtReplaceValue.Text;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,84 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class SearchCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.txtSearchValue = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // txtSearchValue
+ //
+ this.txtSearchValue.Location = new System.Drawing.Point(100, 13);
+ this.txtSearchValue.Name = "txtSearchValue";
+ this.txtSearchValue.Size = new System.Drawing.Size(130, 20);
+ this.txtSearchValue.TabIndex = 0;
+ this.txtSearchValue.TextChanged += new System.EventHandler(this.txtSearchValue_TextChanged);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 16);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(71, 13);
+ this.label1.TabIndex = 4;
+ this.label1.Text = "Search Value";
+ //
+ // SearchCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtSearchValue);
+ this.Name = "SearchCommandView";
+ this.Size = new System.Drawing.Size(240, 42);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+ #endregion
+
+ private System.Windows.Forms.TextBox txtSearchValue;
+ private System.Windows.Forms.Label label1;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchCommandView.cs (revision 15690)
@@ -0,0 +1,59 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class SearchCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ public SearchCommandView() :base() {
+ InitializeComponent();
+ txtSearchValue.Text = "0";
+ }
+
+ public SearchCommandView(SearchCommandBase command) {
+ this.Command = command;
+ }
+
+ public new SearchCommandBase Command {
+ get { return (SearchCommandBase)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public string SearchValue {
+ get { return this.Command.SearchValue; }
+ }
+
+ private void txtSearchValue_TextChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null)
+ this.Command.SearchValue = this.txtSearchValue.Text;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchWithMatchOperationCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchWithMatchOperationCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchWithMatchOperationCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,85 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class SearchWithMatchOperationCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.label3 = new System.Windows.Forms.Label();
+ this.cmbMatchOperation = new System.Windows.Forms.ComboBox();
+ this.SuspendLayout();
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(8, 42);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(37, 13);
+ this.label3.TabIndex = 7;
+ this.label3.Text = "Match";
+ //
+ // cmbMatchOperation
+ //
+ this.cmbMatchOperation.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbMatchOperation.FormattingEnabled = true;
+ this.cmbMatchOperation.Location = new System.Drawing.Point(100, 39);
+ this.cmbMatchOperation.Name = "cmbMatchOperation";
+ this.cmbMatchOperation.Size = new System.Drawing.Size(130, 21);
+ this.cmbMatchOperation.TabIndex = 1;
+ this.cmbMatchOperation.SelectedIndexChanged += new System.EventHandler(cmbMatchOperation_SelectedIndexChanged);
+ //
+ // ClearValuesWithConditionCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.cmbMatchOperation);
+ this.Name = "ClearValuesWithConditionCommandView";
+ this.Size = new System.Drawing.Size(240, 72);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+ }
+ #endregion
+
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.ComboBox cmbMatchOperation;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchWithMatchOperationCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchWithMatchOperationCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/SearchWithMatchOperationCommandView.cs (revision 15690)
@@ -0,0 +1,61 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class SearchWithMatchOperationCommandView : SearchCommandView {
+ public SearchWithMatchOperationCommandView()
+ : base() {
+ InitializeComponent();
+ cmbMatchOperation.Items.AddRange(Enum.GetNames(typeof(HeuristicLab.DataImporter.Command.MatchOperation)));
+ cmbMatchOperation.SelectedIndex = 0;
+ }
+
+ public SearchWithMatchOperationCommandView(SearchWithMatchOperationCommandBase command) :this(){
+ this.Command = command;
+ }
+
+ public new SearchWithMatchOperationCommandBase Command {
+ get { return (SearchWithMatchOperationCommandBase)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public MatchOperation MatchOperation {
+ get { return this.Command.MatchOperation; }
+ }
+
+ private void cmbMatchOperation_SelectedIndexChanged(object sender, System.EventArgs e) {
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (Command != null)
+ this.Command.MatchOperation = (MatchOperation)Enum.Parse(typeof(MatchOperation), cmbMatchOperation.SelectedItem.ToString());
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,68 @@
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class ThresholdCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.label1 = new System.Windows.Forms.Label();
+ this.txtThreshold = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(8, 10);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(54, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Threshold";
+ //
+ // txtThreshold
+ //
+ this.txtThreshold.Location = new System.Drawing.Point(62, 7);
+ this.txtThreshold.Name = "txtThreshold";
+ this.txtThreshold.Size = new System.Drawing.Size(100, 20);
+ this.txtThreshold.TabIndex = 0;
+ this.txtThreshold.Text = "0";
+ this.txtThreshold.Validating += new System.ComponentModel.CancelEventHandler(this.textBox_Validating);
+ //
+ // ThresholdCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoSize = true;
+ this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.Controls.Add(this.txtThreshold);
+ this.Controls.Add(this.label1);
+ this.Name = "ThresholdCommandView";
+ this.Padding = new System.Windows.Forms.Padding(5);
+ this.Size = new System.Drawing.Size(170, 35);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.TextBox txtThreshold;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.cs (revision 15690)
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class ThresholdCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private ThresholdCommandView() {
+ InitializeComponent();
+ this.txtThreshold.Text = (0.5).ToString();
+ }
+
+ public ThresholdCommandView(DeleteColumnsWithTooFewValuesCommand command)
+ : this() {
+ this.Command = command;
+ this.UpdateCommand();
+ }
+
+ public new DeleteColumnsWithTooFewValuesCommand Command {
+ get { return (DeleteColumnsWithTooFewValuesCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ public double Threshold {
+ get { return Command.Threshold; }
+ }
+
+ private void textBox_Validating(object sender, CancelEventArgs e) {
+ TextBox textBox = (TextBox)sender;
+ double value;
+ if (!double.TryParse(textBox.Text, out value))
+ e.Cancel = true;
+ if (value < 0 || value > 1)
+ e.Cancel = true;
+ if (e.Cancel)
+ MessageBox.Show("A numeric value between 0 and 1 must be entered!");
+ else
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ double value;
+ if (double.TryParse(txtThreshold.Text, out value))
+ this.Command.Threshold = value;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.resx
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.resx (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/ThresholdCommandView.resx (revision 15690)
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,129 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class TimeBasedCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.txtFrequency = new System.Windows.Forms.TextBox();
+ this.cmbUnit = new System.Windows.Forms.ComboBox();
+ this.txtStartTime = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label2 = new System.Windows.Forms.Label();
+ this.SuspendLayout();
+ //
+ // txtFrequency
+ //
+ this.txtFrequency.Location = new System.Drawing.Point(67, 29);
+ this.txtFrequency.Name = "txtFrequency";
+ this.txtFrequency.Size = new System.Drawing.Size(61, 20);
+ this.txtFrequency.TabIndex = 1;
+ this.txtFrequency.Text = "1";
+ this.txtFrequency.Validating += new System.ComponentModel.CancelEventHandler(this.txtFrequency_Validating);
+ //
+ // cmbUnit
+ //
+ this.cmbUnit.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cmbUnit.FormattingEnabled = true;
+ this.cmbUnit.Items.AddRange(new object[] {
+ "Seconds",
+ "Minutes",
+ "Hours",
+ "Days",
+ "Months",
+ "Years"});
+ this.cmbUnit.Location = new System.Drawing.Point(134, 29);
+ this.cmbUnit.Name = "cmbUnit";
+ this.cmbUnit.Size = new System.Drawing.Size(121, 21);
+ this.cmbUnit.TabIndex = 2;
+ this.cmbUnit.SelectedIndexChanged += new System.EventHandler(this.cmbUnit_SelectedIndexChanged);
+ //
+ // txtStartTime
+ //
+ this.txtStartTime.Location = new System.Drawing.Point(67, 3);
+ this.txtStartTime.Name = "txtStartTime";
+ this.txtStartTime.Size = new System.Drawing.Size(188, 20);
+ this.txtStartTime.TabIndex = 0;
+ this.txtStartTime.Validating += new System.ComponentModel.CancelEventHandler(this.txtStartTime_Validating);
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(32, 6);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(29, 13);
+ this.label1.TabIndex = 3;
+ this.label1.Text = "Start";
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(4, 32);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(57, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Frequency";
+ //
+ // TimeBasedCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.txtStartTime);
+ this.Controls.Add(this.cmbUnit);
+ this.Controls.Add(this.txtFrequency);
+ this.Name = "TimeBasedCommandView";
+ this.Size = new System.Drawing.Size(262, 59);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtFrequency;
+ private System.Windows.Forms.ComboBox cmbUnit;
+ private System.Windows.Forms.TextBox txtStartTime;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label2;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedCommandView.cs (revision 15690)
@@ -0,0 +1,122 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class TimeBasedCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private TimeBasedCommandView() {
+ InitializeComponent();
+ cmbUnit.SelectedIndex = 0;
+ frequency = new DateTimeSpan();
+ frequency.Seconds = 1;
+ startTime = DateTime.Now;
+ txtStartTime.Text = startTime.ToString();
+ UpdateCommand();
+ }
+
+ public TimeBasedCommandView(EquidistantTimeSeriesCommandBase command)
+ : this() {
+ this.Command = command;
+ }
+
+ public new EquidistantTimeSeriesCommandBase Command {
+ get { return (EquidistantTimeSeriesCommandBase)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ private DateTimeSpan frequency;
+ public DateTimeSpan SampleFrequency {
+ get { return this.frequency; }
+ }
+
+ private DateTime startTime;
+ public DateTime StartTime {
+ get { return this.startTime; }
+ }
+
+ private void txtFrequency_Validating(object sender, CancelEventArgs e) {
+ int value;
+ if (!Int32.TryParse(txtFrequency.Text, out value))
+ e.Cancel = true;
+ else if (value <= 0)
+ e.Cancel = true;
+
+ if (e.Cancel)
+ MessageBox.Show("A numeric positive value must be entered!");
+ else
+ CalculateNewFrequency();
+ }
+
+ private void UpdateCommand() {
+ if(this.Command != null) {
+ this.Command.StartTime = this.startTime;
+ this.Command.SampleFrequency = this.SampleFrequency;
+ }
+ }
+
+ private void txtStartTime_Validating(object sender, CancelEventArgs e) {
+ if (!DateTime.TryParse(txtStartTime.Text, out startTime)) {
+ e.Cancel = true;
+ MessageBox.Show("A date value must be entered (e.g. " + DateTime.Now.ToString() + ").");
+ } else
+ this.UpdateCommand();
+ }
+
+ private void cmbUnit_SelectedIndexChanged(object sender, EventArgs e) {
+ CalculateNewFrequency();
+ }
+
+ private void CalculateNewFrequency() {
+ int value = Int32.Parse(txtFrequency.Text);
+ frequency = new DateTimeSpan();
+ switch (cmbUnit.SelectedIndex) {
+ case 0:
+ frequency.Seconds = value;
+ break;
+ case 1:
+ frequency.Minutes = value;
+ break;
+ case 2:
+ frequency.Hours = value;
+ break;
+ case 3:
+ frequency.Days = value;
+ break;
+ case 4:
+ frequency.Months = value;
+ break;
+ case 5:
+ frequency.Years = value;
+ break;
+ }
+ this.UpdateCommand();
+ }
+
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedWithoutOffsetCommandView.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedWithoutOffsetCommandView.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedWithoutOffsetCommandView.Designer.cs (revision 15690)
@@ -0,0 +1,200 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Command.View {
+ partial class TimeBasedWithoutOffsetCommandView {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.txtSeconds = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label1 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.label6 = new System.Windows.Forms.Label();
+ this.txtMinutes = new System.Windows.Forms.TextBox();
+ this.txtDays = new System.Windows.Forms.TextBox();
+ this.txtMonths = new System.Windows.Forms.TextBox();
+ this.txtHours = new System.Windows.Forms.TextBox();
+ this.txtYears = new System.Windows.Forms.TextBox();
+ this.SuspendLayout();
+ //
+ // txtSeconds
+ //
+ this.txtSeconds.Location = new System.Drawing.Point(93, 3);
+ this.txtSeconds.Name = "txtSeconds";
+ this.txtSeconds.Size = new System.Drawing.Size(61, 20);
+ this.txtSeconds.TabIndex = 0;
+ this.txtSeconds.Validating += new System.ComponentModel.CancelEventHandler(this.txtDateTimePart_Validating);
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(5, 6);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(49, 13);
+ this.label2.TabIndex = 4;
+ this.label2.Text = "Seconds";
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(5, 32);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(44, 13);
+ this.label1.TabIndex = 5;
+ this.label1.Text = "Minutes";
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(5, 58);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(35, 13);
+ this.label3.TabIndex = 6;
+ this.label3.Text = "Hours";
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Location = new System.Drawing.Point(5, 84);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(31, 13);
+ this.label4.TabIndex = 7;
+ this.label4.Text = "Days";
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Location = new System.Drawing.Point(3, 110);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(42, 13);
+ this.label5.TabIndex = 8;
+ this.label5.Text = "Months";
+ //
+ // label6
+ //
+ this.label6.AutoSize = true;
+ this.label6.Location = new System.Drawing.Point(5, 136);
+ this.label6.Name = "label6";
+ this.label6.Size = new System.Drawing.Size(34, 13);
+ this.label6.TabIndex = 9;
+ this.label6.Text = "Years";
+ //
+ // txtMinutes
+ //
+ this.txtMinutes.Location = new System.Drawing.Point(93, 29);
+ this.txtMinutes.Name = "txtMinutes";
+ this.txtMinutes.Size = new System.Drawing.Size(61, 20);
+ this.txtMinutes.TabIndex = 1;
+ this.txtMinutes.Validating += new System.ComponentModel.CancelEventHandler(this.txtDateTimePart_Validating);
+ //
+ // txtDays
+ //
+ this.txtDays.Location = new System.Drawing.Point(93, 81);
+ this.txtDays.Name = "txtDays";
+ this.txtDays.Size = new System.Drawing.Size(61, 20);
+ this.txtDays.TabIndex = 3;
+ this.txtDays.Validating += new System.ComponentModel.CancelEventHandler(this.txtDateTimePart_Validating);
+ //
+ // txtMonths
+ //
+ this.txtMonths.Location = new System.Drawing.Point(93, 107);
+ this.txtMonths.Name = "txtMonths";
+ this.txtMonths.Size = new System.Drawing.Size(61, 20);
+ this.txtMonths.TabIndex = 4;
+ this.txtMonths.Validating += new System.ComponentModel.CancelEventHandler(this.txtDateTimePart_Validating);
+ //
+ // txtHours
+ //
+ this.txtHours.Location = new System.Drawing.Point(93, 55);
+ this.txtHours.Name = "txtHours";
+ this.txtHours.Size = new System.Drawing.Size(61, 20);
+ this.txtHours.TabIndex = 2;
+ this.txtHours.Validating += new System.ComponentModel.CancelEventHandler(this.txtDateTimePart_Validating);
+ //
+ // txtYears
+ //
+ this.txtYears.Location = new System.Drawing.Point(93, 133);
+ this.txtYears.Name = "txtYears";
+ this.txtYears.Size = new System.Drawing.Size(61, 20);
+ this.txtYears.TabIndex = 5;
+ this.txtYears.Validating += new System.ComponentModel.CancelEventHandler(this.txtDateTimePart_Validating);
+ //
+ // TimeBasedWithoutOffsetCommandView
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.Controls.Add(this.txtYears);
+ this.Controls.Add(this.txtHours);
+ this.Controls.Add(this.txtMonths);
+ this.Controls.Add(this.txtDays);
+ this.Controls.Add(this.txtMinutes);
+ this.Controls.Add(this.label6);
+ this.Controls.Add(this.label5);
+ this.Controls.Add(this.label4);
+ this.Controls.Add(this.label3);
+ this.Controls.Add(this.label1);
+ this.Controls.Add(this.label2);
+ this.Controls.Add(this.txtSeconds);
+ this.Name = "TimeBasedWithoutOffsetCommandView";
+ this.Size = new System.Drawing.Size(184, 163);
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.TextBox txtSeconds;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.Label label6;
+ private System.Windows.Forms.TextBox txtMinutes;
+ private System.Windows.Forms.TextBox txtDays;
+ private System.Windows.Forms.TextBox txtMonths;
+ private System.Windows.Forms.TextBox txtHours;
+ private System.Windows.Forms.TextBox txtYears;
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedWithoutOffsetCommandView.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedWithoutOffsetCommandView.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Command/View/TimeBasedWithoutOffsetCommandView.cs (revision 15690)
@@ -0,0 +1,110 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Text;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data;
+
+namespace HeuristicLab.DataImporter.Command.View {
+ public partial class TimeBasedWithoutOffsetCommandView : HeuristicLab.DataImporter.Data.CommandBase.CommandViewBase {
+ private TimeBasedWithoutOffsetCommandView() {
+ InitializeComponent();
+ dateTimePart = new DateTimeSpan();
+ CalculateNewDateTimePart();
+ }
+
+ public TimeBasedWithoutOffsetCommandView(SetPartOfDateTimeCommand command) :this() {
+ this.Command = command;
+ }
+
+ public new SetPartOfDateTimeCommand Command {
+ get { return (SetPartOfDateTimeCommand)base.Command; }
+ set { base.Command = value; this.UpdateCommand(); }
+ }
+
+ private DateTimeSpan dateTimePart;
+ public DateTimeSpan DateTimePart {
+ get { return Command.DateTimePart; }
+ }
+
+
+ private void txtDateTimePart_Validating(object sender, CancelEventArgs e) {
+ TextBox textBox = (TextBox) sender;
+ int value;
+ if (string.IsNullOrEmpty(textBox.Text))
+ e.Cancel = false;
+ else if (!Int32.TryParse(textBox.Text, out value))
+ e.Cancel = true;
+ else if (value < 0)
+ e.Cancel = true;
+
+ if (e.Cancel)
+ MessageBox.Show("A numeric positive value or 0 must be entered!");
+ else
+ CalculateNewDateTimePart();
+ }
+
+ private void CalculateNewDateTimePart() {
+ if (!string.IsNullOrEmpty(txtSeconds.Text))
+ dateTimePart.Seconds = Int32.Parse(txtSeconds.Text);
+ else
+ dateTimePart.Seconds = -1;
+
+ if (!string.IsNullOrEmpty(txtMinutes.Text))
+ dateTimePart.Minutes = Int32.Parse(txtMinutes.Text);
+ else
+ dateTimePart.Minutes = -1;
+
+ if (!string.IsNullOrEmpty(txtHours.Text))
+ dateTimePart.Hours = Int32.Parse(txtHours.Text);
+ else
+ dateTimePart.Hours = -1;
+
+ if (!string.IsNullOrEmpty(txtDays.Text))
+ dateTimePart.Days = Int32.Parse(txtDays.Text);
+ else
+ dateTimePart.Days = -1;
+
+ if (!string.IsNullOrEmpty(txtMonths.Text))
+ dateTimePart.Months = Int32.Parse(txtMonths.Text);
+ else
+ dateTimePart.Months = -1;
+
+ if (!string.IsNullOrEmpty(txtYears.Text))
+ dateTimePart.Years = Int32.Parse(txtYears.Text);
+ else
+ dateTimePart.Years = -1;
+
+ this.UpdateCommand();
+ }
+
+ private void UpdateCommand() {
+ if (this.Command != null) {
+ Command.DateTimePart = this.dateTimePart;
+ }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/AddRowCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/AddRowCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/AddRowCommand.cs (revision 15690)
@@ -0,0 +1,75 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class AddRowCommand : ColumnGroupCommandBase {
+ [Storable]
+ private IComparable[] newRow;
+
+ private int position;
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected AddRowCommand(bool deserializing) : base(deserializing) { }
+
+ public AddRowCommand(DataSet dataSet, string columnGroupName, IComparable[] row)
+ : base(dataSet, columnGroupName) {
+ this.newRow = row;
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ ColumnGroup.AddRow(newRow);
+ this.position = ColumnGroup.RowCount - 1;
+ ColumnGroup.ResetSorting();
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup.DeleteRow(position);
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldSortOrder = null;
+ this.position = -1;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "New row added"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/ChangeValueCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/ChangeValueCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/ChangeValueCommand.cs (revision 15690)
@@ -0,0 +1,76 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class ChangeValueCommand : ColumnCommandBase {
+ [Storable]
+ private int position;
+ [Storable]
+ private IComparable newValue;
+
+ private IComparable oldValue;
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected ChangeValueCommand(bool deserializing) : base(deserializing) { }
+
+ public ChangeValueCommand(DataSet dataSet, string columnGroupName, int columnIndex, int position, IComparable newValue)
+ : base(dataSet, columnGroupName, columnIndex) {
+ this.position = position;
+ this.newValue = newValue;
+ }
+
+ public override void Execute() {
+ base.Execute();
+ this.oldValue = Column.GetValue(position);
+ Column.ChangeValueOrNull(position, newValue);
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ ColumnGroup.ResetSorting();
+ Column.FireChanged();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ Column.ChangeValue(position, oldValue);
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldSortOrder = null;
+ Column.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Column value changed"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/ChangeValuesToNullCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/ChangeValuesToNullCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/ChangeValuesToNullCommand.cs (revision 15690)
@@ -0,0 +1,80 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class ChangeValuesToNullCommand : ColumnGroupCommandBase {
+ [Storable]
+ private Dictionary cellValues;
+
+ private ICollection oldSortedColumnIndexes;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected ChangeValuesToNullCommand(bool deserializing) : base(deserializing) { }
+
+ public ChangeValuesToNullCommand(DataSet dataSet, string columnGroupName, IEnumerable cellIndexes)
+ : base(dataSet, columnGroupName) {
+ cellValues = new Dictionary();
+ foreach (Point cellIndex in cellIndexes)
+ cellValues.Add(cellIndex, null);
+ }
+
+ public override void Execute() {
+ base.Execute();
+ foreach (Point cellIndex in cellValues.Keys.ToList()) {
+ cellValues[cellIndex] = ColumnGroup.GetColumn(cellIndex.X).GetValue(cellIndex.Y);
+ ColumnGroup.GetColumn(cellIndex.X).ChangeValue(cellIndex.Y, null);
+ }
+ oldSortedColumnIndexes = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ foreach (Point cellIndex in cellValues.Keys.ToList()) {
+ ColumnGroup.GetColumn(cellIndex.X).ChangeValueOrNull(cellIndex.Y, cellValues[cellIndex]);
+ cellValues[cellIndex] = null;
+ }
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndexes;
+ oldSortedColumnIndexes = null;
+ oldSortOrder = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Column values deleted"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/DeleteColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/DeleteColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/DeleteColumnCommand.cs (revision 15690)
@@ -0,0 +1,79 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class DeleteColumnCommand : ColumnGroupCommandWithAffectedColumnsBase {
+ private List deletedColumns;
+ private List oldSortedColumnIndices;
+
+ [StorableConstructor]
+ protected DeleteColumnCommand(bool deserializing)
+ : base(deserializing) {
+ deletedColumns = new List();
+ }
+
+ public DeleteColumnCommand(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName, affectedColumns) {
+ deletedColumns = new List();
+ }
+
+ public override void Execute() {
+ base.Execute();
+ this.oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ if (!ColumnGroup.Columns.Any()) return;
+
+ ColumnBase column;
+ foreach (int columnIndex in AffectedColumns.OrderByDescending(i => i)) {
+ column = ColumnGroup.GetColumn(columnIndex);
+ deletedColumns.Insert(0, column);
+ ColumnGroup.RemoveColumn(column);
+ if (column.SortOrder != SortOrder.None)
+ ColumnGroup.SortedColumnIndexes.Remove(columnIndex);
+ }
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < deletedColumns.Count; i++)
+ ColumnGroup.InsertColumn(AffectedColumns[i], deletedColumns[i]);
+
+ deletedColumns.Clear();
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Columns deleted"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/DeleteRowsCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/DeleteRowsCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/DeleteRowsCommand.cs (revision 15690)
@@ -0,0 +1,69 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class DeleteRowsCommand : ColumnGroupCommandBase {
+ [Storable]
+ private List rowIndexes;
+
+ private List oldrows;
+
+ [StorableConstructor]
+ protected DeleteRowsCommand(bool deserializing) : base(deserializing) { }
+
+ public DeleteRowsCommand(DataSet dataSet, string columnGroupName, IEnumerable rowIndexes)
+ : base(dataSet, columnGroupName) {
+ this.rowIndexes = new List(rowIndexes);
+ this.oldrows = new List();
+ }
+
+ public override void Execute() {
+ base.Execute();
+ foreach (int pos in this.rowIndexes.Reverse()) {
+ oldrows.Insert(0, ColumnGroup.GetRow(pos));
+ ColumnGroup.DeleteRow(pos);
+ }
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int i = 0; i < rowIndexes.Count; i++)
+ ColumnGroup.InsertRow(this.rowIndexes[i], this.oldrows[i]);
+ oldrows.Clear();
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Delete Rows"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/InsertRowCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/InsertRowCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/InsertRowCommand.cs (revision 15690)
@@ -0,0 +1,70 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class InsertRowCommand : ColumnGroupCommandBase {
+ [Storable]
+ private int position;
+
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected InsertRowCommand(bool deserializing) : base(deserializing) { }
+
+ public InsertRowCommand(DataSet dataSet, string columnGroupName, int position)
+ : base(dataSet, columnGroupName) {
+ this.position = position;
+ }
+
+ public override void Execute() {
+ base.Execute();
+ ColumnGroup.InsertRow(position, ColumnGroup.GetEmptyRow());
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup.DeleteRow(position);
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldSortOrder = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Empty row inserted"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/PasteValuesCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/PasteValuesCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/PasteValuesCommand.cs (revision 15690)
@@ -0,0 +1,114 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class PasteValuesCommand : ColumnGroupCommandBase {
+ [Storable]
+ private IComparable[,] newValues;
+ [Storable]
+ private int columnIndex;
+ [Storable]
+ private int rowIndex;
+
+ private IComparable[,] oldValues;
+ private int insertedRows;
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrder;
+
+ [StorableConstructor]
+ protected PasteValuesCommand(bool deserializing) : base(deserializing) { }
+
+ public PasteValuesCommand(DataSet dataSet, string columnGroupName, int columnIndex, int rowIndex, string values)
+ : base(dataSet, columnGroupName) {
+ this.columnIndex = columnIndex;
+ this.rowIndex = rowIndex;
+
+ string[] lines = values.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
+ string[] cells;
+ for (int i = 0; i < lines.Length; i++) {
+ cells = lines[i].Split('\t');
+ if (this.newValues == null) {
+ newValues = new IComparable[cells.Length, lines.Length];
+ }
+ for (int j = 0; j < cells.Length; j++)
+ newValues[j, i] = string.IsNullOrEmpty(cells[j]) ? null : cells[j];
+ }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldValues = new IComparable[
+ Math.Min(ColumnGroup.Columns.Count() - columnIndex, newValues.GetLength(0)),
+ Math.Min(ColumnGroup.RowCount - rowIndex, newValues.GetLength(1))];
+ bool rowAdded = false;
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrder = ColumnGroup.SortOrdersForColumns.ToList();
+ for (int row = 0; row < newValues.GetLength(1); row++) {
+ if (row + rowIndex >= ColumnGroup.RowCount) {
+ ColumnGroup.AddRow(ColumnGroup.GetEmptyRow());
+ this.insertedRows++;
+ rowAdded = true;
+ }
+ for (int col = 0; col < newValues.GetLength(0); col++) {
+ if (col + columnIndex < ColumnGroup.Columns.Count()) {
+ if (!rowAdded)
+ oldValues[col, row] = ColumnGroup.Columns.ElementAt(col + columnIndex).GetValue(row + rowIndex);
+ ColumnGroup.Columns.ElementAt(col + columnIndex).ChangeValueOrNull(row + rowIndex, newValues[col, row]);
+ }
+ }
+ }
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ for (int row = 0; row < oldValues.GetLength(1); row++) {
+ for (int col = 0; col < oldValues.GetLength(0); col++) {
+ ColumnGroup.Columns.ElementAt(col + columnIndex).ChangeValue(row + rowIndex, oldValues[col, row]);
+ }
+ }
+ for (int i = 0; i < insertedRows; i++)
+ ColumnGroup.DeleteRow(ColumnGroup.RowCount - 1);
+ oldValues = null;
+ insertedRows = 0;
+ ColumnGroup.SortOrdersForColumns = oldSortOrder;
+ ColumnGroup.SortedColumnIndexes = oldSortedColumnIndices;
+ oldSortedColumnIndices = null;
+ oldSortOrder = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Copied values pasted"; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnCommand.cs (revision 15690)
@@ -0,0 +1,62 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class RenameColumnCommand : ColumnCommandBase {
+ [Storable]
+ private string newName;
+
+ private string oldName;
+
+ [StorableConstructor]
+ protected RenameColumnCommand(bool deserializing) : base(deserializing) { }
+
+ public RenameColumnCommand(DataSet dataSet, string columnGroupName, int columnIndex, string newName)
+ : base(dataSet, columnGroupName, columnIndex) {
+ this.newName = newName;
+ }
+
+ public override string Description {
+ get { return "Rename Column"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldName = Column.Name;
+ Column.Name = newName;
+ Column.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ Column.Name = oldName;
+ oldName = null;
+ Column.FireChanged();
+ this.ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnGroupCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnGroupCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/RenameColumnGroupCommand.cs (revision 15690)
@@ -0,0 +1,64 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class RenameColumnGroupCommand : ColumnGroupCommandBase {
+ [Storable]
+ private string newName;
+
+ private string oldName;
+
+ [StorableConstructor]
+ protected RenameColumnGroupCommand(bool deserializing) : base(deserializing) { }
+
+ public RenameColumnGroupCommand(DataSet dataSet, string columnGroupName, string newName)
+ : base(dataSet, columnGroupName) {
+ this.newName = newName;
+ }
+
+ public override string Description {
+ get { return "Rename ColumnGroup"; }
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldName = ColumnGroup.Name;
+ ColumnGroup.Name = newName;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ ColumnGroup ColumnGroup = this.DataSet.ColumnGroups.Where(cg => cg.Name == newName).First();
+ ColumnGroup.Name = oldName;
+ oldName = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/SortCommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/SortCommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Command/SortCommand.cs (revision 15690)
@@ -0,0 +1,155 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+namespace HeuristicLab.DataImporter.Data.Command {
+ [StorableClass]
+ public class SortCommand : ColumnGroupCommandBase {
+ [Storable]
+ private bool addToSortedColumns;
+ [Storable]
+ private int sortColumnIndex;
+
+ private ICollection oldSortedColumnIndices;
+ private IEnumerable oldSortOrdersForColumns;
+ private int[] indices;
+
+ [StorableConstructor]
+ protected SortCommand(bool deserializing) : base(deserializing) { }
+
+ public SortCommand(DataSet dataSet, string columnGroupName, int sortColumnIndex) :
+ this(dataSet, columnGroupName, sortColumnIndex, false) {
+ }
+
+ public SortCommand(DataSet dataSet, string columnGroupName, int sortColumnIndex, bool addToSortedColumns)
+ : base(dataSet, columnGroupName) {
+ this.addToSortedColumns = addToSortedColumns;
+ this.sortColumnIndex = sortColumnIndex;
+ }
+
+ public override void Execute() {
+ base.Execute();
+ oldSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+ oldSortOrdersForColumns = ColumnGroup.SortOrdersForColumns.ToList();
+
+ if (!addToSortedColumns) {
+ ColumnGroup.SortedColumnIndexes.Clear();
+ for (int i = 0; i < ColumnGroup.Columns.Count(); i++)
+ if (i != sortColumnIndex)
+ ColumnGroup.Columns.ElementAt(i).SortOrder = SortOrder.None;
+ }
+ if (!ColumnGroup.SortedColumnIndexes.Contains(sortColumnIndex))
+ ColumnGroup.SortedColumnIndexes.Add(sortColumnIndex);
+ ICollection tempSortedColumnIndices = new List(ColumnGroup.SortedColumnIndexes);
+
+ RowComparer rowComparer = new RowComparer(ColumnGroup, sortColumnIndex);
+ indices = Enumerable.Range(0, ColumnGroup.RowCount).OrderBy(k => k, rowComparer).ToArray();
+
+ List newColumns = Sort();
+ ColumnGroup.ClearColumns();
+ ColumnGroup.AddColumns(newColumns);
+ ColumnGroup.SortedColumnIndexes = tempSortedColumnIndices;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ indices = Enumerable.Range(0, ColumnGroup.RowCount).OrderBy(i => indices[i]).ToArray();
+ List newColumns = Sort();
+ ColumnGroup.ClearColumns();
+ ColumnGroup.AddColumns(newColumns);
+ ColumnGroup.SortedColumnIndexes = this.oldSortedColumnIndices;
+ ColumnGroup.SortOrdersForColumns = oldSortOrdersForColumns;
+ indices = null;
+ oldSortedColumnIndices = null;
+ oldSortOrdersForColumns = null;
+ ColumnGroup.FireChanged();
+ this.ColumnGroup = null;
+ }
+
+ public override string Description {
+ get { return "Sort ColumnGroup"; }
+ }
+
+ private List Sort() {
+ List newColumns = new List();
+ ColumnBase newColumn;
+ ColumnBase oldColumn;
+
+ for (int col = 0; col < ColumnGroup.Columns.Count(); col++) {
+ oldColumn = ColumnGroup.GetColumn(col);
+ newColumn = oldColumn.CreateCopyOfColumnWithoutValues();
+ newColumn.SortOrder = oldColumn.SortOrder;
+ if (col == sortColumnIndex) {
+ if (newColumn.SortOrder == SortOrder.None || newColumn.SortOrder == SortOrder.Descending)
+ newColumn.SortOrder = SortOrder.Ascending;
+ else
+ newColumn.SortOrder = SortOrder.Descending;
+ }
+ newColumns.Add(newColumn);
+ }
+
+ for (int j = 0; j < indices.Length; j++) {
+ for (int col = 0; col < ColumnGroup.Columns.Count(); col++)
+ newColumns[col].AddValue(ColumnGroup.Columns.ElementAt(col).GetValue(indices[j]));
+ }
+ return newColumns;
+ }
+
+ private class RowComparer : IComparer {
+ private ColumnGroup columnGroup;
+ private int sortColumnIndex;
+ public RowComparer(ColumnGroup columnGroup, int sortColumnIndex) {
+ this.columnGroup = columnGroup;
+ this.sortColumnIndex = sortColumnIndex;
+ }
+
+ #region IComparer Members
+ public int Compare(int i, int j) {
+ IEnumerator e = columnGroup.SortedColumnIndexes.GetEnumerator();
+ int result = 0;
+ while (result == 0 && e.MoveNext()) {
+ IComparable x = columnGroup.GetColumn(e.Current).GetValue(i);
+ IComparable y = columnGroup.GetColumn(e.Current).GetValue(j);
+ if (x == null) {
+ result = -1;
+ if (y == null)
+ result = 0;
+ } else
+ result = x.CompareTo(y);
+ if (columnGroup.SortOrdersForColumns.ElementAt(e.Current) == SortOrder.Descending)
+ result *= -1;
+ if (e.Current == sortColumnIndex && columnGroup.Columns.ElementAt(e.Current).SortOrder != SortOrder.None)
+ result *= -1;
+ }
+ return result;
+ }
+ #endregion
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnCommandBase.cs (revision 15690)
@@ -0,0 +1,48 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Xml;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [StorableClass]
+ public abstract class ColumnCommandBase : ColumnGroupCommandBase {
+ [Storable]
+ private int columnIndex;
+
+ [StorableConstructor]
+ protected ColumnCommandBase(bool deserializing) : base(deserializing) { }
+
+ protected ColumnCommandBase(DataSet dataSet, string columnGroupName, int columnIndex)
+ : base(dataSet, columnGroupName) {
+ this.columnIndex = columnIndex;
+ }
+
+ protected ColumnBase Column {
+ get { return this.ColumnGroup.GetColumn(columnIndex); }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnGroupCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnGroupCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnGroupCommandBase.cs (revision 15690)
@@ -0,0 +1,63 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Linq;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [StorableClass]
+ public abstract class ColumnGroupCommandBase : DataSetCommandBase {
+ [StorableConstructor]
+ protected ColumnGroupCommandBase(bool deserializing) : base(deserializing) { }
+
+ protected ColumnGroupCommandBase(DataSet dataSet, string columnGroupName)
+ : base(dataSet) {
+ this.columnGroupName = columnGroupName;
+ }
+
+ [Storable]
+ private string columnGroupName;
+ protected string ColumnGroupName {
+ get { return this.columnGroupName; }
+ }
+
+ protected void UpdateColumnGroup() {
+ this.columnGroup = this.DataSet.ColumnGroups.FirstOrDefault(cg => cg.Name == this.columnGroupName);
+ }
+
+ public override void Execute() {
+ base.Execute();
+ this.UpdateColumnGroup();
+ }
+
+ public override void UndoExecute() {
+ base.UndoExecute();
+ this.UpdateColumnGroup();
+ }
+
+ private ColumnGroup columnGroup;
+ protected ColumnGroup ColumnGroup {
+ get { return this.columnGroup; }
+ set { this.columnGroup = value; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnGroupCommandWithAffectedColumnsBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnGroupCommandWithAffectedColumnsBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ColumnGroupCommandWithAffectedColumnsBase.cs (revision 15690)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [StorableClass]
+ public abstract class ColumnGroupCommandWithAffectedColumnsBase : ColumnGroupCommandBase {
+ [StorableConstructor]
+ protected ColumnGroupCommandWithAffectedColumnsBase(bool deserializing) : base(deserializing) { }
+
+ protected ColumnGroupCommandWithAffectedColumnsBase(DataSet dataSet, string columnGroupName, int[] affectedColumns)
+ : base(dataSet, columnGroupName) {
+ this.affectedColumns = affectedColumns;
+ }
+
+ [Storable]
+ private int[] affectedColumns;
+ protected int[] AffectedColumns {
+ get { return this.affectedColumns; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandBase.cs (revision 15690)
@@ -0,0 +1,35 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [StorableClass]
+ public abstract class CommandBase : ICommand {
+ [StorableConstructor]
+ protected CommandBase(bool deserializing) : base() { }
+ protected CommandBase() { }
+
+ public abstract void Execute();
+ public abstract void UndoExecute();
+ public abstract string Description { get; }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandExecutionException.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandExecutionException.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandExecutionException.cs (revision 15690)
@@ -0,0 +1,45 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ public class CommandExecutionException : Exception {
+
+ public CommandExecutionException(string message, ICommand command)
+ : base(message) {
+ this.command = command;
+ }
+
+ public CommandExecutionException(string message, Exception innerException, ICommand command)
+ : base(message, innerException) {
+ this.command = command;
+ }
+
+ private ICommand command;
+ public ICommand Command {
+ get {return command;}
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandViewBase.Designer.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandViewBase.Designer.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandViewBase.Designer.cs (revision 15690)
@@ -0,0 +1,61 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ partial class CommandViewBase {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing) {
+ if (disposing && (components != null)) {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Component Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent() {
+ this.SuspendLayout();
+ //
+ // CommandViewBase
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.Name = "CommandViewBase";
+ this.Size = new System.Drawing.Size(176, 100);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandViewBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandViewBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/CommandViewBase.cs (revision 15690)
@@ -0,0 +1,43 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ public partial class CommandViewBase : UserControl {
+ public CommandViewBase() {
+ InitializeComponent();
+ }
+
+ private ICommand command;
+ public ICommand Command {
+ get { return this.command;}
+ protected set { this.command = value; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/DataSetCommandBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/DataSetCommandBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/DataSetCommandBase.cs (revision 15690)
@@ -0,0 +1,47 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [StorableClass]
+ public abstract class DataSetCommandBase : CommandBase {
+ [StorableConstructor]
+ protected DataSetCommandBase(bool deserializing) : base(deserializing) { }
+
+ protected DataSetCommandBase(DataSet dataSet) {
+ this.dataset = dataSet;
+ }
+
+ private DataSet dataset;
+ public virtual DataSet DataSet {
+ get { return this.dataset; }
+ set { this.dataset = value; }
+ }
+
+ public override void Execute() {
+ }
+
+ public override void UndoExecute() {
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/DataSetCommandWithAffectedColumnGroupsBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/DataSetCommandWithAffectedColumnGroupsBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/DataSetCommandWithAffectedColumnGroupsBase.cs (revision 15690)
@@ -0,0 +1,42 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Data.Model;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [StorableClass]
+ public abstract class DataSetCommandWithAffectedColumnGroupsBase : DataSetCommandBase {
+ [StorableConstructor]
+ protected DataSetCommandWithAffectedColumnGroupsBase(bool deserializing) : base(deserializing) { }
+ protected DataSetCommandWithAffectedColumnGroupsBase(DataSet dataSet, List affectedColumnGroupNames)
+ : base(dataSet) {
+ this.affectedColumnGroupNames = affectedColumnGroupNames;
+ }
+
+ [Storable]
+ private List affectedColumnGroupNames;
+ protected List AffectedColumnGroupNames {
+ get { return this.affectedColumnGroupNames; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ICommand.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ICommand.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ICommand.cs (revision 15690)
@@ -0,0 +1,33 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ public interface ICommand {
+ void Execute();
+ void UndoExecute();
+ string Description { get;}
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ICommandGenerator.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ICommandGenerator.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ICommandGenerator.cs (revision 15690)
@@ -0,0 +1,33 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.DataImporter.Data.Model;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ public interface ICommandGenerator {
+ bool Enabled(DataSetState state);
+ ICommand GenerateCommand(DataSet dataSet);
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ViewableCommandInfoAttribute.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ViewableCommandInfoAttribute.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandBase/ViewableCommandInfoAttribute.cs (revision 15690)
@@ -0,0 +1,77 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace HeuristicLab.DataImporter.Data.CommandBase {
+ [AttributeUsage(AttributeTargets.Class,AllowMultiple=false,Inherited=false)]
+ public sealed class ViewableCommandInfoAttribute : Attribute{
+ public ViewableCommandInfoAttribute(string name, int activeColumnGroups, ColumnGroupState state, string groupName) {
+ this.name = name;
+ this.groupName = groupName;
+ this.state = new DataSetState(activeColumnGroups, state);
+ this.position = Int32.MaxValue;
+ }
+
+ private DataSetState state;
+ public DataSetState State {
+ get { return this.state; }
+ }
+
+ private string groupName;
+ public string GroupName {
+ get { return this.groupName; }
+ }
+
+ private string name;
+ public string Name {
+ get { return this.name; }
+ }
+
+ private int position;
+ public int Position {
+ get { return this.position; }
+ set { this.position = value; }
+ }
+
+ private Type optionsView;
+ public Type OptionsView {
+ get { return this.optionsView; }
+ set {
+ if (!value.IsSubclassOf(typeof(CommandViewBase)) || value.IsAbstract)
+ throw new ArgumentException("Expected type T with base class CommandInfoViewBase");
+ this.optionsView = value; }
+ }
+
+ public int SelectedColumns {
+ get { return this.state.SelectedColumns; }
+ set { this.state.SelectedColumns = value; }
+ }
+
+ public int MinActiveColumnGroups {
+ get { return state.MinActiveColumnGroups; }
+ set { state.MinActiveColumnGroups = value; }
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandChain.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandChain.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/CommandChain.cs (revision 15690)
@@ -0,0 +1,195 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using HeuristicLab.DataImporter.Data.CommandBase;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+
+namespace HeuristicLab.DataImporter.Data {
+ [StorableClass]
+ public class CommandChain : IEnumerable {
+ private LinkedList commands;
+ private LinkedListNode lastExecutedCommand;
+ private LinkedListNode startMacroRecordingCommand;
+ private bool isMacroRecording;
+
+ [Storable]
+ private List CommandStorable {
+ get {
+ LinkedListNode cmdNode = null;
+ if (this.isMacroRecording && startMacroRecordingCommand != null)
+ cmdNode = startMacroRecordingCommand.Next;
+ else
+ cmdNode = commands.First;
+
+ List list = new List();
+ while (cmdNode != lastExecutedCommand.Next) {
+ list.Add(cmdNode.Value);
+ cmdNode = cmdNode.Next;
+ }
+ return list;
+ }
+ set {
+ foreach (ICommand command in value)
+ commands.AddLast(command);
+ this.lastExecutedCommand = commands.Last;
+ this.FireChanged();
+ }
+ }
+
+ [StorableConstructor]
+ protected CommandChain(bool deserializing)
+ : base() {
+ this.commands = new LinkedList();
+ }
+ public CommandChain() {
+ this.commands = new LinkedList();
+ }
+
+ public ICommand LastExecutedCommand {
+ get { return lastExecutedCommand == null ? null : lastExecutedCommand.Value; }
+ }
+
+ public int CommandsCount {
+ get { return this.commands.Count; }
+ }
+
+ public bool FirstCommandReached {
+ get { return this.commands.Count == 0 || this.lastExecutedCommand == null; }
+ }
+
+ public bool LastCommandReached {
+ get { return this.commands.Count == 0 || this.lastExecutedCommand == this.commands.Last; }
+ }
+
+ public bool IsMacroRecording {
+ get { return isMacroRecording; }
+ }
+
+ public string NextCommandDescription {
+ get {
+ if (LastCommandReached)
+ return "Redo";
+ else if (lastExecutedCommand == null)
+ return commands.First.Value.Description;
+ else
+ return lastExecutedCommand.Next.Value.Description;
+ }
+ }
+
+ public string PreviousCommandDescription {
+ get { return FirstCommandReached ? "Undo" : lastExecutedCommand.Value.Description; }
+ }
+
+ public event EventHandler Changed;
+ protected virtual void OnChanged() {
+ if (this.Changed != null)
+ this.Changed(this, EventArgs.Empty);
+ }
+ public void FireChanged() {
+ this.OnChanged();
+ }
+
+ public void Add(ICommand command) {
+ this.Add(command, true);
+ }
+
+ public void Add(ICommand command, bool fireChangedEvent) {
+ try {
+ System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
+ command.Execute();
+ while (this.commands.Count != 0 && this.commands.Last != this.lastExecutedCommand)
+ this.commands.RemoveLast();
+ this.commands.AddLast(command);
+ this.lastExecutedCommand = this.commands.Last;
+ GC.Collect();
+ if (fireChangedEvent)
+ this.OnChanged();
+ }
+ finally {
+ System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
+ }
+ }
+
+ public void Clear() {
+ this.commands.Clear();
+ this.OnChanged();
+ }
+
+ public void Redo() {
+ if (this.lastExecutedCommand != this.commands.Last) {
+ System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
+ if (this.lastExecutedCommand == null)
+ this.lastExecutedCommand = this.commands.First;
+ else
+ this.lastExecutedCommand = this.lastExecutedCommand.Next;
+ try {
+ this.lastExecutedCommand.Value.Execute();
+ this.OnChanged();
+ }
+ catch (CommandExecutionException) {
+ this.lastExecutedCommand = this.lastExecutedCommand.Previous;
+ throw;
+ }
+ finally {
+ System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
+ }
+ }
+ }
+
+ public void Undo() {
+ if (this.lastExecutedCommand != null) {
+ System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
+ try {
+ this.lastExecutedCommand.Value.UndoExecute();
+ if (this.lastExecutedCommand == this.startMacroRecordingCommand)
+ isMacroRecording = false;
+ this.lastExecutedCommand = this.lastExecutedCommand.Previous;
+ this.OnChanged();
+ }
+ finally {
+ System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
+ }
+ }
+ }
+
+ public void ToggleMacroRecording() {
+ if (!isMacroRecording)
+ this.startMacroRecordingCommand = lastExecutedCommand;
+ isMacroRecording = !isMacroRecording;
+ this.OnChanged();
+ }
+
+ #region IEnumerable Members
+ public IEnumerator GetEnumerator() {
+ return commands.GetEnumerator();
+ }
+ #endregion
+
+ #region IEnumerable Members
+ System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() {
+ return commands.GetEnumerator();
+ }
+ #endregion
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/DataSetState.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/DataSetState.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/DataSetState.cs (revision 15690)
@@ -0,0 +1,112 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+
+namespace HeuristicLab.DataImporter.Data {
+ [Flags]
+ public enum ColumnGroupState {
+ None = 0,
+ Active = 1,
+ ColumnSelected = 2 | Active,
+ DoubleColumnSelected = 4 | ColumnSelected,
+ DateTimeColumnSelected = 8 | ColumnSelected,
+ StringColumnSelected = 16 | ColumnSelected,
+ ProgrammableColumnSelected = 32 | ColumnSelected,
+ AnySelectedColumnContainsNull = 64 | ColumnSelected,
+ Sorted = 128 | Active,
+ AnySelectedColumnNotSorted = 256 | Sorted | ColumnSelected
+ }
+
+ public class DataSetState {
+ public DataSetState(int activeColumnGroups, ColumnGroupState state)
+ : this(activeColumnGroups, -1, state) {
+ }
+
+ public DataSetState(int activeColumnGroups, int selectedColumns, ColumnGroupState state) {
+ this.selectedColumns = selectedColumns;
+ this.activeColumnGroups = activeColumnGroups;
+ this.state = state;
+ }
+
+ private int activeColumnGroups;
+ public int ActiveColumnGroups {
+ get { return this.activeColumnGroups; }
+ }
+
+ private int minActiveColumnGroups = int.MaxValue;
+ public int MinActiveColumnGroups {
+ get { return minActiveColumnGroups; }
+ set { minActiveColumnGroups = value; }
+ }
+
+ //only meaningful if activeColumnGroups == 1
+ private int selectedColumns;
+ public int SelectedColumns {
+ get { return activeColumnGroups == 1 ? this.selectedColumns : -1; } //throw Exception instead of return -1
+ set { this.selectedColumns = value; }
+ }
+
+ private ColumnGroupState state;
+ public ColumnGroupState State {
+ get { return this.state; }
+ }
+
+ public void AddColumnGroupState(ColumnGroupState state) {
+ if (state == ColumnGroupState.None)
+ return;
+ activeColumnGroups++;
+ if (this.state == ColumnGroupState.None)
+ this.state = state;
+ else
+ this.state &= state;
+ }
+
+ public bool Enabled(DataSetState other) {
+ if (this.activeColumnGroups == 0)
+ return true;
+ else if (other.activeColumnGroups != this.activeColumnGroups)
+ if (other.activeColumnGroups >= minActiveColumnGroups) return true;
+ else return false;
+ else if (SelectedColumns != -1 && other.SelectedColumns != SelectedColumns)
+ return false;
+ return (this.state & other.state) == this.state;
+ }
+
+ public override bool Equals(object obj) {
+ if (obj == this)
+ return true;
+ else if(obj is DataSetState) {
+ DataSetState other = (DataSetState)obj;
+ return
+ other.activeColumnGroups == this.activeColumnGroups &&
+ other.state == this.state &&
+ this.selectedColumns == other.selectedColumns;
+ }
+ return false;
+ }
+
+ public override int GetHashCode() {
+ return this.activeColumnGroups.GetHashCode() ^ this.state.GetHashCode() ^ this.selectedColumns.GetHashCode();
+ }
+
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/DateTimeSpan.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/DateTimeSpan.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/DateTimeSpan.cs (revision 15690)
@@ -0,0 +1,67 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data {
+ [StorableClass]
+ public class DateTimeSpan : ICloneable {
+ public DateTimeSpan() : base() { }
+ [StorableConstructor]
+ protected DateTimeSpan(bool deserializing) : base() { }
+
+ [Storable]
+ public int Seconds { get; set; }
+ [Storable]
+ public int Minutes { get; set; }
+ [Storable]
+ public int Hours { get; set; }
+ [Storable]
+ public int Days { get; set; }
+ [Storable]
+ public int Months { get; set; }
+ [Storable]
+ public int Years { get; set; }
+
+ public static DateTime operator +(DateTime start, DateTimeSpan span) {
+ DateTime ret = new DateTime(start.Year, start.Month, start.Day, start.Hour, start.Minute, start.Second);
+ ret = ret.AddSeconds(span.Seconds);
+ ret = ret.AddMinutes(span.Minutes);
+ ret = ret.AddHours(span.Hours);
+ ret = ret.AddDays(span.Days);
+ ret = ret.AddMonths(span.Months);
+ ret = ret.AddYears(span.Years);
+ return ret;
+ }
+
+ public object Clone() {
+ DateTimeSpan obj = new DateTimeSpan();
+ obj.Seconds = this.Seconds;
+ obj.Minutes = this.Minutes;
+ obj.Hours = this.Hours;
+ obj.Days = this.Days;
+ obj.Months = this.Months;
+ obj.Years = this.Years;
+ return obj;
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/HeuristicLab.DataImporter.Data.csproj
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/HeuristicLab.DataImporter.Data.csproj (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/HeuristicLab.DataImporter.Data.csproj (revision 15690)
@@ -0,0 +1,217 @@
+
+
+
+ Debug
+ AnyCPU
+ 9.0.30729
+ 2.0
+ {4A0EE09A-6D8A-458A-8FB0-3D18F88F7FEE}
+ Library
+ Properties
+ HeuristicLab.DataImporter.Data
+ HeuristicLab.DataImporter.Data-1.0
+ v4.5
+ 512
+ true
+ HeuristicLab.snk
+
+
+ 3.5
+
+ publish\
+ true
+ Disk
+ false
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ 0
+ 1.0.0.%2a
+ false
+ false
+ true
+
+
+
+ true
+ full
+ false
+ ..\..\..\trunk\bin\
+ DEBUG;TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ pdbonly
+ true
+ ..\..\..\trunk\bin
+ TRACE
+ prompt
+ 4
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x86
+ prompt
+ AllRules.ruleset
+ false
+
+
+ true
+ ..\..\..\trunk\bin
+ DEBUG;TRACE
+ full
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+ ..\..\..\trunk\bin
+ TRACE
+ true
+ pdbonly
+ x64
+ prompt
+ AllRules.ruleset
+ false
+
+
+
+ ..\..\..\trunk\bin\HeuristicLab.Persistence-3.3.dll
+ False
+
+
+ ..\..\..\trunk\bin\HeuristicLab.PluginInfrastructure-3.3.dll
+ False
+
+
+
+ 3.5
+
+
+
+
+ 3.5
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ CommandViewBase.cs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ UserControl
+
+
+ ColumnGroupView.cs
+
+
+
+
+
+ Form
+
+
+ CommandViewDialog.cs
+
+
+ UserControl
+
+
+ DataSetView.cs
+
+
+
+
+
+
+
+
+
+
+
+
+ False
+ .NET Framework 3.5 SP1 Client Profile
+ false
+
+
+ False
+ .NET Framework 3.5 SP1
+ true
+
+
+ False
+ Windows Installer 3.1
+ true
+
+
+
+
+
+ set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
+set ProjectDir=$(ProjectDir)
+set SolutionDir=$(SolutionDir)
+set Outdir=$(Outdir)
+
+call PreBuildEvent.cmd
+
+
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/ColumnBase.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/ColumnBase.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/ColumnBase.cs (revision 15690)
@@ -0,0 +1,168 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections;
+using System.Windows.Forms;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Model {
+ [StorableClass]
+ public abstract class ColumnBase {
+ [StorableConstructor]
+ protected ColumnBase(bool deserializing) : base() { }
+
+ protected ColumnBase(string name)
+ : base() {
+ this.sortOrder = SortOrder.None;
+ this.name = name;
+ }
+
+ public abstract Type DataType { get; }
+
+ [Storable]
+ private string name;
+ public string Name {
+ get { return name; }
+ set { this.name = value; }
+ }
+
+ private bool selected;
+ public bool Selected {
+ get { return this.selected; }
+ set { this.selected = value; }
+ }
+
+ [Storable]
+ private SortOrder sortOrder;
+ public SortOrder SortOrder {
+ get { return sortOrder; }
+ set { this.sortOrder = value; }
+ }
+
+ public override string ToString() {
+ return this.name;
+ }
+
+ protected abstract IList Values { get; }
+ public IEnumerable ValuesEnumerable {
+ get { return this.Values; }
+ }
+
+ public IComparable Minimum {
+ get {
+ IComparable min = null;
+ foreach (IComparable val in Values)
+ if (val != null && (min == null || val.CompareTo(min) <= 0))
+ min = val;
+ return min;
+ }
+ }
+
+ public IComparable Maximum {
+ get {
+ IComparable max = null;
+ foreach (IComparable val in Values)
+ if (val != null && (max == null || val.CompareTo(max) >= 0))
+ max = val;
+ return max;
+ }
+ }
+
+ public int TotalValuesCount {
+ get { return this.Values.Count; }
+ }
+
+ public int NonNullValuesCount {
+ get { return TotalValuesCount - NullValuesCount; }
+ }
+
+ public int NullValuesCount {
+ get {
+ int i = 0;
+ foreach (IComparable value in Values)
+ if (value == null)
+ i++;
+ return i;
+ }
+ }
+
+ public IComparable GetValue(int index) {
+ if (index >= this.TotalValuesCount || index < 0)
+ return null;
+ return (IComparable)this.Values[index];
+ }
+
+ public bool ContainsNullValues {
+ get {
+ for (int i = 0; i < this.Values.Count; i++) {
+ if (this.Values[i] == null)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public bool ContainsNotNullValues {
+ get {
+ for (int i = 0; i < this.Values.Count; i++) {
+ if (this.Values[i] != null)
+ return true;
+ }
+ return false;
+ }
+ }
+
+ public void Resize(int size) {
+ int oldCnt = this.TotalValuesCount;
+ if (size > oldCnt) {
+ for (int i = 0; i < size - oldCnt; i++)
+ this.AddValue(null);
+ } else {
+ for (int i = 0; i < oldCnt - size; i++)
+ this.Values.RemoveAt(this.TotalValuesCount - 1);
+ }
+ }
+
+ public abstract void AddValue(IComparable value);
+ public abstract void AddValueOrNull(IComparable value);
+ public abstract void InsertValue(int position, IComparable value);
+ public abstract void ChangeValue(int position, IComparable value);
+ public abstract void ChangeValueOrNull(int position, IComparable value);
+ public abstract void ChangeValueOrLeaveOldValue(int position, IComparable value);
+
+ public void RemoveValue(int position) {
+ this.Values.RemoveAt(position);
+ }
+
+ public abstract ColumnBase CreateCopyOfColumnWithoutValues();
+ public abstract ColumnBase CreateCopyOfColumnWithoutValues(int capacity);
+
+ public event EventHandler Changed;
+ protected virtual void OnChanged() {
+ if (this.Changed != null)
+ this.Changed(this, EventArgs.Empty);
+ }
+ public void FireChanged() {
+ this.OnChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/ColumnGroup.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/ColumnGroup.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/ColumnGroup.cs (revision 15690)
@@ -0,0 +1,238 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see .
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Windows.Forms;
+using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
+
+namespace HeuristicLab.DataImporter.Data.Model {
+ [StorableClass]
+ public class ColumnGroup {
+ [StorableConstructor]
+ protected ColumnGroup(bool deserializing) : base() { }
+ public ColumnGroup()
+ : base() {
+ this.columns = new List();
+ this.sortedColumnIndexes = new List();
+ }
+
+ public ColumnGroup(string name)
+ : this() {
+ this.name = name;
+ }
+
+ private bool active;
+ public bool Active {
+ get { return active; }
+ set { this.active = value; }
+ }
+
+ public IEnumerable SortOrdersForColumns {
+ get { return columns.Select(col => col.SortOrder); }
+ set {
+ int i = 0;
+ foreach (SortOrder order in value) {
+ columns[i].SortOrder = order;
+ i++;
+ }
+ }
+ }
+
+ [Storable]
+ private ICollection sortedColumnIndexes;
+ public ICollection SortedColumnIndexes {
+ get { return this.sortedColumnIndexes; }
+ set { this.sortedColumnIndexes = value; }
+ }
+
+ public bool Sorted {
+ get { return SortOrdersForColumns.Any(x => x != SortOrder.None); }
+ }
+
+ public int SortedColumnsCount {
+ get { return SortOrdersForColumns.Count(x => x != SortOrder.None); }
+ }
+
+ public void ResetSorting() {
+ foreach (ColumnBase column in this.columns)
+ column.SortOrder = SortOrder.None;
+ sortedColumnIndexes.Clear();
+ }
+
+ public string KeyString(int row) {
+ string x = "";
+ IComparable val;
+ foreach (int colIndex in sortedColumnIndexes) {
+ val = columns[colIndex].GetValue(row);
+ if (val != null)
+ x += val.ToString();
+ }
+ return x;
+ }
+
+ [Storable]
+ private string name;
+ public string Name {
+ get { return this.name; }
+ set { this.name = value; }
+ }
+
+ [Storable]
+ private List columns;
+ public IEnumerable Columns {
+ get { return this.columns; }
+ }
+
+ public int RowCount {
+ get {
+ return this.columns.Count == 0 ? 0 :
+ this.columns.Max(x => x.TotalValuesCount);
+ }
+ }
+
+ public IEnumerable SelectedColumns {
+ get { return this.columns.Where(col => col.Selected); }
+ }
+
+ public int[] SelectedColumnIndexes {
+ get {
+ List selectedIndexes = new List();
+ for (int i = 0; i < this.columns.Count; i++)
+ if (columns[i].Selected)
+ selectedIndexes.Add(i);
+ return selectedIndexes.ToArray();
+ }
+ }
+
+ public void ClearSelectedColumns() {
+ foreach (ColumnBase col in this.columns)
+ col.Selected = false;
+ }
+
+ public void SelectAllColumns() {
+ foreach (ColumnBase col in this.columns)
+ col.Selected = true;
+ }
+
+
+ public void AddColumn(ColumnBase column) {
+ column.Changed += ColumnChanged;
+ this.columns.Add(column);
+ }
+
+ public void AddColumns(IEnumerable columns) {
+ foreach (ColumnBase col in columns)
+ this.AddColumn(col);
+ }
+
+ public void InsertColumn(int position, ColumnBase column) {
+ column.Changed += ColumnChanged;
+ this.columns.Insert(position, column);
+ }
+
+ public void RemoveColumn(ColumnBase column) {
+ if (sortedColumnIndexes.Contains(IndexOfColumn(column)))
+ ResetSorting();
+ column.Changed -= ColumnChanged;
+ this.columns.Remove(column);
+ }
+
+ public void RemoveColumn(int columnIndex) {
+ if (sortedColumnIndexes.Contains(columnIndex))
+ ResetSorting();
+ columns[columnIndex].Changed -= ColumnChanged;
+ this.columns.RemoveAt(columnIndex);
+ }
+
+ public int IndexOfColumn(ColumnBase column) {
+ return this.columns.IndexOf(column);
+ }
+
+ public void ClearColumns() {
+ foreach (ColumnBase col in this.columns)
+ col.Changed -= ColumnChanged;
+ ResetSorting();
+ this.columns.Clear();
+ }
+
+ public ColumnBase GetColumn(int position) {
+ return this.columns[position];
+ }
+
+ public void ReplaceColumn(int position, ColumnBase column) {
+ if (sortedColumnIndexes.Contains(position))
+ ResetSorting();
+ this.columns[position].Changed -= ColumnChanged;
+ column.Changed += ColumnChanged;
+ this.columns[position] = column;
+ }
+
+ #region methods for row manipulation
+ public IComparable[] GetRow(int index) {
+ IComparable[] ret = new IComparable[this.columns.Count];
+ for (int i = 0; i < this.columns.Count; i++)
+ ret[i] = this.columns[i].GetValue(index);
+ return ret;
+ }
+
+ public IComparable[] GetEmptyRow() {
+ IComparable[] ret = new IComparable[this.columns.Count];
+ for (int i = 0; i < this.columns.Count; i++)
+ ret[i] = null;
+ return ret;
+ }
+
+ public void AddRow(IComparable[] row) {
+ for (int i = 0; i < this.columns.Count; i++)
+ this.columns[i].AddValueOrNull(row[i]);
+ }
+
+ public void DeleteRow(int index) {
+ for (int i = 0; i < this.columns.Count; i++)
+ this.columns[i].RemoveValue(index);
+ }
+
+ public void InsertRow(int index, IComparable[] row) {
+ for (int i = 0; i < this.columns.Count; i++)
+ this.columns[i].InsertValue(index, row[i]);
+ }
+ #endregion
+
+ public void ColumnChanged(object sender, EventArgs e) {
+ this.OnChanged();
+ }
+
+ public override string ToString() {
+ return this.name;
+ }
+
+ public event EventHandler Changed;
+ protected virtual void OnChanged() {
+ if (this.Changed != null)
+ this.Changed(this, EventArgs.Empty);
+ }
+ public void FireChanged() {
+ this.OnChanged();
+ }
+ }
+}
Index: /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/DataSet.cs
===================================================================
--- /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/DataSet.cs (revision 15690)
+++ /addons/HeuristicLab.DataImporter/HeuristicLab.DataImporter.Data/Model/DataSet.cs (revision 15690)
@@ -0,0 +1,105 @@
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see