Free cookie consent management tool by TermsFeed Policy Generator

source: branches/DataPreprocessing/HeuristicLab.DataPreprocessing/3.3/Implementations/LineChartLogic.cs @ 10539

Last change on this file since 10539 was 10539, checked in by rstoll, 11 years ago

Added License notice

File size: 2.4 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2013 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System.Collections.Generic;
23using HeuristicLab.Analysis;
24
25namespace HeuristicLab.DataPreprocessing {
26  public class LineChartLogic : ILineChartLogic {
27    private IPreprocessingData preprocessingData;
28    private DataTable dataTable;
29
30    public LineChartLogic(IPreprocessingData preprocessingData) {
31      this.preprocessingData = preprocessingData;
32      dataTable = new DataTable("LineChart");
33      FillDataTable();
34    }
35
36    private void FillDataTable() {
37      IEnumerable<string> variableNames = preprocessingData.VariableNames;
38
39      foreach (string variableName in variableNames) {
40        IList<double> values = preprocessingData.GetValues<double>(variableName);
41        DataRow row = new DataRow(variableName, "", values);
42        dataTable.Rows.Add(row);
43      }
44
45    }
46
47    public IEnumerable<object> GetVariableNames() {
48      return preprocessingData.VariableNames;
49    }
50
51    public DataTable GetDataTable() {
52      return dataTable;
53    }
54
55
56    #region ILineChartLogic Members
57
58    public void RemoveVariable(string name) {
59      dataTable.Rows.Remove(name);
60    }
61
62    public void AddVariable(string name) {
63      IList<double> values = preprocessingData.GetValues<double>(name);
64      DataRow row = new DataRow(name, "", values);
65      dataTable.Rows.Add(row);
66    }
67
68    #endregion
69
70    public bool VariableIsDisplayed(string name) {
71
72      foreach (var item in dataTable.Rows) {
73        if (item.Name == name)
74          return true;
75      }
76      return false;
77    }
78
79  }
80}
Note: See TracBrowser for help on using the repository browser.