Free cookie consent management tool by TermsFeed Policy Generator

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

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Creators/UniformRandomIntegerVectorCreator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    3132  [StorableClass]
    3233  public class UniformRandomIntegerVectorCreator : IntegerVectorCreator {
     34    [StorableConstructor]
     35    protected UniformRandomIntegerVectorCreator(bool deserializing) : base(deserializing) { }
     36    protected UniformRandomIntegerVectorCreator(UniformRandomIntegerVectorCreator original, Cloner cloner) : base(original, cloner) { }
     37    public UniformRandomIntegerVectorCreator() : base() { }
     38
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new UniformRandomIntegerVectorCreator(this, cloner);
     41    }
     42
    3343    /// <summary>
    3444    /// Generates a new random integer vector with the given <paramref name="length"/>.
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs

    r4068 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3435  [StorableClass]
    3536  public class DiscreteCrossover : IntegerVectorCrossover {
     37    [StorableConstructor]
     38    protected DiscreteCrossover(bool deserializing) : base(deserializing) { }
     39    protected DiscreteCrossover(DiscreteCrossover original, Cloner cloner) : base(original, cloner) { }
     40    public DiscreteCrossover() : base() { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new DiscreteCrossover(this, cloner);
     44    }
     45
    3646    /// <summary>
    3747    /// Performs a discrete crossover operation of the two given parents.
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/MultiIntegerVectorCrossover.cs

    r3674 r4722  
    2323using System.Linq;
    2424using HeuristicLab.Collections;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Operators;
     
    5051
    5152    [StorableConstructor]
    52     private MultiIntegerVectorCrossover(bool deserializing) : base(deserializing) { }
     53    protected MultiIntegerVectorCrossover(bool deserializing) : base(deserializing) { }
     54    protected MultiIntegerVectorCrossover(MultiIntegerVectorCrossover original, Cloner cloner) : base(original, cloner) { }
    5355    public MultiIntegerVectorCrossover()
    5456      : base() {
     
    6264          Operators.Add((IIntegerVectorCrossover)Activator.CreateInstance(type), true);
    6365      }
     66    }
     67
     68    public override IDeepCloneable Clone(Cloner cloner) {
     69      return new MultiIntegerVectorCrossover(this, cloner);
    6470    }
    6571
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/SinglePointCrossover.cs

    r4068 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3435  [StorableClass]
    3536  public class SinglePointCrossover : IntegerVectorCrossover {
     37    [StorableConstructor]
     38    protected SinglePointCrossover(bool deserializing) : base(deserializing) { }
     39    protected SinglePointCrossover(SinglePointCrossover original, Cloner cloner) : base(original, cloner) { }
     40    public SinglePointCrossover() : base() { }
     41
     42    public override IDeepCloneable Clone(Cloner cloner) {
     43      return new SinglePointCrossover(this, cloner);
     44    }
     45
    3646    /// <summary>
    3747    /// Performs a single point crossover at a randomly chosen position of the two
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVector.cs

    r3431 r4722  
    2929  [Item("IntegerVector", "Represents a vector of integer values.")]
    3030  public class IntegerVector : IntArray {
     31    [StorableConstructor]
     32    protected IntegerVector(bool deserializing) : base(deserializing) { }
     33    protected IntegerVector(IntegerVector original, Cloner cloner) : base(original, cloner) { }
    3134    public IntegerVector() : base() { }
    3235    public IntegerVector(int length) : base(length) { }
     
    4346
    4447    public override IDeepCloneable Clone(Cloner cloner) {
    45       IntegerVector clone = new IntegerVector(array);
    46       cloner.RegisterClonedObject(this, clone);
    47       clone.readOnly = readOnly;
    48       return clone;
     48      return new IntegerVector(this, cloner);
    4949    }
    5050
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCreator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Data;
     
    5354    }
    5455
     56    [StorableConstructor]
     57    protected IntegerVectorCreator(bool deserializing) : base(deserializing) { }
     58    protected IntegerVectorCreator(IntegerVectorCreator original, Cloner cloner) : base(original, cloner) { }
    5559    protected IntegerVectorCreator()
    5660      : base() {
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorCrossover.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Operators;
     
    4647    }
    4748
     49    [StorableConstructor]
     50    protected IntegerVectorCrossover(bool deserializing) : base(deserializing) { }
     51    protected IntegerVectorCrossover(IntegerVectorCrossover original, Cloner cloner) : base(original, cloner) { }
    4852    protected IntegerVectorCrossover()
    4953      : base() {
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/IntegerVectorManipulator.cs

    r4068 r4722  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Operators;
     
    4344    }
    4445
     46    [StorableConstructor]
     47    protected IntegerVectorManipulator(bool deserializing) : base(deserializing) { }
     48    protected IntegerVectorManipulator(IntegerVectorManipulator original, Cloner cloner) : base(original, cloner) { }
    4549    protected IntegerVectorManipulator()
    4650      : base() {
  • trunk/sources/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Manipulators/UniformOnePositionManipulator.cs

    r4068 r4722  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4950    }
    5051
     52    [StorableConstructor]
     53    protected UniformOnePositionManipulator(bool deserializing) : base(deserializing) { }
     54    protected UniformOnePositionManipulator(UniformOnePositionManipulator original, Cloner cloner) : base(original, cloner) { }
    5155    /// <summary>
    5256    /// Initializes a new instance of <see cref="UniformOnePositionManipulator"/> with two parameters
    5357    /// (<c>Minimum</c> and <c>Maximum</c>).
    5458    /// </summary>
    55     public UniformOnePositionManipulator() {
     59    public UniformOnePositionManipulator()
     60      : base() {
    5661      Parameters.Add(new ValueLookupParameter<IntValue>("Minimum", "Minimum of the sampling range for the vector element (included)"));
    5762      Parameters.Add(new ValueLookupParameter<IntValue>("Maximum", "Maximum of the sampling range for the vector element (excluded)"));
     63    }
     64
     65    public override IDeepCloneable Clone(Cloner cloner) {
     66      return new UniformOnePositionManipulator(this, cloner);
    5867    }
    5968
Note: See TracChangeset for help on using the changeset viewer.