Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/09 12:40:41 (16 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/Default/Xml/Compact/DoubleArray2XmlFormatters.cs

    r1542 r1564  
    44
    55namespace HeuristicLab.Persistence.Default.Xml.Compact {
    6 
    7   [EmptyStorableClass]
    8   public class DoubleArray2XmlFormatter : NumberArray2XmlFormatterBase {
    9 
    10     public override Type Type {
    11       get {
    12         return typeof(double[]);
    13       }
    14     }
    15 
     6 
     7  public abstract class DoubleArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {
     8   
    169    protected override string FormatValue(object o) {
    1710      return ((double)o).ToString("r", CultureInfo.InvariantCulture);
     
    2417
    2518  [EmptyStorableClass]
    26   public class Double2DArray2XmlFormatter : DoubleArray2XmlFormatter {
    27     public override Type Type {
    28       get {
    29         return typeof(double[,]);
    30       }
    31     }
    32   }
     19  public class Double1DArray2XmlFormatter : DoubleArray2XmlFormatterBase<double[]> { }
     20
    3321
    3422  [EmptyStorableClass]
    35   public class Double3DArray2XmlFormatter : DoubleArray2XmlFormatter {
    36     public override Type Type {
    37       get {
    38         return typeof(double[, ,]);
    39       }
    40     }
    41   }
     23  public class Double2DArray2XmlFormatter : DoubleArray2XmlFormatterBase<double[,]> { }
     24
     25  [EmptyStorableClass]
     26  public class Double3DArray2XmlFormatter : DoubleArray2XmlFormatterBase<double[,,]> { }
    4227 
    4328}
Note: See TracChangeset for help on using the changeset viewer.