Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/09 12:58:14 (16 years ago)
Author:
epitzer
Message:

Format white space. (Ctrl-K, Ctrl-D) (#548)

Location:
trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleArray2XmlFormatters.cs

    r1564 r1566  
    44
    55namespace HeuristicLab.Persistence.Default.Xml.Compact {
    6  
     6
    77  public abstract class DoubleArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {
    8    
     8
    99    protected override string FormatValue(object o) {
    1010      return ((double)o).ToString("r", CultureInfo.InvariantCulture);
     
    2424
    2525  [EmptyStorableClass]
    26   public class Double3DArray2XmlFormatter : DoubleArray2XmlFormatterBase<double[,,]> { }
    27  
     26  public class Double3DArray2XmlFormatter : DoubleArray2XmlFormatterBase<double[, ,]> { }
     27
    2828}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleList2XmlFormatter.cs

    r1564 r1566  
    88
    99  [EmptyStorableClass]
    10   public class DoubleList2XmlFormatter : NumberEnumeration2XmlFormatterBase<List<double>> {   
     10  public class DoubleList2XmlFormatter : NumberEnumeration2XmlFormatterBase<List<double>> {
    1111
    1212    protected override void Add(IEnumerable enumeration, object o) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntArray2XmlFormatters.cs

    r1564 r1566  
    33
    44namespace HeuristicLab.Persistence.Default.Xml.Compact {
    5  
    6   public abstract class IntArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {   
     5
     6  public abstract class IntArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {
    77
    88    protected override string FormatValue(object o) {
     
    2222
    2323  [EmptyStorableClass]
    24   public class Int3DArray2XmlFormatter : IntArray2XmlFormatterBase<int[,,]> { }
    25  
     24  public class Int3DArray2XmlFormatter : IntArray2XmlFormatterBase<int[, ,]> { }
     25
    2626}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntList2XmlFormatter.cs

    r1564 r1566  
    88  [EmptyStorableClass]
    99  public class IntList2XmlFormatter : NumberEnumeration2XmlFormatterBase<List<int>> {
    10    
     10
    1111    protected override void Add(IEnumerable enumeration, object o) {
    1212      ((List<int>)enumeration).Add((int)o);
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlFormatterBase.cs

    r1564 r1566  
    55
    66namespace HeuristicLab.Persistence.Default.Xml.Compact {
    7                                                              
     7
    88  public abstract class NumberArray2XmlFormatterBase<T> : FormatterBase<T, XmlString> {
    99
     
    3030      }
    3131      int[] positions = (int[])lowerBounds.Clone();
    32       while (positions[a.Rank - 1] < lengths[a.Rank - 1] + lowerBounds[a.Rank - 1]) {       
     32      while (positions[a.Rank - 1] < lengths[a.Rank - 1] + lowerBounds[a.Rank - 1]) {
    3333        sb.Append(Separator);
    3434        sb.Append(FormatValue(a.GetValue(positions)));
     
    4242          }
    4343        }
    44       }     
     44      }
    4545      return new XmlString(sb.ToString());
    4646    }
     
    8080    }
    8181  }
    82  
     82
    8383}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberEnumeration2XmlFormatterBase.cs

    r1564 r1566  
    55
    66namespace HeuristicLab.Persistence.Default.Xml.Compact {
    7  
     7
    88  public abstract class NumberEnumeration2XmlFormatterBase<T> : FormatterBase<T, XmlString> where T : IEnumerable {
    99
     
    3232    }
    3333  }
    34  
     34
    3535}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Bool2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Bool2XmlFormatter : SimpleNumber2XmlFormatterBase<bool> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Byte2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Byte2XmlFormatter : SimpleNumber2XmlFormatterBase<byte> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/DateTime2XmlFormatter.cs

    r1564 r1566  
    66
    77  [EmptyStorableClass]
    8   public class DateTime2XmlFormatter : FormatterBase<DateTime, XmlString> {   
    9    
     8  public class DateTime2XmlFormatter : FormatterBase<DateTime, XmlString> {
     9
    1010    public override XmlString Format(DateTime dt) {
    11       return new XmlString(dt.Ticks.ToString());     
     11      return new XmlString(dt.Ticks.ToString());
    1212    }
    1313
     
    1818  }
    1919
    20  
     20
    2121}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Decimal2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Decimal2XmlFormatter : DecimalNumber2XmlFormatterBase<decimal> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/DecimalNumber2XmlFormatterBase.cs

    r1564 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  public abstract class DecimalNumber2XmlFormatterBase<T> : FormatterBase<T, XmlString> {
    10    
     10
    1111    private static MethodInfo ToStringMethod = typeof(T)
    1212      .GetMethod(
     
    3030      return new XmlString((string)ToStringMethod.Invoke(t, new object[] { "r", CultureInfo.InvariantCulture }));
    3131    }
    32     public override T Parse(XmlString x) {     
     32    public override T Parse(XmlString x) {
    3333      return (T)ParseMethod.Invoke(null, new object[] { x.Data, CultureInfo.InvariantCulture });
    3434    }
    35   } 
     35  }
    3636}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Double2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8    
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Double2XmlFormatter : DecimalNumber2XmlFormatterBase<double> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Float2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8    
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Float2XmlFormatter : DecimalNumber2XmlFormatterBase<float> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Int2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
    88
    99  [EmptyStorableClass]
    1010  public class Int2XmlFormatter : SimpleNumber2XmlFormatterBase<int> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Long2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
    88
    99  [EmptyStorableClass]
    1010  public class Long2XmlFormatter : SimpleNumber2XmlFormatterBase<long> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/SByte2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Sbyte2XmlFormatter : SimpleNumber2XmlFormatterBase<sbyte> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/Short2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class Short2XmlFormatter : SimpleNumber2XmlFormatterBase<short> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/SimpleNumber2XmlFormatterBase.cs

    r1564 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
    88
    99  public abstract class SimpleNumber2XmlFormatterBase<T> : FormatterBase<T, XmlString> {
     
    2222    }
    2323    public override T Parse(XmlString x) {
    24       return (T)ParseMethod.Invoke(null, new[] { x.Data });     
     24      return (T)ParseMethod.Invoke(null, new[] { x.Data });
    2525    }
    26   } 
     26  }
    2727}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/String2XmlFormatter.cs

    r1564 r1566  
    99  [EmptyStorableClass]
    1010  public class String2XmlFormatter : FormatterBase<string, XmlString> {
    11    
     11
    1212    public override XmlString Format(string s) {
    1313      StringBuilder sb = new StringBuilder();
     
    1515      sb.Append(s.Replace("]]>", "]]]]><![CDATA[>"));
    1616      sb.Append("]]>");
    17       return new XmlString(sb.ToString()); 
     17      return new XmlString(sb.ToString());
    1818    }
    1919
     
    2222    public override string Parse(XmlString x) {
    2323      StringBuilder sb = new StringBuilder();
    24       foreach (string s in x.Data.Split(separators,       
     24      foreach (string s in x.Data.Split(separators,
    2525        StringSplitOptions.RemoveEmptyEntries)) {
    2626        sb.Append(s);
     
    2828      return sb.ToString();
    2929    }
    30   } 
     30  }
    3131}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/UInt2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class UInt2XmlFormatter : SimpleNumber2XmlFormatterBase<uint> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/ULong2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    10   public class ULong2XmlFormatter : SimpleNumber2XmlFormatterBase<ulong> { } 
    11  
     10  public class ULong2XmlFormatter : SimpleNumber2XmlFormatterBase<ulong> { }
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Primitive/UShort2XmlFormatter.cs

    r1554 r1566  
    55using System.Globalization;
    66
    7 namespace HeuristicLab.Persistence.Default.Xml.Primitive { 
    8  
     7namespace HeuristicLab.Persistence.Default.Xml.Primitive {
     8
    99  [EmptyStorableClass]
    1010  public class UShort2XmlFormatter : SimpleNumber2XmlFormatterBase<ushort> { }
    11  
     11
    1212}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlFormat.cs

    r1564 r1566  
    66  [EmptyStorableClass]
    77  public class XmlFormat : FormatBase<XmlString> {
    8     public override string Name { get { return "XML"; } }   
     8    public override string Name { get { return "XML"; } }
    99  }
    1010
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r1564 r1566  
    2121    public const string METAINFO = "METAINFO";
    2222  }
    23  
     23
    2424  public class XmlGenerator : GeneratorBase<string> {
    25    
     25
    2626    private int depth;
    2727
     
    4545      if (type == NodeType.End)
    4646        sb.Append('/');
    47       sb.Append(name);     
     47      sb.Append(name);
    4848      foreach (var attribute in attributes) {
    4949        if (attribute.Value != null && !string.IsNullOrEmpty(attribute.Value.ToString())) {
     
    5858        sb.Append('/');
    5959      sb.Append(">");
    60       return sb.ToString();     
     60      return sb.ToString();
    6161    }
    6262
     
    6565    }
    6666
    67     protected override string Format(BeginToken beginToken) {           
     67    protected override string Format(BeginToken beginToken) {
    6868      var attributes = new Dictionary<string, object> {
    6969        {"name", beginToken.Name},
     
    7676    }
    7777
    78     protected override string Format(EndToken endToken) {     
     78    protected override string Format(EndToken endToken) {
    7979      depth -= 1;
    8080      return Prefix + "</" + XmlStrings.COMPOSITE + ">\r\n";
    8181    }
    8282
    83     protected override string Format(PrimitiveToken dataToken) {     
     83    protected override string Format(PrimitiveToken dataToken) {
    8484      var attributes =
    8585        new Dictionary<string, object> {
     
    8989      return Prefix +
    9090        FormatNode(XmlStrings.PRIMITIVE, attributes, NodeType.Start) +
    91         ((XmlString)dataToken.SerialData).Data + "</" + XmlStrings.PRIMITIVE + ">\r\n";     
     91        ((XmlString)dataToken.SerialData).Data + "</" + XmlStrings.PRIMITIVE + ">\r\n";
    9292    }
    9393
    94     protected override string Format(ReferenceToken refToken) {     
     94    protected override string Format(ReferenceToken refToken) {
    9595      var attributes = new Dictionary<string, object> {
    9696        {"ref", refToken.Id},
    97         {"name", refToken.Name}};                                       
    98       return Prefix + FormatNode(XmlStrings.REFERENCE, attributes, NodeType.Inline) + "\r\n"; 
     97        {"name", refToken.Name}};
     98      return Prefix + FormatNode(XmlStrings.REFERENCE, attributes, NodeType.Inline) + "\r\n";
    9999    }
    100100
    101     protected override string Format(NullReferenceToken nullRefToken) {     
     101    protected override string Format(NullReferenceToken nullRefToken) {
    102102      var attributes = new Dictionary<string, object>{
    103         {"name", nullRefToken.Name}};     
     103        {"name", nullRefToken.Name}};
    104104      return Prefix + FormatNode(XmlStrings.NULL, attributes, NodeType.Inline) + "\r\n";
    105105    }
     
    127127    }
    128128
    129     public static void Serialize(object o, string filename) {     
     129    public static void Serialize(object o, string filename) {
    130130      Serialize(o, filename, ConfigurationService.Instance.GetDefaultConfig(new XmlFormat()));
    131131    }
     
    135135      XmlGenerator generator = new XmlGenerator();
    136136      ZipOutputStream zipStream = new ZipOutputStream(File.Create(filename));
    137       zipStream.SetLevel(9);     
    138       zipStream.PutNextEntry(new ZipEntry("data.xml"));     
     137      zipStream.SetLevel(9);
     138      zipStream.PutNextEntry(new ZipEntry("data.xml"));
    139139      StreamWriter writer = new StreamWriter(zipStream);
    140       ILog logger = Logger.GetDefaultLogger();     
     140      ILog logger = Logger.GetDefaultLogger();
    141141      foreach (ISerializationToken token in serializer) {
    142142        string line = generator.Format(token);
     
    151151        logger.Debug(line);
    152152      }
    153       writer.Flush();           
    154       zipStream.Close();     
     153      writer.Flush();
     154      zipStream.Close();
    155155    }
    156156
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs

    r1564 r1566  
    1919    public XmlParser(TextReader input) {
    2020      XmlReaderSettings settings = new XmlReaderSettings {
    21                                        ConformanceLevel = ConformanceLevel.Document,
    22                                        IgnoreWhitespace = true,
    23                                        IgnoreComments = true
    24                                      };
     21        ConformanceLevel = ConformanceLevel.Document,
     22        IgnoreWhitespace = true,
     23        IgnoreComments = true
     24      };
    2525      reader = XmlReader.Create(input, settings);
    2626      handlers = new Dictionary<string, Handler> {
     
    6666
    6767    private IEnumerator<ISerializationToken> ParseComposite() {
    68       string name = reader.GetAttribute("name");           
     68      string name = reader.GetAttribute("name");
    6969      string idString = reader.GetAttribute("id");
    7070      int? id = null;
     
    104104      var typeCache = new List<TypeMapping>();
    105105      XmlReader xmlReader = XmlReader.Create(reader);
    106       while ( xmlReader.Read() ) {
     106      while (xmlReader.Read()) {
    107107        if (xmlReader.Name == XmlStrings.TYPE) {
    108108          typeCache.Add(new TypeMapping(
     
    116116
    117117    public static object DeSerialize(string filename) {
    118       ZipFile zipFile = new ZipFile(filename);     
     118      ZipFile zipFile = new ZipFile(filename);
    119119      Deserializer deSerializer = new Deserializer(
    120120        ParseTypeCache(
     
    123123      XmlParser parser = new XmlParser(
    124124        new StreamReader(zipFile.GetInputStream(zipFile.GetEntry("data.xml"))));
    125       return deSerializer.Deserialize(parser);     
     125      return deSerializer.Deserialize(parser);
    126126    }
    127   } 
     127  }
    128128}
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlString.cs

    r1564 r1566  
    33
    44namespace HeuristicLab.Persistence.Default.Xml {
    5  
     5
    66  public class XmlString : ISerialData {
    77
Note: See TracChangeset for help on using the changeset viewer.