Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/09 12:40:41 (15 years ago)
Author:
epitzer
Message:

Stronger typing for formatters with the help of generics. Separate format and serial data type. (#548)

File:
1 edited

Legend:

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

    r1542 r1564  
    99    [Storable]
    1010    private readonly Dictionary<Type, IFormatter> formatters;
     11
    1112    [Storable]
    1213    private readonly List<IDecomposer> decomposers;
    1314    private readonly Dictionary<Type, IDecomposer> decomposerCache;
    14     [Storable]
    15     public IFormat Format { get; set; }
     15
     16    [Storable]   
     17    public IFormat Format { get; private set; }
    1618
    1719    private Configuration() {
     
    1921    }
    2022
    21     public Configuration(Dictionary<Type, IFormatter> formatters, IEnumerable<IDecomposer> decomposers) {     
     23    public Configuration(IFormat format, Dictionary<Type, IFormatter> formatters, IEnumerable<IDecomposer> decomposers) {
     24      this.Format = format;
    2225      this.formatters = new Dictionary<Type, IFormatter>();
    2326      foreach ( var pair in formatters ) {
    24         if (Format == null) {
    25           Format = pair.Value.Format;
    26         } else if (pair.Value.Format != Format ) {
     27        if (pair.Value.SerialDataType != format.SerialDataType ) {
    2728          throw new ArgumentException("All formatters must have the same IFormat.");
    2829        }
Note: See TracChangeset for help on using the changeset viewer.