Changeset 10243 for branches/DataPreprocessing
- Timestamp:
- 12/18/13 14:39:44 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/DataGridContent.cs
r10239 r10243 45 45 } 46 46 set { 47 throw new NotImplementedException();47 //does nothing, use something else :P 48 48 } 49 49 } … … 54 54 } 55 55 set { 56 throw new NotImplementedException();56 //does nothing, use something else :P 57 57 } 58 58 } … … 63 63 } 64 64 set { 65 throw new NotImplementedException();65 //not supported 66 66 } 67 67 } … … 72 72 } 73 73 set { 74 throw new NotImplementedException();74 //not supported 75 75 } 76 76 } … … 81 81 } 82 82 set { 83 throw new NotImplementedException();83 //not supported 84 84 } 85 85 } … … 99 99 } 100 100 bool valid = false; 101 string variableName = preprocessingData. VariableNames[columnIndex];101 string variableName = preprocessingData.GetVariableName(columnIndex); 102 102 if (preprocessingData.IsType<double>(variableName)) { 103 103 double val; … … 128 128 129 129 public string GetValue(int rowIndex, int columnIndex) { 130 return preprocessingData.GetCellAsString(preprocessingData. VariableNames[columnIndex], rowIndex);130 return preprocessingData.GetCellAsString(preprocessingData.GetVariableName(columnIndex), rowIndex); 131 131 } 132 132 133 133 public bool SetValue(string value, int rowIndex, int columnIndex) { 134 string variableName = preprocessingData. VariableNames[columnIndex];134 string variableName = preprocessingData.GetVariableName(columnIndex); 135 135 bool valid = false; 136 136 if (preprocessingData.IsType<double>(variableName)) { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs
r10236 r10243 106 106 } 107 107 108 public I Enumerable<T> GetValues<T>(string variableName) {108 public IList<T> GetValues<T>(string variableName) { 109 109 // TODO: test if cast is valid 110 return (I Enumerable<T>)variableValues[variableName];110 return (IList<T>) variableValues[variableName]; 111 111 } 112 112 … … 149 149 } 150 150 151 public I List<string> VariableNames {151 public IEnumerable<string> VariableNames { 152 152 get { return variableNames; } 153 } 154 155 public string GetVariableName(int columnIndex) { 156 return variableNames[columnIndex]; 153 157 } 154 158 … … 164 168 get { return variableValues[variableNames[0]].Count; } 165 169 } 166 public IDictionary<string, IEnumerable<int>> GetMissingValueIndices() {167 var dic = new Dictionary<string, IEnumerable<int>>();168 foreach (string variableName in VariableNames) {169 dic.Add(variableName, GetMissingValueIndices(variableName));170 }171 return dic;172 }173 174 public bool IsMissingValue(string variableName, int rowIndex) {175 if (IsType<double>(variableName)) {176 return double.IsNaN(GetCell<double>(variableName, rowIndex));177 } else if (IsType<string>(variableName)) {178 return string.IsNullOrEmpty(GetCell<string>(variableName, rowIndex));179 } else if (IsType<DateTime>(variableName)) {180 return GetCell<DateTime>(variableName, rowIndex).Equals(DateTime.MinValue);181 } else {182 throw new ArgumentException("cell in column with variableName: " + variableName + " and row index " + rowIndex + " contains a non supported type.");183 }184 }185 186 public IEnumerable<int> GetMissingValueIndices(string variableName) {187 if (IsType<double>(variableName)) {188 return GetValues<double>(variableName).Select((s, i) => new { i, s }).Where(t => double.IsNaN(t.s)).Select(t => t.i);189 } else if (IsType<string>(variableName)) {190 return GetValues<string>(variableName).Select((s, i) => new { i, s }).Where(t => string.IsNullOrEmpty(t.s)).Select(t => t.i);191 } else if (IsType<DateTime>(variableName)) {192 return GetValues<DateTime>(variableName).Select((s, i) => new { i, s }).Where(t => t.s.Equals(DateTime.MinValue)).Select(t => t.i);193 } else {194 throw new ArgumentException("column with variableName: " + variableName + " contains a non supported type.");195 }196 }197 198 #endregion199 200 #region IPreprocessingData Members201 170 202 171 public Dataset ExportToDataset() { -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs
r10236 r10243 32 32 string GetCellAsString(string variableName, int row); 33 33 34 I Enumerable<T> GetValues<T>(string variableName);34 IList<T> GetValues<T>(string variableName); 35 35 void SetValues<T>(string variableName, IEnumerable<T> values); 36 36 … … 44 44 IntRange TestPartition { get; } 45 45 46 IList<string> VariableNames { get; } 46 IEnumerable<string> VariableNames { get; } 47 string GetVariableName(int columnIndex); 47 48 bool IsType<T>(string variableName); 48 49 -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataGridContentView.Designer.cs
r10239 r10243 24 24 /// </summary> 25 25 private void InitializeComponent() { 26 this.components = new System.ComponentModel.Container(); 26 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit(); 27 this.SuspendLayout(); 28 // 29 // rowsTextBox 30 // 31 this.errorProvider.SetIconAlignment(this.rowsTextBox, System.Windows.Forms.ErrorIconAlignment.MiddleLeft); 32 this.errorProvider.SetIconPadding(this.rowsTextBox, 2); 33 this.rowsTextBox.ReadOnly = true; 34 // 35 // columnsTextBox 36 // 37 this.columnsTextBox.ReadOnly = true; 38 // 39 // DataGridContentView 40 // 41 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 27 42 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 28 this.Text = "DataGridContentView"; 43 this.Name = "DataGridContentView"; 44 this.Controls.SetChildIndex(this.statisticsTextBox, 0); 45 this.Controls.SetChildIndex(this.rowsLabel, 0); 46 this.Controls.SetChildIndex(this.columnsLabel, 0); 47 this.Controls.SetChildIndex(this.rowsTextBox, 0); 48 this.Controls.SetChildIndex(this.columnsTextBox, 0); 49 ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).EndInit(); 50 this.ResumeLayout(false); 51 this.PerformLayout(); 52 29 53 } 30 54
Note: See TracChangeset
for help on using the changeset viewer.