Free cookie consent management tool by TermsFeed Policy Generator

Changeset 1360


Ignore:
Timestamp:
03/19/09 12:31:19 (16 years ago)
Author:
epitzer
Message:

Scrap Storable-based cloning & reorganize namespaces. (#506)

Location:
branches/New Persistence Exploration/Persistence
Files:
13 added
10 deleted
5 edited

Legend:

Unmodified
Added
Removed
  • branches/New Persistence Exploration/Persistence/Persistence/HeuristicLab.Persistence.csproj

    r1357 r1360  
    5555  </ItemGroup>
    5656  <ItemGroup>
    57     <Compile Include="ArrayFormatters.cs" />
    58     <Compile Include="EnumerableFormatters.cs" />
     57    <Compile Include="Default\NumberArrayFormatters.cs" />
     58    <Compile Include="Core\DataMemberAccessor.cs" />
     59    <Compile Include="Default\EnumerableFormatters.cs" />
    5960    <Compile Include="HeuristicLabPersistencePlugin.cs" />
    60     <Compile Include="DeSerializer.cs" />
     61    <Compile Include="Core\DeSerializer.cs" />
    6162    <Compile Include="Interfaces\IDecomposer.cs" />
    6263    <Compile Include="Interfaces\IFormatter.cs" />
    63     <Compile Include="PersistenceConfiguration.cs" />
     64    <Compile Include="Core\PersistenceConfiguration.cs" />
    6465    <Compile Include="Properties\AssemblyInfo.cs" />
    65     <Compile Include="Serializer.cs" />
    66     <Compile Include="Decomposers.cs" />
    67     <Compile Include="PrimitiveFormatters.cs" />
     66    <Compile Include="Core\Serializer.cs" />
     67    <Compile Include="Default\Decomposers.cs" />
     68    <Compile Include="Default\PrimitiveFormatters.cs" />
    6869    <Compile Include="Interfaces\Tokens.cs" />
    6970    <Compile Include="Util.cs" />
    70     <Compile Include="StorableAttribute.cs" />
    71     <Compile Include="XmlFormatter.cs" />
    72     <Compile Include="XmlParser.cs" />
     71    <Compile Include="Core\StorableAttribute.cs" />
     72    <Compile Include="Default\XmlFormatter.cs" />
     73    <Compile Include="Default\XmlParser.cs" />
    7374  </ItemGroup>
    7475  <PropertyGroup>
  • branches/New Persistence Exploration/Persistence/Persistence/Interfaces/IDecomposer.cs

    r1357 r1360  
    55
    66  public interface IDecomposer {
    7     bool CanSerialize(Type type);
    8     IEnumerable Serialize(object obj);
    9     object DeSerialize(IEnumerable objects, Type type);
     7    bool CanDecompose(Type type);
     8    IEnumerable DeCompose(object obj);
     9    object Compose(IEnumerable objects, Type type);
    1010  }
    1111
  • branches/New Persistence Exploration/Persistence/Persistence/Interfaces/IFormatter.cs

    r1357 r1360  
    1010    Type Type { get; }
    1111    IFormat Format { get; }
    12     object Serialize(object o);
    13     object DeSerialize(object o);
     12    object DoFormat(object o);
     13    object Parse(object o);
    1414  }
    1515
  • branches/New Persistence Exploration/Persistence/Test/NewSerializationTest.cs

    r1358 r1360  
    33using System.Collections.Generic;
    44using System.IO;
     5using HeuristicLab.Persistence.Core;
    56using HeuristicLab.Persistence.Interfaces;
    67
     
    172173        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")),
    173174        ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance));       
    174       object o = deSerializer.DeSerialize(parser);
    175       Root t = CloningFactory.DefaultClone(r);
     175      object o = deSerializer.DeSerialize(parser);     
    176176      Console.Out.WriteLine(Util.AutoFormat(o, true));     
    177177    }
     
    193193        XmlParser.ParseTypeCache(new StreamReader("test-types.xml")),
    194194        ConfigurationService.Instance.GetDefaultConfig(XmlFormat.Instance));       
    195       object o = deSerializer.DeSerialize(parser);
    196       Manager n = CloningFactory.DefaultClone(m);
     195      object o = deSerializer.DeSerialize(parser);     
    197196      Console.Out.WriteLine(Util.AutoFormat(o, true));     
    198     }
    199 
    200     public static void SpeedTest() {
    201       StorableObject storable = new StorableObject();
    202       CloneableObject cloneable = new CloneableObject();
    203       Console.Write("initializing...");
    204       storable.Init();
    205       cloneable.Init();
    206       Console.WriteLine("done");
    207       List<StorableObject> storableClones = new List<StorableObject>();
    208       List<CloneableObject> clonableClones = new List<CloneableObject>();
    209       CloningFactory cloningFactory = new CloningFactory();
    210       for (int i = 0; i < 100000; i++) {
    211         Console.Write("cloning storable.. ");
    212         storableClones.Add(cloningFactory.Clone(storable));
    213         Console.WriteLine();
    214         Console.Write("cloning cloneable.. ");
    215         clonableClones.Add((CloneableObject)cloneable.Clone());
    216         Console.WriteLine();
    217       }
    218     }
    219 
    220     public static void SpeedTest2() {
    221       Root r = new Root();
    222       r.selfReferences = new List<Root> {r, r};
    223       r.c = new Custom {r = r};
    224       r.dict.Add("one", 1);
    225       r.dict.Add("two", 2);
    226       r.dict.Add("three", 3);
    227 
    228       CloneableRoot cr = new CloneableRoot();
    229       cr.selfReferences = new List<CloneableRoot> {cr, cr};
    230       cr.c = new CloneableCustom {r = cr};
    231       cr.dict.Add("one", 1);
    232       cr.dict.Add("two", 2);
    233       cr.dict.Add("three", 3);     
    234       List<Root> storableClones = new List<Root>();
    235       List<CloneableRoot> clonableClones = new List<CloneableRoot>();     
    236       CloningFactory cloningFactory = new CloningFactory();
    237 
    238       DateTime start = DateTime.Now;
    239       Console.Write("cloning storable.. ");
    240       for (int i = 0; i < 100000; i++) {       
    241         storableClones.Add(cloningFactory.Clone(r));                       
    242       }
    243       Console.WriteLine(new TimeSpan(DateTime.Now.Ticks - start.Ticks));
    244 
    245       start = DateTime.Now;
    246       Console.Write("cloning storable again.. ");
    247       for (int i = 0; i < 100000; i++) {
    248         storableClones.Add(cloningFactory.Clone(r));
    249       }
    250       Console.WriteLine(new TimeSpan(DateTime.Now.Ticks - start.Ticks));
    251 
    252       start = DateTime.Now;
    253       Console.Write("cloning cloneable.. ");
    254       for (int i = 0; i < 100000; i++) {       
    255         clonableClones.Add((CloneableRoot)cr.Clone(new Dictionary<object, object>()));
    256       }
    257       Console.WriteLine(new TimeSpan(DateTime.Now.Ticks - start.Ticks));
    258       clonableClones.Clear();
    259      
    260     }
     197    }   
    261198
    262199    public class Base {
  • branches/New Persistence Exploration/Persistence/Test/StorableAttributeTests.cs

    r1357 r1360  
    11using System;
    22using System.Collections.Generic;
     3using HeuristicLab.Persistence.Core;
    34
    45namespace HeuristicLab.Persistence.Test {
Note: See TracChangeset for help on using the changeset viewer.