Free cookie consent management tool by TermsFeed Policy Generator

Changeset 10243


Ignore:
Timestamp:
12/18/13 14:39:44 (11 years ago)
Author:
rstoll
Message:
  • removed NotImplementedException in property Rows since it is invoked by an event
  • set fields number of columns / rows to read only
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  
    4545      }
    4646      set {
    47         throw new NotImplementedException();
     47        //does nothing, use something else :P
    4848      }
    4949    }
     
    5454      }
    5555      set {
    56         throw new NotImplementedException();
     56        //does nothing, use something else :P
    5757      }
    5858    }
     
    6363      }
    6464      set {
    65         throw new NotImplementedException();
     65        //not supported
    6666      }
    6767    }
     
    7272      }
    7373      set {
    74         throw new NotImplementedException();
     74        //not supported
    7575      }
    7676    }
     
    8181      }
    8282      set {
    83         throw new NotImplementedException();
     83        //not supported
    8484      }
    8585    }
     
    9999      }
    100100      bool valid = false;
    101       string variableName = preprocessingData.VariableNames[columnIndex];
     101      string variableName = preprocessingData.GetVariableName(columnIndex);
    102102      if (preprocessingData.IsType<double>(variableName)) {
    103103        double val;
     
    128128
    129129    public string GetValue(int rowIndex, int columnIndex) {
    130       return preprocessingData.GetCellAsString(preprocessingData.VariableNames[columnIndex], rowIndex);
     130      return preprocessingData.GetCellAsString(preprocessingData.GetVariableName(columnIndex), rowIndex);
    131131    }
    132132
    133133    public bool SetValue(string value, int rowIndex, int columnIndex) {
    134       string variableName = preprocessingData.VariableNames[columnIndex];
     134      string variableName = preprocessingData.GetVariableName(columnIndex);
    135135      bool valid = false;
    136136      if (preprocessingData.IsType<double>(variableName)) {
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/PreprocessingData.cs

    r10236 r10243  
    106106    }
    107107
    108     public IEnumerable<T> GetValues<T>(string variableName) {
     108    public IList<T> GetValues<T>(string variableName) {
    109109      // TODO: test if cast is valid
    110       return (IEnumerable<T>)variableValues[variableName];
     110      return (IList<T>) variableValues[variableName];
    111111    }
    112112
     
    149149    }
    150150
    151     public IList<string> VariableNames {
     151    public IEnumerable<string> VariableNames {
    152152      get { return variableNames; }
     153    }
     154
     155    public string GetVariableName(int columnIndex) {
     156      return variableNames[columnIndex];
    153157    }
    154158
     
    164168      get { return variableValues[variableNames[0]].Count; }
    165169    }
    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     #endregion
    199 
    200     #region IPreprocessingData Members
    201170
    202171    public Dataset ExportToDataset() {
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Interfaces/IPreprocessingData.cs

    r10236 r10243  
    3232    string GetCellAsString(string variableName, int row);
    3333
    34     IEnumerable<T> GetValues<T>(string variableName);
     34    IList<T> GetValues<T>(string variableName);
    3535    void SetValues<T>(string variableName, IEnumerable<T> values);
    3636
     
    4444    IntRange TestPartition { get; }
    4545
    46     IList<string> VariableNames { get; }
     46    IEnumerable<string> VariableNames { get; }
     47    string GetVariableName(int columnIndex);
    4748    bool IsType<T>(string variableName);
    4849
  • branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Views/DataGridContentView.Designer.cs

    r10239 r10243  
    2424    /// </summary>
    2525    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);
    2742      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
    2953    }
    3054
Note: See TracChangeset for help on using the changeset viewer.