Changeset 3385


Ignore:
Timestamp:
04/17/10 23:12:52 (11 years ago)
Author:
swagner
Message:

Added base class DeepCloneable again (#975)

Location:
trunk/sources
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Common/3.3/HeuristicLab.Common-3.3.csproj

    r3384 r3385  
    8989    <None Include="HeuristicLabCommonPlugin.cs.frame" />
    9090    <Compile Include="Cloner.cs" />
     91    <Compile Include="DeepCloneable.cs" />
    9192    <Compile Include="IContent.cs" />
    9293    <Compile Include="IDeepCloneable.cs" />
  • trunk/sources/HeuristicLab.Core/3.3/ExecutionContext.cs

    r3376 r3385  
    2727namespace HeuristicLab.Core {
    2828  [StorableClass]
    29   public sealed class ExecutionContext : IDeepCloneable, IExecutionContext, IAtomicOperation {
     29  public sealed class ExecutionContext : DeepCloneable, IExecutionContext, IAtomicOperation {
    3030    [Storable]
    3131    private IParameterizedItem parameterizedItem;
     
    6363    }
    6464
    65     public object Clone() {
    66       return Clone(new Cloner());
    67     }
    68     public IDeepCloneable Clone(Cloner cloner) {
     65    public override IDeepCloneable Clone(Cloner cloner) {
    6966      ExecutionContext clone = new ExecutionContext();
    7067      cloner.RegisterClonedObject(this, clone);
  • trunk/sources/HeuristicLab.Core/3.3/Item.cs

    r3376 r3385  
    3131  [StorableClass]
    3232  [Item("Item", "Base class for all HeuristicLab items.")]
    33   public abstract class Item : IDeepCloneable, IItem {
     33  public abstract class Item : DeepCloneable, IItem {
    3434    public virtual string ItemName {
    3535      get { return ItemAttribute.GetName(this.GetType()); }
     
    6161    protected Item(bool deserializing) { }
    6262
    63 
    64     /// <summary>
    65     /// Creates a deep clone of this instance.
    66     /// </summary>
    67     /// <remarks>
    68     /// This method is the entry point for creating a deep clone of a whole object graph.
    69     /// </remarks>
    70     /// <returns>A clone of this instance.</returns>
    71     public object Clone() {
    72       return Clone(new Cloner());
    73     }
    74 
    7563    /// <summary>
    7664    /// Clones the current instance (deep clone).
     
    7866    /// <param name="clonedObjects">Dictionary of all already cloned objects. (Needed to avoid cycles.)</param>
    7967    /// <returns>The cloned object as <see cref="Variable"/>.</returns>
    80     public virtual IDeepCloneable Clone(Cloner cloner) {
    81       Item clone = (Item)Activator.CreateInstance(this.GetType());
    82       cloner.RegisterClonedObject(this, clone);
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      Item clone = (Item)base.Clone(cloner);
    8370      clone.readOnlyView = readOnlyView;
    8471      return clone;
  • trunk/sources/HeuristicLab.Core/3.3/OperationCollection.cs

    r3376 r3385  
    2828namespace HeuristicLab.Core {
    2929  [StorableClass]
    30   public sealed class OperationCollection : IDeepCloneable, IList<IOperation>, IOperation {
     30  public sealed class OperationCollection : DeepCloneable, IList<IOperation>, IOperation {
    3131    [Storable]
    3232    private IList<IOperation> operations;
     
    5252    }
    5353
    54     public object Clone() {
    55       return Clone(new Cloner());
    56     }
    57     public IDeepCloneable Clone(Cloner cloner) {
     54    public override IDeepCloneable Clone(Cloner cloner) {
    5855      OperationCollection clone = (OperationCollection)Activator.CreateInstance(this.GetType());
    5956      cloner.RegisterClonedObject(this, clone);
Note: See TracChangeset for help on using the changeset viewer.