Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/16/09 13:20:55 (16 years ago)
Author:
epitzer
Message:

One file per class; rename ViewOnlyFormat -> DebugStringFormat (#548)

File:
1 edited

Legend:

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

    r1566 r1567  
    44using HeuristicLab.Persistence.Core.Tokens;
    55
    6 namespace HeuristicLab.Persistence.Core {
     6namespace HeuristicLab.Persistence.Core { 
    77
    8   public class ParentReference { }
     8  public class Deserializer {   
    99
    10   class Midwife {
     10    class Midwife {
    1111
    12     public int? Id { get; private set; }
    13     public bool MetaMode { get; set; }
    14     public object Obj { get; private set; }
     12      public int? Id { get; private set; }
     13      public bool MetaMode { get; set; }
     14      public object Obj { get; private set; }
    1515
    16     private List<Tag> metaInfo;
    17     private List<Tag> customValues;
    18     private Type type;
    19     private IDecomposer decomposer;
     16      private List<Tag> metaInfo;
     17      private List<Tag> customValues;
     18      private Type type;
     19      private IDecomposer decomposer;
    2020
    21     public Midwife(object value) {
    22       this.Obj = value;
    23     }
     21      public Midwife(object value) {
     22        this.Obj = value;
     23      }
    2424
    25     public Midwife(Type type, IDecomposer decomposer, int? id) {
    26       this.type = type;
    27       this.decomposer = decomposer;
    28       this.Id = id;
    29       MetaMode = false;
    30       metaInfo = new List<Tag>();
    31       customValues = new List<Tag>();
    32     }
     25      public Midwife(Type type, IDecomposer decomposer, int? id) {
     26        this.type = type;
     27        this.decomposer = decomposer;
     28        this.Id = id;
     29        MetaMode = false;
     30        metaInfo = new List<Tag>();
     31        customValues = new List<Tag>();
     32      }
    3333
    34     public void CreateInstance() {
    35       if (Obj != null)
    36         throw new ApplicationException("object already instantiated");
    37       Obj = decomposer.CreateInstance(type, metaInfo);
    38     }
     34      public void CreateInstance() {
     35        if (Obj != null)
     36          throw new ApplicationException("object already instantiated");
     37        Obj = decomposer.CreateInstance(type, metaInfo);
     38      }
    3939
    40     public void AddValue(string name, object value) {
    41       if (MetaMode) {
    42         metaInfo.Add(new Tag(name, value));
    43       } else {
    44         customValues.Add(new Tag(name, value));
     40      public void AddValue(string name, object value) {
     41        if (MetaMode) {
     42          metaInfo.Add(new Tag(name, value));
     43        } else {
     44          customValues.Add(new Tag(name, value));
     45        }
     46      }
     47
     48      public void Populate() {
     49        decomposer.Populate(Obj, customValues, type);
    4550      }
    4651    }
    47 
    48     public void Populate() {
    49       decomposer.Populate(Obj, customValues, type);
    50     }
    51   }
    52 
    53   public class Deserializer {
    5452
    5553    private readonly Dictionary<int, object> id2obj;
Note: See TracChangeset for help on using the changeset viewer.