Changeset 4718


Ignore:
Timestamp:
11/04/10 22:01:16 (9 years ago)
Author:
mkommend
Message:

Fixed some cloning bugs and removed unnecessary default ctors (ticket #922).

Location:
branches/CloningRefactoring
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Core/3.3/Constraints/Constraint.cs

    r4668 r4718  
    3535      constrainedValue = null;  //mkommend: intentionally set to null;
    3636
    37       IItem constraintDataItem = original.constraintData as IItem;
     37      IDeepCloneable constraintDataDeepCloneable = original.constraintData as IDeepCloneable;
    3838      ICloneable constraintDataCloneable = original.constraintData as ICloneable;
    39       if (constraintDataItem != null)
    40         constraintData = cloner.Clone(constraintDataItem);
     39      if (constraintDataDeepCloneable != null)
     40        constraintData = cloner.Clone(constraintDataDeepCloneable);
    4141      else if (constraintDataCloneable != null)
    4242        constraintData = constraintDataCloneable.Clone();
  • branches/CloningRefactoring/HeuristicLab.Core/3.3/Scope.cs

    r4713 r4718  
    6969        foreach (IScope child in SubScopes)
    7070          child.Parent = this;
    71         RegisterSubScopesEvents();
    7271      } else subScopes = new ScopeList();
     72      RegisterSubScopesEvents();
    7373    }
    7474    /// <summary>
  • branches/CloningRefactoring/HeuristicLab.Data/3.3/BoolValue.cs

    r4669 r4718  
    4040    public BoolValue() : base() { }
    4141    [StorableConstructor]
    42     public BoolValue(bool value) : base(value) { }
     42    public BoolValue(bool value)
     43      : base(value) {
     44      //mkommend: be aware that the base call refers to the storable ctor => the value is set explicitly in the ctor body
     45      //this should not affect the persistence because first the ctor is called and afterwards the values were set by reflection.
     46      this.value = value;
     47    }
    4348
    4449    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/CloningRefactoring/HeuristicLab.Encodings.PermutationEncoding/3.3/Moves/ThreeOpt/TranslocationMoveAbsoluteAttribute.cs

    r4667 r4718  
    4343      this.NewPosition = original.NewPosition;
    4444    }
    45     public TranslocationMoveAbsoluteAttribute() : this(null, -1, -1, -1) { }
    4645    public TranslocationMoveAbsoluteAttribute(int[] number, int oldPosition, int newPosition, double moveQuality)
    4746      : base(moveQuality) {
  • branches/CloningRefactoring/HeuristicLab.Operators.Views.GraphVisualization/3.3/OperatorGraphVisualization/OperatorShapeInfo.cs

    r4673 r4718  
    4242      lineWidth = original.lineWidth;
    4343      title = original.title;
    44       icon = (Bitmap)original.icon.Clone();
     44      if (original.icon != null) icon = (Bitmap)original.icon.Clone();
    4545
    4646      connectorNames = new List<string>(original.connectorNames);
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/RunCollectionConstraints/RunCollectionComparisonConstraint.cs

    r4665 r4718  
    3636    protected RunCollectionComparisonConstraint(RunCollectionComparisonConstraint original, Cloner cloner)
    3737      : base(original, cloner) {
    38       IDeepCloneable constraintDataDeepCloneable = original.ConstraintData as IDeepCloneable;
    39       ICloneable constraintDataCloneable = original.ConstraintData as ICloneable;
    40       if (constraintDataDeepCloneable != null)
    41         ConstraintData = (IStringConvertibleValue)cloner.Clone(constraintDataDeepCloneable);
    42       else if (constraintDataCloneable != null)
    43         ConstraintData = (IStringConvertibleValue)constraintDataCloneable.Clone();
    44       else
    45         ConstraintData = original.ConstraintData;
    46 
    47       ConstraintOperation = original.ConstraintOperation;
    48       ConstraintColumn = original.constraintColumn;
     38      constraintColumn = original.constraintColumn;
    4939    }
    5040    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/SymbolicClassificationSolution.cs

    r4678 r4718  
    7171    protected SymbolicClassificationSolution(bool deserializing) : base(deserializing) { }
    7272    protected SymbolicClassificationSolution(SymbolicClassificationSolution original, Cloner cloner) : base(original, cloner) { }
    73     private SymbolicClassificationSolution() : base() { }
    7473    public SymbolicClassificationSolution(ClassificationProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)
    7574      : base(problemData, model, lowerEstimationLimit, upperEstimationLimit) {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs

    r4682 r4718  
    3939      tree = (SymbolicExpressionTree)cloner.Clone(original.tree);
    4040      interpreter = (ISymbolicExpressionTreeInterpreter)cloner.Clone(original.interpreter);
    41       inputVariables = new List<string>(inputVariables);
     41      inputVariables = new List<string>(original.inputVariables);
    4242    }
    4343
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionSolution.cs

    r4678 r4718  
    6666      : base(original, cloner) {
    6767    }
    68     public SymbolicRegressionSolution() : base() { }
    6968    public SymbolicRegressionSolution(DataAnalysisProblemData problemData, SymbolicRegressionModel model, double lowerEstimationLimit, double upperEstimationLimit)
    7069      : base(problemData, lowerEstimationLimit, upperEstimationLimit) {
Note: See TracChangeset for help on using the changeset viewer.