Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1654 for trunk/sources


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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence.GUI/3.3/PersistenceConfigurationForm.cs

    r1642 r1654  
    376376      if (formatterGrid == null || decomposerList == null)
    377377        return null;
    378       var formatters = new Dictionary<Type, IFormatter>();
     378      var formatters = new List<IFormatter>();
    379379      foreach (DataGridViewRow row in formatterGrid.Rows) {
    380380        if (row.Cells["Type"].Value != null &&
     
    382382             row.Cells["Formatter"].Value != null &&
    383383             (bool)row.Cells["Active"].Value == true) {
    384           formatters.Add(
    385             typeNameTable[(string)row.Cells["Type"].Value],
    386             formatterTable[(string)row.Cells["Formatter"].Value]);
     384          formatters.Add(formatterTable[(string)row.Cells["Formatter"].Value]);
    387385        }
    388386      }
  • 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.