Changeset 1612


Ignore:
Timestamp:
04/20/09 17:36:22 (12 years ago)
Author:
epitzer
Message:

namespace refactoring (#548)

Location:
trunk/sources/HeuristicLab.Persistence/3.3
Files:
10 added
8 deleted
8 edited

Legend:

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

    r1574 r1612  
    6969        Type type = Type.GetType(typeMapping.TypeName, true);
    7070        typeIds.Add(typeMapping.Id, type);
    71         if (typeMapping.Serializer != null) {
    72           Type serializerType = Type.GetType(typeMapping.Serializer);
    73           map.Add(type, Activator.CreateInstance(serializerType, true));
    74         }
     71        Type serializerType = Type.GetType(typeMapping.Serializer);
     72        map.Add(type, Activator.CreateInstance(serializerType, true));
    7573      }
    7674      return map;
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/DebugString/DebugStringGenerator.cs

    r1567 r1612  
    1414    private readonly bool showRefs;
    1515
    16     public DebugStringGenerator() : this(false) { }
     16    public DebugStringGenerator() : this(true) { }
    1717
    1818    public DebugStringGenerator(bool showRefs) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/DoubleArray2XmlFormatters.cs

    r1566 r1612  
    55namespace HeuristicLab.Persistence.Default.Xml.Compact {
    66
    7   public abstract class DoubleArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {
     7  public abstract class DoubleArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> where T : class{
    88
    99    protected override string FormatValue(object o) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/IntArray2XmlFormatters.cs

    r1566 r1612  
    44namespace HeuristicLab.Persistence.Default.Xml.Compact {
    55
    6   public abstract class IntArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> {
     6  public abstract class IntArray2XmlFormatterBase<T> : NumberArray2XmlFormatterBase<T> where T : class{
    77
    88    protected override string FormatValue(object o) {
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/Compact/NumberArray2XmlFormatterBase.cs

    r1566 r1612  
    66namespace HeuristicLab.Persistence.Default.Xml.Compact {
    77
    8   public abstract class NumberArray2XmlFormatterBase<T> : FormatterBase<T, XmlString> {
     8  public abstract class NumberArray2XmlFormatterBase<T> : FormatterBase<T, XmlString> where T : class {
    99
    1010    protected virtual string Separator { get { return ";"; } }
     
    1212    protected abstract object ParseValue(string o);
    1313
    14     public override XmlString Format(T t) {
    15       object o = (object)t;
    16       Array a = (Array)o;
     14    public override XmlString Format(T t) {     
     15      Array a = (Array)(object)t;
    1716      int[] lengths = new int[a.Rank];
    1817      int[] lowerBounds = new int[a.Rank];
     
    7574          }
    7675        }
    77       }
    78       object o = a;
    79       return (T)o;
     76      }     
     77      return (T)(object)a;
    8078    }
    8179  }
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlGenerator.cs

    r1570 r1612  
    1010using HeuristicLab.Persistence.Core.Tokens;
    1111
    12 namespace HeuristicLab.Persistence.Default.Xml {
    13 
    14   struct XmlStrings {
    15     public const string PRIMITIVE = "PRIMITVE";
    16     public const string COMPOSITE = "COMPOSITE";
    17     public const string REFERENCE = "REFERENCE";
    18     public const string NULL = "NULL";
    19     public const string TYPECACHE = "TYPECACHE";
    20     public const string TYPE = "TYPE";
    21     public const string METAINFO = "METAINFO";
    22   }
     12namespace HeuristicLab.Persistence.Default.Xml { 
    2313
    2414  public class XmlGenerator : GeneratorBase<string> {
     
    116106    protected override string Format(BeginToken beginToken) {
    117107      return CreateNodeStart(
    118         XmlStrings.COMPOSITE,
     108        XmlStringConstants.COMPOSITE,
    119109        new Dictionary<string, object> {
    120110          {"name", beginToken.Name},
     
    124114
    125115    protected override string Format(EndToken endToken) {
    126       return CreateNodeEnd(XmlStrings.COMPOSITE);
     116      return CreateNodeEnd(XmlStringConstants.COMPOSITE);
    127117    }
    128118
    129119    protected override string Format(PrimitiveToken dataToken) {
    130       return CreateNode(XmlStrings.PRIMITIVE,
     120      return CreateNode(XmlStringConstants.PRIMITIVE,
    131121        new Dictionary<string, object> {
    132122            {"typeId", dataToken.TypeId},
     
    137127
    138128    protected override string Format(ReferenceToken refToken) {
    139       return CreateNode(XmlStrings.REFERENCE,
     129      return CreateNode(XmlStringConstants.REFERENCE,
    140130        new Dictionary<string, object> {
    141131          {"ref", refToken.Id},
     
    144134
    145135    protected override string Format(NullReferenceToken nullRefToken) {
    146       return CreateNode(XmlStrings.NULL,
     136      return CreateNode(XmlStringConstants.NULL,
    147137        new Dictionary<string, object>{
    148138          {"name", nullRefToken.Name}});
     
    150140
    151141    protected override string Format(MetaInfoBeginToken metaInfoBeginToken) {
    152       return CreateNodeStart(XmlStrings.METAINFO);
     142      return CreateNodeStart(XmlStringConstants.METAINFO);
    153143    }
    154144
    155145    protected override string Format(MetaInfoEndToken metaInfoEndToken) {
    156       return CreateNodeEnd(XmlStrings.METAINFO);
     146      return CreateNodeEnd(XmlStringConstants.METAINFO);
    157147    }
    158148
    159149    public IEnumerable<string> Format(List<TypeMapping> typeCache) {
    160       yield return CreateNodeStart(XmlStrings.TYPECACHE);
     150      yield return CreateNodeStart(XmlStringConstants.TYPECACHE);
    161151      foreach (var mapping in typeCache)
    162152        yield return CreateNode(
    163           XmlStrings.TYPE,
     153          XmlStringConstants.TYPE,
    164154          mapping.GetDict());
    165       yield return CreateNodeEnd(XmlStrings.TYPECACHE);
     155      yield return CreateNodeEnd(XmlStringConstants.TYPECACHE);
    166156    }
    167157
  • trunk/sources/HeuristicLab.Persistence/3.3/Default/Xml/XmlParser.cs

    r1566 r1612  
    2525      reader = XmlReader.Create(input, settings);
    2626      handlers = new Dictionary<string, Handler> {
    27                      {XmlStrings.PRIMITIVE, ParsePrimitive},
    28                      {XmlStrings.COMPOSITE, ParseComposite},
    29                      {XmlStrings.REFERENCE, ParseReference},
    30                      {XmlStrings.NULL, ParseNull},
    31                      {XmlStrings.METAINFO, ParseMetaInfo},
     27                     {XmlStringConstants.PRIMITIVE, ParsePrimitive},
     28                     {XmlStringConstants.COMPOSITE, ParseComposite},
     29                     {XmlStringConstants.REFERENCE, ParseReference},
     30                     {XmlStringConstants.NULL, ParseNull},
     31                     {XmlStringConstants.METAINFO, ParseMetaInfo},
    3232                   };
    3333    }
     
    105105      XmlReader xmlReader = XmlReader.Create(reader);
    106106      while (xmlReader.Read()) {
    107         if (xmlReader.Name == XmlStrings.TYPE) {
     107        if (xmlReader.Name == XmlStringConstants.TYPE) {
    108108          typeCache.Add(new TypeMapping(
    109109            int.Parse(xmlReader.GetAttribute("id")),
  • trunk/sources/HeuristicLab.Persistence/3.3/HeuristicLab.Persistence-3.3.csproj

    r1567 r1612  
    103103    <Compile Include="Default\DebugString\DebugString.cs" />
    104104    <Compile Include="Default\DebugString\DebugStringFormat.cs" />
    105     <Compile Include="Default\DebugString\ValueType2DebugStringFormatterBase.cs" />
    106     <Compile Include="Default\DebugString\String2DebugStringFormatter.cs" />
    107     <Compile Include="Default\DebugString\Bool2DebugStringFormatter.cs" />
    108     <Compile Include="Default\DebugString\Int2DebugStringFormatter.cs" />
    109     <Compile Include="Default\DebugString\Doubld2DebugStringFormatter.cs" />
    110     <Compile Include="Default\DebugString\DateTime2DebugStringFormatter.cs" />
    111     <Compile Include="Default\DebugString\Type2DebugStringFormatter.cs" />
    112     <Compile Include="Default\DebugString\Float2DebugStringFormatter.cs" />
     105    <Compile Include="Default\DebugString\Formatters\ValueType2DebugStringFormatterBase.cs" />
     106    <Compile Include="Default\DebugString\Formatters\String2DebugStringFormatter.cs" />
     107    <Compile Include="Default\DebugString\Formatters\Bool2DebugStringFormatter.cs" />
     108    <Compile Include="Default\DebugString\Formatters\Int2DebugStringFormatter.cs" />
     109    <Compile Include="Default\DebugString\Formatters\Doubld2DebugStringFormatter.cs" />
     110    <Compile Include="Default\DebugString\Formatters\DateTime2DebugStringFormatter.cs" />
     111    <Compile Include="Default\DebugString\Formatters\Type2DebugStringFormatter.cs" />
     112    <Compile Include="Default\DebugString\Formatters\Float2DebugStringFormatter.cs" />
    113113    <Compile Include="Default\DebugString\DebugStringGenerator.cs" />
    114114    <Compile Include="Default\Decomposers\ArrayDecomposer.cs" />
     
    129129    <Compile Include="Core\DataMemberAccessor.cs" />
    130130    <Compile Include="Default\Xml\Compact\IntList2XmlFormatter.cs" />
     131    <Compile Include="Default\Xml\XmlStrings.cs" />
    131132    <Compile Include="Default\Xml\XmlString.cs" />
    132133    <Compile Include="Default\Xml\Primitive\Double2XmlFormatter.cs" />
Note: See TracChangeset for help on using the changeset viewer.