Changeset 9608 for trunk/sources
- Timestamp:
- 06/11/13 21:41:08 (12 years ago)
- Location:
- trunk/sources
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/ClassificationImportTypeDialog.Designer.cs
r9456 r9608 62 62 // OkButton 63 63 // 64 this.OkButton.Location = new System.Drawing.Point(303, 4 64);64 this.OkButton.Location = new System.Drawing.Point(303, 482); 65 65 // 66 66 // TrainingTestTrackBar … … 78 78 // CancelationButton 79 79 // 80 this.CancelationButton.Location = new System.Drawing.Point(384, 4 64);80 this.CancelationButton.Location = new System.Drawing.Point(384, 482); 81 81 // 82 82 // ProblemDataSettingsGroupBox … … 87 87 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableComboBox); 88 88 this.ProblemDataSettingsGroupBox.Controls.Add(this.UniformDistributionOfClassesCheckbox); 89 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 31 5);89 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 312); 90 90 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.UniformDistributionOfClassesCheckbox, 0); 91 91 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableComboBox, 0); … … 110 110 // 111 111 this.PreviewDatasetMatrix.Location = new System.Drawing.Point(6, 134); 112 this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 17 5);112 this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 172); 113 113 // 114 114 // PreviewLabel … … 118 118 // TargetVariableComboBox 119 119 // 120 this.TargetVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 120 this.TargetVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 121 121 | System.Windows.Forms.AnchorStyles.Right))); 122 122 this.TargetVariableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; … … 178 178 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 179 179 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 180 this.ClientSize = new System.Drawing.Size(471, 499);180 this.ClientSize = new System.Drawing.Size(471, 517); 181 181 this.Name = "ClassificationImportTypeDialog"; 182 182 this.Text = "Classification CSV Import"; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.Designer.cs
r9456 r9608 72 72 this.PreviewDatasetMatrix = new HeuristicLab.Data.Views.StringConvertibleMatrixView(); 73 73 this.ToolTip = new System.Windows.Forms.ToolTip(this.components); 74 this.CheckboxColumnNames = new System.Windows.Forms.CheckBox(); 74 75 ((System.ComponentModel.ISupportInitialize)(this.TrainingTestTrackBar)).BeginInit(); 75 76 this.CSVSettingsGroupBox.SuspendLayout(); … … 93 94 this.OkButton.DialogResult = System.Windows.Forms.DialogResult.OK; 94 95 this.OkButton.Enabled = false; 95 this.OkButton.Location = new System.Drawing.Point(303, 4 07);96 this.OkButton.Location = new System.Drawing.Point(303, 422); 96 97 this.OkButton.Name = "OkButton"; 97 98 this.OkButton.Size = new System.Drawing.Size(75, 23); … … 137 138 this.CancelationButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 138 139 this.CancelationButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; 139 this.CancelationButton.Location = new System.Drawing.Point(384, 4 07);140 this.CancelationButton.Location = new System.Drawing.Point(384, 422); 140 141 this.CancelationButton.Name = "CancelationButton"; 141 142 this.CancelationButton.Size = new System.Drawing.Size(75, 23); … … 248 249 this.CSVSettingsGroupBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 249 250 | System.Windows.Forms.AnchorStyles.Right))); 251 this.CSVSettingsGroupBox.Controls.Add(this.CheckboxColumnNames); 250 252 this.CSVSettingsGroupBox.Controls.Add(this.DateTimeFormatInfoLabel); 251 253 this.CSVSettingsGroupBox.Controls.Add(this.DecimalSeparatorInfoLabel); … … 259 261 this.CSVSettingsGroupBox.Location = new System.Drawing.Point(12, 32); 260 262 this.CSVSettingsGroupBox.Name = "CSVSettingsGroupBox"; 261 this.CSVSettingsGroupBox.Size = new System.Drawing.Size(447, 1 05);263 this.CSVSettingsGroupBox.Size = new System.Drawing.Size(447, 126); 262 264 this.CSVSettingsGroupBox.TabIndex = 16; 263 265 this.CSVSettingsGroupBox.TabStop = false; … … 313 315 this.ProblemDataSettingsGroupBox.Controls.Add(this.TrainingTestTrackBar); 314 316 this.ProblemDataSettingsGroupBox.Controls.Add(this.ShuffleDataCheckbox); 315 this.ProblemDataSettingsGroupBox.Location = new System.Drawing.Point(12, 1 43);317 this.ProblemDataSettingsGroupBox.Location = new System.Drawing.Point(12, 164); 316 318 this.ProblemDataSettingsGroupBox.Name = "ProblemDataSettingsGroupBox"; 317 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 25 8);319 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 252); 318 320 this.ProblemDataSettingsGroupBox.TabIndex = 17; 319 321 this.ProblemDataSettingsGroupBox.TabStop = false; … … 362 364 this.PreviewDatasetMatrix.ShowRowsAndColumnsTextBox = false; 363 365 this.PreviewDatasetMatrix.ShowStatisticalInformation = false; 364 this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 1 44);366 this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 138); 365 367 this.PreviewDatasetMatrix.TabIndex = 0; 368 // 369 // CheckboxColumnNames 370 // 371 this.CheckboxColumnNames.AutoSize = true; 372 this.CheckboxColumnNames.Location = new System.Drawing.Point(9, 103); 373 this.CheckboxColumnNames.Name = "CheckboxColumnNames"; 374 this.CheckboxColumnNames.Size = new System.Drawing.Size(144, 17); 375 this.CheckboxColumnNames.TabIndex = 24; 376 this.CheckboxColumnNames.Text = "Column names in first line"; 377 this.CheckboxColumnNames.UseVisualStyleBackColor = true; 378 this.CheckboxColumnNames.CheckedChanged += new System.EventHandler(this.CheckboxColumnNames_CheckedChanged); 366 379 // 367 380 // DataAnalysisImportTypeDialog … … 370 383 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 371 384 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 372 this.ClientSize = new System.Drawing.Size(471, 4 42);385 this.ClientSize = new System.Drawing.Size(471, 457); 373 386 this.Controls.Add(this.ProblemDataSettingsGroupBox); 374 387 this.Controls.Add(this.CSVSettingsGroupBox); … … 422 435 protected System.Windows.Forms.Label ShuffelInfoLabel; 423 436 protected System.Windows.Forms.ToolTip ToolTip; 437 private System.Windows.Forms.CheckBox CheckboxColumnNames; 424 438 } 425 439 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/DataAnalysisImportTypeDialog.cs
r9458 r9608 68 68 Separator = (char)SeparatorComboBox.SelectedValue, 69 69 NumberFormatInfo = (NumberFormatInfo)DecimalSeparatorComboBox.SelectedValue, 70 DateTimeFormatInfo = (DateTimeFormatInfo)DateTimeFormatComboBox.SelectedValue 70 DateTimeFormatInfo = (DateTimeFormatInfo)DateTimeFormatComboBox.SelectedValue, 71 VariableNamesAvailable = CheckboxColumnNames.Checked 71 72 }; 72 73 } … … 99 100 DateTimeFormatComboBox.Enabled = true; 100 101 ProblemTextBox.Text = openFileDialog.FileName; 102 TableFileParser csvParser = new TableFileParser(); 103 CheckboxColumnNames.Checked = csvParser.AreColumnNamesInFirstLine(ProblemTextBox.Text, 104 (NumberFormatInfo)DecimalSeparatorComboBox.SelectedValue, 105 (DateTimeFormatInfo)DateTimeFormatComboBox.SelectedValue, 106 (char)SeparatorComboBox.SelectedValue); 101 107 ParseCSVFile(); 102 108 } 103 109 104 110 protected virtual void CSVFormatComboBoxSelectionChangeCommitted(object sender, EventArgs e) { 111 if (string.IsNullOrEmpty(ProblemTextBox.Text)) return; 112 113 ParseCSVFile(); 114 } 115 116 protected virtual void CheckboxColumnNames_CheckedChanged(object sender, EventArgs e) { 105 117 if (string.IsNullOrEmpty(ProblemTextBox.Text)) return; 106 118 … … 115 127 (NumberFormatInfo)DecimalSeparatorComboBox.SelectedValue, 116 128 (DateTimeFormatInfo)DateTimeFormatComboBox.SelectedValue, 117 (char)SeparatorComboBox.SelectedValue); 129 (char)SeparatorComboBox.SelectedValue, 130 CheckboxColumnNames.Checked); 118 131 IEnumerable<string> variableNamesWithType = GetVariableNamesWithType(csvParser); 119 132 PreviewDatasetMatrix.Content = new Dataset(variableNamesWithType, csvParser.Values); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/RegressionImportTypeDialog.Designer.cs
r9456 r9608 53 53 this.SuspendLayout(); 54 54 // 55 // OkButton 56 // 57 this.OkButton.Location = new System.Drawing.Point(303, 421); 58 // 59 // CancelationButton 60 // 61 this.CancelationButton.Location = new System.Drawing.Point(384, 421); 62 // 55 63 // ProblemDataSettingsGroupBox 56 64 // … … 58 66 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableLabel); 59 67 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableComboBox); 68 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 251); 60 69 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.PreviewLabel, 0); 61 70 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffelInfoLabel, 0); … … 106 115 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 107 116 this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 108 this.ClientSize = new System.Drawing.Size(471, 4 42);117 this.ClientSize = new System.Drawing.Size(471, 456); 109 118 this.Name = "RegressionImportTypeDialog"; 110 119 this.Text = "Regression CSV Import"; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis.Views/3.3/TimeSeriesPrognosisImportTypeDialog.Designer.cs
r9456 r9608 59 59 this.ShuffleDataCheckbox.Visible = false; 60 60 // 61 // OkButton 62 // 63 this.OkButton.Location = new System.Drawing.Point(303, 407); 64 // 65 // CancelationButton 66 // 67 this.CancelationButton.Location = new System.Drawing.Point(384, 407); 68 // 61 69 // ProblemDataSettingsGroupBox 62 70 // … … 64 72 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableComboBox); 65 73 this.ProblemDataSettingsGroupBox.Controls.Add(this.TargetVariableLabel); 74 this.ProblemDataSettingsGroupBox.Size = new System.Drawing.Size(447, 237); 66 75 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.ShuffleDataCheckbox, 0); 67 76 this.ProblemDataSettingsGroupBox.Controls.SetChildIndex(this.TargetVariableLabel, 0); … … 80 89 this.ErrorTextBox.Location = new System.Drawing.Point(6, 19); 81 90 this.ErrorTextBox.Size = new System.Drawing.Size(435, 69); 91 // 92 // PreviewDatasetMatrix 93 // 94 this.PreviewDatasetMatrix.Size = new System.Drawing.Size(435, 123); 82 95 // 83 96 // SeparatorInfoLabel … … 101 114 // TargetVariableComboBox 102 115 // 103 this.TargetVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 116 this.TargetVariableComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 104 117 | System.Windows.Forms.AnchorStyles.Right))); 105 118 this.TargetVariableComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/CSV/ClassifiactionCSVInstanceProvider.cs
r9456 r9608 59 59 TableFileParser csvFileParser = new TableFileParser(); 60 60 61 csvFileParser.Parse(path );61 csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path)); 62 62 63 63 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Classification/ResourceClassificationInstanceProvider.cs
r9456 r9608 49 49 TableFileParser csvFileParser = new TableFileParser(); 50 50 using (Stream stream = instancesZipFile.GetInputStream(entry)) { 51 csvFileParser.Parse(stream, numberFormat, dateFormat, separator );51 csvFileParser.Parse(stream, numberFormat, dateFormat, separator, csvFileParser.AreColumnNamesInFirstLine(stream)); 52 52 } 53 53 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Clustering/CSV/ClusteringCSVInstanceProvider.cs
r9456 r9608 58 58 public override IClusteringProblemData ImportData(string path) { 59 59 var csvFileParser = new TableFileParser(); 60 csvFileParser.Parse(path );60 csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path)); 61 61 62 62 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/DataAnalysisCSVFormat.cs
r9456 r9608 27 27 public NumberFormatInfo NumberFormatInfo { get; set; } 28 28 public DateTimeFormatInfo DateTimeFormatInfo { get; set; } 29 public bool VariableNamesAvailable { get; set; } 29 30 } 30 31 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/DataAnalysisInstanceProvider.cs
r9456 r9608 38 38 public TData ImportData(string path, ImportType type, DataAnalysisCSVFormat csvFormat) { 39 39 TableFileParser csvFileParser = new TableFileParser(); 40 csvFileParser.Parse(path, csvFormat.NumberFormatInfo, csvFormat.DateTimeFormatInfo, csvFormat.Separator );40 csvFileParser.Parse(path, csvFormat.NumberFormatInfo, csvFormat.DateTimeFormatInfo, csvFormat.Separator, csvFormat.VariableNamesAvailable); 41 41 return ImportData(path, type, csvFileParser); 42 42 } -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/CSV/RegressionCSVInstanceProvider.cs
r9456 r9608 57 57 public override IRegressionProblemData ImportData(string path) { 58 58 TableFileParser csvFileParser = new TableFileParser(); 59 csvFileParser.Parse(path );59 csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path)); 60 60 61 61 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/Regression/ResourceRegressionInstanceProvider.cs
r9456 r9608 49 49 TableFileParser csvFileParser = new TableFileParser(); 50 50 using (Stream stream = instancesZipFile.GetInputStream(entry)) { 51 csvFileParser.Parse(stream, numberFormat, dateFormat, separator );51 csvFileParser.Parse(stream, numberFormat, dateFormat, separator, csvFileParser.AreColumnNamesInFirstLine(stream)); 52 52 } 53 53 -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TableFileParser.cs
r9457 r9608 75 75 } 76 76 77 public bool AreColumnNamesInFirstLine(string fileName) { 78 NumberFormatInfo numberFormat; 79 DateTimeFormatInfo dateTimeFormatInfo; 80 char separator; 81 DetermineFileFormat(fileName, out numberFormat, out dateTimeFormatInfo, out separator); 82 using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { 83 return AreColumnNamesInFirstLine(stream, numberFormat, dateTimeFormatInfo, separator); 84 } 85 } 86 87 public bool AreColumnNamesInFirstLine(Stream stream) { 88 NumberFormatInfo numberFormat = NumberFormatInfo.InvariantInfo; 89 DateTimeFormatInfo dateTimeFormatInfo = DateTimeFormatInfo.InvariantInfo; 90 char separator = ','; 91 return AreColumnNamesInFirstLine(stream, numberFormat, dateTimeFormatInfo, separator); 92 } 93 94 public bool AreColumnNamesInFirstLine(string fileName, NumberFormatInfo numberFormat, 95 DateTimeFormatInfo dateTimeFormatInfo, char separator) { 96 using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { 97 return AreColumnNamesInFirstLine(stream, numberFormat, dateTimeFormatInfo, separator); 98 } 99 } 100 101 public bool AreColumnNamesInFirstLine(Stream stream, NumberFormatInfo numberFormat, 102 DateTimeFormatInfo dateTimeFormatInfo, char separator) { 103 using (StreamReader reader = new StreamReader(stream)) { 104 tokenizer = new Tokenizer(reader, numberFormat, dateTimeFormatInfo, separator); 105 return tokenizer.Peek().type != TokenTypeEnum.Double; 106 } 107 } 108 77 109 /// <summary> 78 110 /// Parses a file and determines the format first 79 111 /// </summary> 80 112 /// <param name="fileName">file which is parsed</param> 81 public void Parse(string fileName) { 113 /// <param name="columnNamesInFirstLine"></param> 114 public void Parse(string fileName, bool columnNamesInFirstLine) { 82 115 NumberFormatInfo numberFormat; 83 116 DateTimeFormatInfo dateTimeFormatInfo; 84 117 char separator; 85 DetermineFileFormat( new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), out numberFormat, out dateTimeFormatInfo, out separator);86 Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator );118 DetermineFileFormat(fileName, out numberFormat, out dateTimeFormatInfo, out separator); 119 Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator, columnNamesInFirstLine); 87 120 } 88 121 … … 94 127 /// <param name="dateTimeFormatInfo">Format of datetime</param> 95 128 /// <param name="separator">defines the separator</param> 96 public void Parse(string fileName, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) { 97 Parse(new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite), numberFormat, dateTimeFormatInfo, separator); 129 /// <param name="columnNamesInFirstLine"></param> 130 public void Parse(string fileName, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator, bool columnNamesInFirstLine) { 131 using (var stream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) { 132 Parse(stream, numberFormat, dateTimeFormatInfo, separator, columnNamesInFirstLine); 133 } 98 134 } 99 135 … … 102 138 /// </summary> 103 139 /// <param name="stream">stream which is parsed</param> 104 public void Parse(Stream stream) { 140 /// <param name="columnNamesInFirstLine"></param> 141 public void Parse(Stream stream, bool columnNamesInFirstLine) { 105 142 NumberFormatInfo numberFormat = NumberFormatInfo.InvariantInfo; 106 143 DateTimeFormatInfo dateTimeFormatInfo = DateTimeFormatInfo.InvariantInfo; 107 144 char separator = ','; 108 Parse(stream, numberFormat, dateTimeFormatInfo, separator );145 Parse(stream, numberFormat, dateTimeFormatInfo, separator, columnNamesInFirstLine); 109 146 } 110 147 … … 116 153 /// <param name="dateTimeFormatInfo">Format of datetime</param> 117 154 /// <param name="separator">defines the separator</param> 118 public void Parse(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) { 155 /// <param name="columnNamesInFirstLine"></param> 156 public void Parse(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator, bool columnNamesInFirstLine) { 119 157 using (StreamReader reader = new StreamReader(stream)) { 120 158 tokenizer = new Tokenizer(reader, numberFormat, dateTimeFormatInfo, separator); 121 159 // parse the file 122 Parse( );160 Parse(columnNamesInFirstLine); 123 161 } 124 162 … … 340 378 if (strToken.Equals(INTERNAL_SEPARATOR)) { 341 379 return SeparatorToken; 342 } else if (double.TryParse(strToken, NumberStyles.Float , numberFormatInfo, out token.doubleValue)) {380 } else if (double.TryParse(strToken, NumberStyles.Float | NumberStyles.AllowTrailingSign, numberFormatInfo, out token.doubleValue)) { 343 381 token.type = TokenTypeEnum.Double; 344 382 return token; … … 372 410 373 411 #region parsing 374 private void Parse() { 375 ParseVariableNames(); 376 if (!tokenizer.HasNext()) Error("Couldn't parse data values. Probably because of incorrect number format (the parser expects english number format with a '.' as decimal separator).", "", tokenizer.CurrentLineNumber); 412 private void Parse(bool columnNamesInFirstLine) { 413 if (columnNamesInFirstLine) { 414 ParseVariableNames(); 415 if (!tokenizer.HasNext()) 416 Error( 417 "Couldn't parse data values. Probably because of incorrect number format (the parser expects english number format with a '.' as decimal separator).", 418 "", tokenizer.CurrentLineNumber); 419 } 377 420 ParseValues(); 378 421 if (rowValues.Count == 0) Error("Couldn't parse data values. Probably because of incorrect number format (the parser expects english number format with a '.' as decimal separator).", "", tokenizer.CurrentLineNumber); … … 423 466 424 467 private void ParseVariableNames() { 425 //if first token is double no variables names are given426 if (tokenizer.Peek().type == TokenTypeEnum.Double) return;427 428 468 // the first line must contain variable names 429 469 List<Token> tokens = new List<Token>(); -
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TimeSeries/CSV/TimeSeriesPrognosisCSVInstanceProvider.cs
r9456 r9608 57 57 public override ITimeSeriesPrognosisProblemData ImportData(string path) { 58 58 TableFileParser csvFileParser = new TableFileParser(); 59 csvFileParser.Parse(path );59 csvFileParser.Parse(path, csvFileParser.AreColumnNamesInFirstLine(path)); 60 60 61 61 Dataset dataset = new Dataset(csvFileParser.VariableNames, csvFileParser.Values); -
trunk/sources/HeuristicLab.Tests/HeuristicLab.Problems.Instances.DataAnalysis-3.3/TableFileParserTest.cs
r9456 r9608 42 42 TableFileParser parser = new TableFileParser(); 43 43 try { 44 parser.Parse(tempFileName );44 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 45 45 Assert.AreEqual(6, parser.Rows); 46 46 Assert.AreEqual(4, parser.Columns); … … 64 64 TableFileParser parser = new TableFileParser(); 65 65 try { 66 parser.Parse(tempFileName );66 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 67 67 Assert.AreEqual(6, parser.Rows); 68 68 Assert.AreEqual(4, parser.Columns); … … 86 86 TableFileParser parser = new TableFileParser(); 87 87 try { 88 parser.Parse(tempFileName );88 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 89 89 Assert.AreEqual(6, parser.Rows); 90 90 Assert.AreEqual(4, parser.Columns); … … 109 109 TableFileParser parser = new TableFileParser(); 110 110 try { 111 parser.Parse(tempFileName );111 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 112 112 Assert.AreEqual(6, parser.Rows); 113 113 Assert.AreEqual(4, parser.Columns); … … 131 131 TableFileParser parser = new TableFileParser(); 132 132 try { 133 parser.Parse(tempFileName );133 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 134 134 Assert.AreEqual(6, parser.Rows); 135 135 Assert.AreEqual(4, parser.Columns); … … 153 153 TableFileParser parser = new TableFileParser(); 154 154 try { 155 parser.Parse(tempFileName );155 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 156 156 Assert.AreEqual(6, parser.Rows); 157 157 Assert.AreEqual(4, parser.Columns); … … 175 175 TableFileParser parser = new TableFileParser(); 176 176 try { 177 parser.Parse(tempFileName );177 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 178 178 Assert.AreEqual(6, parser.Rows); 179 179 Assert.AreEqual(4, parser.Columns); … … 197 197 TableFileParser parser = new TableFileParser(); 198 198 try { 199 parser.Parse(tempFileName );199 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 200 200 Assert.AreEqual(6, parser.Rows); 201 201 Assert.AreEqual(4, parser.Columns); … … 220 220 TableFileParser parser = new TableFileParser(); 221 221 try { 222 parser.Parse(tempFileName );222 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 223 223 Assert.AreEqual(6, parser.Rows); 224 224 Assert.AreEqual(4, parser.Columns); … … 243 243 TableFileParser parser = new TableFileParser(); 244 244 try { 245 parser.Parse(tempFileName );245 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 246 246 Assert.AreEqual(6, parser.Rows); 247 247 Assert.AreEqual(4, parser.Columns); … … 266 266 TableFileParser parser = new TableFileParser(); 267 267 try { 268 parser.Parse(tempFileName );268 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 269 269 Assert.AreEqual(6, parser.Rows); 270 270 Assert.AreEqual(4, parser.Columns); … … 289 289 TableFileParser parser = new TableFileParser(); 290 290 try { 291 parser.Parse(tempFileName );291 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 292 292 Assert.AreEqual(6, parser.Rows); 293 293 Assert.AreEqual(4, parser.Columns); … … 311 311 TableFileParser parser = new TableFileParser(); 312 312 try { 313 parser.Parse(tempFileName );313 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 314 314 Assert.AreEqual(6, parser.Rows); 315 315 Assert.AreEqual(4, parser.Columns); … … 333 333 TableFileParser parser = new TableFileParser(); 334 334 try { 335 parser.Parse(tempFileName );335 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 336 336 Assert.AreEqual(6, parser.Rows); 337 337 Assert.AreEqual(4, parser.Columns); … … 355 355 TableFileParser parser = new TableFileParser(); 356 356 try { 357 parser.Parse(tempFileName );357 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 358 358 Assert.AreEqual(6, parser.Rows); 359 359 Assert.AreEqual(4, parser.Columns); … … 377 377 TableFileParser parser = new TableFileParser(); 378 378 try { 379 parser.Parse(tempFileName );379 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 380 380 Assert.AreEqual(6, parser.Rows); 381 381 Assert.AreEqual(4, parser.Columns); … … 400 400 TableFileParser parser = new TableFileParser(); 401 401 try { 402 parser.Parse(tempFileName );402 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 403 403 Assert.AreEqual(4, parser.Rows); 404 404 Assert.AreEqual(4, parser.Columns); … … 421 421 TableFileParser parser = new TableFileParser(); 422 422 try { 423 parser.Parse(tempFileName );423 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 424 424 Assert.AreEqual(6, parser.Rows); 425 425 Assert.AreEqual(4, parser.Columns); … … 443 443 TableFileParser parser = new TableFileParser(); 444 444 try { 445 parser.Parse(tempFileName );445 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 446 446 Assert.AreEqual(6, parser.Rows); 447 447 Assert.AreEqual(4, parser.Columns); … … 465 465 TableFileParser parser = new TableFileParser(); 466 466 try { 467 parser.Parse(tempFileName );467 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 468 468 Assert.AreEqual(6, parser.Rows); 469 469 Assert.AreEqual(4, parser.Columns); … … 487 487 TableFileParser parser = new TableFileParser(); 488 488 try { 489 parser.Parse(tempFileName );489 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 490 490 Assert.AreEqual(6, parser.Rows); 491 491 Assert.AreEqual(4, parser.Columns); … … 508 508 TableFileParser parser = new TableFileParser(); 509 509 try { 510 parser.Parse(tempFileName );510 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 511 511 Assert.AreEqual(3, parser.Rows); 512 512 Assert.AreEqual(4507, parser.Columns); … … 529 529 TableFileParser parser = new TableFileParser(); 530 530 try { 531 parser.Parse(tempFileName );531 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 532 532 Assert.AreEqual(6, parser.Rows); 533 533 Assert.AreEqual(4, parser.Columns); … … 551 551 TableFileParser parser = new TableFileParser(); 552 552 try { 553 parser.Parse(tempFileName );553 parser.Parse(tempFileName, parser.AreColumnNamesInFirstLine(tempFileName)); 554 554 Assert.AreEqual(6, parser.Rows); 555 555 Assert.AreEqual(4, parser.Columns);
Note: See TracChangeset
for help on using the changeset viewer.