Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/24/09 14:21:54 (15 years ago)
Author:
epitzer
Message:

Streamline formatter configuration interface. Source types are already embedded in formatter generic type. (#548)

Location:
trunk/sources/HeuristicLab.Persistence
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Core/Configuration.cs

    r1623 r1654  
    2222    }
    2323
    24     public Configuration(IFormat format, Dictionary<Type, IFormatter> formatters, IEnumerable<IDecomposer> decomposers) {
     24    public Configuration(IFormat format, IEnumerable<IFormatter> formatters, IEnumerable<IDecomposer> decomposers) {
    2525      this.Format = format;
    2626      this.formatters = new Dictionary<Type, IFormatter>();
    27       foreach (var pair in formatters) {
    28         if (pair.Value.SerialDataType != format.SerialDataType) {
     27      foreach (IFormatter formatter in formatters) {
     28        if (formatter.SerialDataType != format.SerialDataType) {
    2929          throw new ArgumentException("All formatters must have the same IFormat.");
    3030        }
    31         this.formatters.Add(pair.Key, pair.Value);
     31        this.formatters.Add(formatter.SourceType, formatter);
    3232      }
    3333      this.decomposers = new List<IDecomposer>(decomposers);
  • trunk/sources/HeuristicLab.Persistence/3.3/Core/ConfigurationService.cs

    r1644 r1654  
    160160          format.SerialDataType.VersionInvariantName()));
    161161      }
    162       return new Configuration(format, formatterConfig, Decomposers.Where((d) => d.Priority > 0));
     162      return new Configuration(format, formatterConfig.Values, Decomposers.Where((d) => d.Priority > 0));
    163163    }
    164164
  • trunk/sources/HeuristicLab.Persistence/UnitTests/UseCases.cs

    r1653 r1654  
    379379      XmlGenerator.Serialize(sdt, tempFile,
    380380        new Configuration(new XmlFormat(),
    381           new Dictionary<Type, IFormatter> {
    382           { typeof(string), new String2XmlFormatter() } },
     381          new List<IFormatter> { new String2XmlFormatter() },
    383382          new List<IDecomposer> {
    384383            new StorableDecomposer(),
Note: See TracChangeset for help on using the changeset viewer.