Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/26/08 15:30:16 (16 years ago)
Author:
gkronber
Message:
  • merged r338 r341 and r343 from the ticket-specific trunk into the HL3.0 stable branch
  • fixed serialization and display of floating point numbers in HL3.0 stable plugins HeuristicLab.Functions and HeuristicLab.DataAnalysis

(ticket #175)

Location:
branches/3.0/sources/HeuristicLab.DataAnalysis
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/3.0/sources/HeuristicLab.DataAnalysis/Dataset.cs

    r278 r345  
    6666    public double[] Samples {
    6767      get { return samples; }
    68       set { 
     68      set {
    6969        samples = value;
    7070        CreateDictionaries();
     
    8181    public Dataset() {
    8282      Name = "-";
    83       VariableNames = new string[] {"Var0"};
     83      VariableNames = new string[] { "Var0" };
    8484      Columns = 1;
    8585      Rows = 1;
     
    146146      rows = int.Parse(node.Attributes["Dimension1"].Value, CultureInfo.InvariantCulture.NumberFormat);
    147147      columns = int.Parse(node.Attributes["Dimension2"].Value, CultureInfo.InvariantCulture.NumberFormat);
    148      
     148
    149149      VariableNames = ParseVariableNamesString(node.Attributes["VariableNames"].Value);
    150150
     
    154154      for(int row = 0; row < rows; row++) {
    155155        for(int column = 0; column < columns; column++) {
    156           if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row*columns + column]) == false) {
     156          if(double.TryParse(tokens[row * columns + column], NumberStyles.Float, CultureInfo.InvariantCulture.NumberFormat, out samples[row * columns + column]) == false) {
    157157            throw new FormatException("Can't parse " + tokens[row * columns + column] + " as double value.");
    158158          }
     
    171171        for(int column = 0; column < columns; column++) {
    172172          builder.Append(";");
    173           builder.Append(samples[row*columns+column].ToString(format));
     173          builder.Append(samples[row * columns + column].ToString("r",format));
    174174        }
    175175      }
     
    180180    private string GetVariableNamesString() {
    181181      string s = "";
    182       for (int i = 0; i < variableNames.Length; i++) {
     182      for(int i = 0; i < variableNames.Length; i++) {
    183183        s += variableNames[i] + "; ";
    184184      }
    185185
    186       if (variableNames.Length > 0) {
     186      if(variableNames.Length > 0) {
    187187        s = s.TrimEnd(';', ' ');
    188188      }
     
    192192    private string[] ParseVariableNamesString(string p) {
    193193      p = p.Trim();
    194       string[] tokens = p.Split(new char[] {';'}, StringSplitOptions.RemoveEmptyEntries);
     194      string[] tokens = p.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
    195195      return tokens;
    196196    }
    197197
    198198    public double GetMean(int column) {
    199       return GetMean(column, 0, Rows-1);
     199      return GetMean(column, 0, Rows - 1);
    200200    }
    201201
     
    216216
    217217    public double GetRange(int column) {
    218       return GetRange(column, 0, Rows-1);
     218      return GetRange(column, 0, Rows - 1);
    219219    }
    220220
  • branches/3.0/sources/HeuristicLab.DataAnalysis/DatasetView.cs

    r278 r345  
    4141      InitializeComponent();
    4242      openFileDialog = new OpenFileDialog();
     43
     44      dataGridView.DefaultCellStyle.Format = "r";
    4345    }
    4446
Note: See TracChangeset for help on using the changeset viewer.