Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6237 for trunk/sources


Ignore:
Timestamp:
05/20/11 12:50:38 (14 years ago)
Author:
mkommend
Message:

#1532: Added method in cloner to detect if a clone is already registered.

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common/3.3/Cloner.cs

    r6233 r6237  
    5757      mapping.Add(item, clone);
    5858    }
     59
     60    /// <summary>
     61    /// Checks if a clone is already registered for a given deeply cloneable item.
     62    /// </summary>
     63    /// <param name="item">The original object.</param>
     64    /// <returns>True if a clone is already registered for the given item; false otherwise</returns>
     65    public bool ClonedObjectRegistered(IDeepCloneable item) {
     66      return mapping.ContainsKey(item);
     67    }
     68
    5969  }
    6070}
  • trunk/sources/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.4/SymbolicExpressionTreeGrammar.cs

    r6233 r6237  
    3737    public override IDeepCloneable Clone(Cloner cloner) {
    3838      foreach (ISymbol symbol in base.Symbols)
    39         cloner.RegisterClonedObject(symbol, symbol);
     39        if (!cloner.ClonedObjectRegistered(symbol))
     40          cloner.RegisterClonedObject(symbol, symbol);
    4041      return new SymbolicExpressionTreeGrammar(this, cloner);
    4142    }
Note: See TracChangeset for help on using the changeset viewer.