- Timestamp:
- 03/05/14 16:06:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs
r10544 r10547 87 87 #region IPreprocessingData Members 88 88 89 [Obsolete("use the index based variant, is faster")]90 public T GetCell<T>(string variableName, int rowIndex) {91 return GetCell<T>(GetColumnIndex(variableName), rowIndex);92 }93 94 89 public T GetCell<T>(int columnIndex, int rowIndex) { 95 90 return (T)variableValues[columnIndex][rowIndex]; 96 91 } 97 92 98 [Obsolete("use the index based variant, is faster")] 99 public void SetCell<T>(string variableName, int rowIndex, T value) { 100 SetCell<T>(GetColumnIndex(variableName), rowIndex, value); 101 } 102 103 public void SetCell<T>(int columnIndex, int rowIndex, T value) { 93 94 public void SetCell<T>(int columnIndex, int rowIndex, T value) { // Undo-sensitive 104 95 variableValues[columnIndex][rowIndex] = value; 105 96 OnChanged(DataPreprocessingChangedEventType.ChangeItem, columnIndex, rowIndex); 106 97 } 107 98 108 [Obsolete("use the index based variant, is faster")]109 public string GetCellAsString(string variableName, int rowIndex) {110 return GetCellAsString(GetColumnIndex(variableName), rowIndex);111 }112 99 113 100 public string GetCellAsString(int columnIndex, int rowIndex) { 114 101 return variableValues[columnIndex][rowIndex].ToString(); 115 102 } 103 116 104 117 105 [Obsolete("use the index based variant, is faster")] … … 124 112 } 125 113 126 [Obsolete("use the index based variant, is faster")] 127 public void SetValues<T>(string variableName, IList<T> values) { 128 SetValues<T>(GetColumnIndex(variableName), values); 129 } 130 131 public void SetValues<T>(int columnIndex, IList<T> values) { 114 public void SetValues<T>(int columnIndex, IList<T> values) { // Undo-sensitive 132 115 if (IsType<T>(columnIndex)) { 133 116 variableValues[columnIndex] = (IList)values; … … 138 121 } 139 122 140 public void InsertRow(int rowIndex) { 123 public void InsertRow(int rowIndex) { // Undo-sensitive 141 124 foreach (IList column in variableValues.Values) { 142 125 Type type = column.GetType().GetGenericArguments()[0]; … … 146 129 } 147 130 148 public void DeleteRow(int rowIndex) { 131 public void DeleteRow(int rowIndex) { // Undo-sensitive 149 132 foreach (IList column in variableValues.Values) { 150 133 column.RemoveAt(rowIndex); … … 153 136 } 154 137 155 public void InsertColumn<T>(string variableName, int columnIndex) { 138 public void InsertColumn<T>(string variableName, int columnIndex) { // Undo-sensitive 156 139 variableValues.Add(columnIndex, new List<T>(Rows)); 157 variableNames.Insert(columnIndex, variableName); 158 OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex 159 } 160 161 public void DeleteColumn(int columnIndex) { 140 variableNames.Insert(columnIndex, variableName); 141 OnChanged(DataPreprocessingChangedEventType.AddColumn, columnIndex, -1); 142 } 143 144 public void DeleteColumn(int columnIndex) { // Undo-sensitive 162 145 variableValues.Remove(columnIndex); 163 146 variableNames.RemoveAt(columnIndex); … … 165 148 } 166 149 167 [Obsolete("use the index based variant, is faster")]168 public void DeleteColumn(string variableName) {169 DeleteColumn(GetColumnIndex(variableName));170 }171 150 172 151 public IntRange TrainingPartition { … … 178 157 } 179 158 159 public string GetVariableName(int columnIndex) { 160 return variableNames[columnIndex]; 161 } 162 180 163 public IEnumerable<string> VariableNames { 181 164 get { return variableNames; } 182 165 } 183 166 184 [Obsolete("use the index based variant, is faster")]185 public string GetVariableName(int columnIndex) {186 return variableNames[columnIndex];187 }188 167 public int GetColumnIndex(string variableName) { 189 168 return variableNames.IndexOf(variableName); 190 169 } 191 170 192 [Obsolete("use the index based variant, is faster")]193 public bool IsType<T>(string variableName) {194 return IsType<T>(GetColumnIndex(variableName));195 196 }197 171 public bool IsType<T>(int columnIndex) { 198 172 return variableValues[columnIndex] is List<T>; … … 224 198 } 225 199 200 public bool IsUndoAvailable { 201 get { throw new NotImplementedException(); } 202 } 203 204 public void Undo() { 205 throw new NotImplementedException(); 206 } 207 226 208 #endregion 227 209 }
Note: See TracChangeset
for help on using the changeset viewer.