Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (13 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeGrammar.cs

    r4249 r4722  
    3030    [StorableConstructor]
    3131    private SymbolicExpressionTreeGrammar(bool deserializing) : base(deserializing) { }
    32     //default ctor for cloning
    33     private SymbolicExpressionTreeGrammar() : base(false) { }
     32    // don't call storable ctor of base class to prevent full cloning
     33    // instead use storable ctor to initialize an empty grammar and fill with InizializeShallowClone
     34    private SymbolicExpressionTreeGrammar(SymbolicExpressionTreeGrammar original, Cloner cloner)
     35      : base(false) {
     36      cloner.RegisterClonedObject(original, this);
     37      InitializeShallowClone(original);
     38    }
     39    private SymbolicExpressionTreeGrammar() : base() { }
    3440
    3541    public override IDeepCloneable Clone(Cloner cloner) {
    36       SymbolicExpressionTreeGrammar clone = new SymbolicExpressionTreeGrammar();
    37       cloner.RegisterClonedObject(this, clone);
    38       InitializeShallowClone(clone);
    39       return clone;
     42      return new SymbolicExpressionTreeGrammar(this, cloner);
    4043    }
    4144  }
Note: See TracChangeset for help on using the changeset viewer.