Changeset 10547
- Timestamp:
- 03/05/14 16:06:44 (11 years ago)
- Location:
- branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3
- Files:
-
- 2 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 } -
branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs
r10544 r10547 29 29 30 30 public interface IPreprocessingData : INamedItem { 31 [Obsolete("use the index based variant, is faster")]32 T GetCell<T>(string variableName, int rowIndex);33 31 T GetCell<T>(int columnIndex, int rowIndex); 34 32 35 [Obsolete("use the index based variant, is faster")]36 void SetCell<T>(string variableName, int rowIndex, T value);37 33 void SetCell<T>(int columnIndex, int rowIndex, T value); 38 34 39 [Obsolete("use the index based variant, is faster")]40 string GetCellAsString(string variableName, int rowIndex);41 35 string GetCellAsString(int columnIndex, int rowIndex); 42 36 … … 45 39 IList<T> GetValues<T>(int columnIndex); 46 40 47 [Obsolete("use the index based variant, is faster")]48 void SetValues<T>(string variableName, IList<T> values);49 41 void SetValues<T>(int columnIndex, IList<T> values); 50 42 … … 54 46 void InsertColumn<T>(string variableName, int columnIndex); 55 47 56 [Obsolete("use the index based variant, is faster")]57 void DeleteColumn(string variableName);58 48 void DeleteColumn(int columnIndex); 59 49 … … 65 55 int GetColumnIndex(string variableName); 66 56 67 [Obsolete("use the index based variant, is faster")]68 bool IsType<T>(string variableName);69 57 bool IsType<T>(int columnIndex); 70 71 58 72 59 int Columns { get; } … … 76 63 77 64 event DataPreprocessingChangedEventHandler Changed; 65 66 bool IsUndoAvailable { get; } 67 void Undo(); 78 68 } 79 69 }
Note: See TracChangeset
for help on using the changeset viewer.