Ignore:
Timestamp:
05/21/12 11:13:32 (10 years ago)
Author:
sforsten
Message:

#1784: changed the TableFileParser, so that you don't have to determine the file format by yourself. Comments have been added for the different Parse methods.

Location:
trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3

    • Property svn:ignore set to
      Plugin.cs
      obj
  • trunk/sources/HeuristicLab.Problems.Instances.DataAnalysis/3.3/TableFileParser.cs

    r7849 r7851  
    7575    }
    7676
     77    /// <summary>
     78    /// Parses a file and determines the format first
     79    /// </summary>
     80    /// <param name="fileName">file which is parsed</param>
     81    public void Parse(string fileName) {
     82      NumberFormatInfo numberFormat;
     83      DateTimeFormatInfo dateTimeFormatInfo;
     84      char separator;
     85      DetermineFileFormat(new FileStream(fileName, FileMode.Open), out numberFormat, out dateTimeFormatInfo, out separator);
     86      Parse(new FileStream(fileName, FileMode.Open), numberFormat, dateTimeFormatInfo, separator);
     87    }
     88
     89    /// <summary>
     90    /// Parses a file with the given formats
     91    /// </summary>
     92    /// <param name="fileName">file which is parsed</param>
     93    /// <param name="numberFormat">Format of numbers</param>
     94    /// <param name="dateTimeFormatInfo">Format of datetime</param>
     95    /// <param name="separator">defines the separator</param>
    7796    public void Parse(string fileName, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) {
    7897      Parse(new FileStream(fileName, FileMode.Open), numberFormat, dateTimeFormatInfo, separator);
    7998    }
    8099
     100    /// <summary>
     101    /// Takes a Stream and parses it with default format. NumberFormatInfo.InvariantInfo, DateTimeFormatInfo.InvariantInfo and separator = ','
     102    /// </summary>
     103    /// <param name="stream">stream which is parsed</param>
     104    public void Parse(Stream stream) {
     105      NumberFormatInfo numberFormat = NumberFormatInfo.InvariantInfo;
     106      DateTimeFormatInfo dateTimeFormatInfo = DateTimeFormatInfo.InvariantInfo;
     107      char separator = ',';
     108      Parse(stream, numberFormat, dateTimeFormatInfo, separator);
     109    }
     110
     111    /// <summary>
     112    /// Parses a stream with the given formats.
     113    /// </summary>
     114    /// <param name="stream">Stream which is parsed</param>   
     115    /// <param name="numberFormat">Format of numbers</param>
     116    /// <param name="dateTimeFormatInfo">Format of datetime</param>
     117    /// <param name="separator">defines the separator</param>
    81118    public void Parse(Stream stream, NumberFormatInfo numberFormat, DateTimeFormatInfo dateTimeFormatInfo, char separator) {
    82119      using (StreamReader reader = new StreamReader(stream)) {
Note: See TracChangeset for help on using the changeset viewer.