Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
10/31/10 11:36:07 (14 years ago)
Author:
abeham
Message:

#922

  • Fixed most of the errors that surfaced in the test cases
  • Removed storable attribute from SymbolicExpressionTreeStringFormatter
  • Modified StorableConstructorTest that the StorableConstructor may also be public (such as in BoolValue)
Location:
branches/CloningRefactoring
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeStringFormatter.cs

    r4068 r4696  
    2424
    2525namespace HeuristicLab.Encodings.SymbolicExpressionTreeEncoding {
    26   [StorableClass]
     26 
    2727  public class SymbolicExpressionTreeStringFormatter {
    28     [Storable]
     28   
    2929    public bool Indent { get; set; }
    30 
     30   
    3131    public SymbolicExpressionTreeStringFormatter()
    3232      : base() {
  • branches/CloningRefactoring/HeuristicLab.Operators.Views.GraphVisualization/3.3/General/ConnectionInfo.cs

    r4673 r4696  
    2929  public class ConnectionInfo : DeepCloneable, IConnectionInfo {
    3030    [StorableConstructor]
    31     private ConnectionInfo(bool deserializing) : base() { }
    32     private ConnectionInfo(ConnectionInfo original, Cloner cloner)
     31    protected ConnectionInfo(bool deserializing) : base() { }
     32    protected ConnectionInfo(ConnectionInfo original, Cloner cloner)
    3333      : base(original, cloner) {
    3434      from = cloner.Clone(original.from);
  • branches/CloningRefactoring/HeuristicLab.Optimization/3.3/UserDefinedProblem.cs

    r4670 r4696  
    221221    [Item("EmptyUserDefinedProblemEvaluator", "A dummy evaluator that will throw an exception when executed.")]
    222222    [StorableClass]
    223     private class EmptyUserDefinedProblemEvaluator : ParameterizedNamedItem, ISingleObjectiveEvaluator {
     223    private sealed class EmptyUserDefinedProblemEvaluator : ParameterizedNamedItem, ISingleObjectiveEvaluator {
    224224
    225225      [StorableConstructor]
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Classification/3.3/Symbolic/Analyzer/ValidationBestSymbolicClassificationSolutionAnalyzer.cs

    r4678 r4696  
    182182
    183183    [StorableConstructor]
    184     private ValidationBestSymbolicClassificationSolutionAnalyzer(bool deserializing) : base(deserializing) { }
     184    protected ValidationBestSymbolicClassificationSolutionAnalyzer(bool deserializing) : base(deserializing) { }
    185185    protected ValidationBestSymbolicClassificationSolutionAnalyzer(ValidationBestSymbolicClassificationSolutionAnalyzer original, Cloner cloner)
    186186      : base(original, cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.TestFunctions/3.3/MoveEvaluators/RealVectorAdditiveMoveWrapper.cs

    r4688 r4696  
    2121
    2222using HeuristicLab.Encodings.RealVectorEncoding;
     23using HeuristicLab.Common;
    2324
    2425namespace HeuristicLab.Problems.TestFunctions {
     
    2627  /// This wrapper disguises as real vector for use in the evaluation functions.
    2728  /// </summary>
    28   internal class RealVectorAdditiveMoveWrapper : RealVector {
     29  internal sealed class RealVectorAdditiveMoveWrapper : RealVector {
    2930    private int dimension;
    3031    private double moveDistance;
    3132    private RealVector vector;
    3233
     34    private RealVectorAdditiveMoveWrapper(bool deserializing) : base(deserializing) { }
     35    private RealVectorAdditiveMoveWrapper(RealVectorAdditiveMoveWrapper original, Cloner cloner)
     36      : base(original, cloner) {
     37      this.dimension = original.dimension;
     38      this.moveDistance = original.moveDistance;
     39      this.vector = cloner.Clone(vector);
     40    }
    3341    public RealVectorAdditiveMoveWrapper() {
    3442      dimension = -1;
     
    4048      moveDistance = move.MoveDistance;
    4149      this.vector = vector;
     50    }
     51
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new RealVectorAdditiveMoveWrapper(this, cloner);
    4254    }
    4355
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/IntraRouteInversion/AlbaIntraRouteInversionMoveMaker.cs

    r4690 r4696  
    4646
    4747    [StorableConstructor]
    48     private AlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { }
    49     private AlbaIntraRouteInversionMoveMaker(AlbaIntraRouteInversionMoveMaker original, Cloner cloner)
    50       : base(original, cloner) {
    51     }
     48    protected AlbaIntraRouteInversionMoveMaker(bool deserializing) : base(deserializing) { }
     49    protected AlbaIntraRouteInversionMoveMaker(AlbaIntraRouteInversionMoveMaker original, Cloner cloner) : base(original, cloner) { }
    5250    public AlbaIntraRouteInversionMoveMaker()
    5351      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Alba/Moves/LambdaInterchange/AlbaLambdaInterchangeMoveMaker.cs

    r4690 r4696  
    4747
    4848    [StorableConstructor]
    49     private AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
     49    protected AlbaLambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
    5050    protected AlbaLambdaInterchangeMoveMaker(AlbaLambdaInterchangeMoveMaker original, Cloner cloner)
    5151      : base(original, cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Creators/MultiVRPSolutionCreator.cs

    r4687 r4696  
    7979
    8080    [StorableConstructor]
    81     private MultiVRPSolutionCreator(bool deserializing) : base(deserializing) { }
     81    protected MultiVRPSolutionCreator(bool deserializing) : base(deserializing) { }
    8282    protected MultiVRPSolutionCreator(MultiVRPSolutionCreator original, Cloner cloner) : base(original, cloner) { }
    8383    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Crossovers/MultiVRPSolutionCrossover.cs

    r4687 r4696  
    8383
    8484    [StorableConstructor]
    85     private MultiVRPSolutionCrossover(bool deserializing) : base(deserializing) { }
     85    protected MultiVRPSolutionCrossover(bool deserializing) : base(deserializing) { }
    8686    protected MultiVRPSolutionCrossover(MultiVRPSolutionCrossover original, Cloner cloner) : base(original, cloner) { }
    8787    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Manipulators/MultiVRPSolutionManipulator.cs

    r4687 r4696  
    7979
    8080    [StorableConstructor]
    81     private MultiVRPSolutionManipulator(bool deserializing) : base(deserializing) { }
     81    protected MultiVRPSolutionManipulator(bool deserializing) : base(deserializing) { }
    8282    protected MultiVRPSolutionManipulator(MultiVRPSolutionManipulator original, Cloner cloner) : base(original, cloner) { }
    8383    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveGenerator.cs

    r4687 r4696  
    9898
    9999    [StorableConstructor]
    100     private MultiVRPMoveGenerator(bool deserializing) : base(deserializing) { }
    101     private MultiVRPMoveGenerator(MultiVRPMoveGenerator original, Cloner cloner) : base(original, cloner) { }
     100    protected MultiVRPMoveGenerator(bool deserializing) : base(deserializing) { }
     101    protected MultiVRPMoveGenerator(MultiVRPMoveGenerator original, Cloner cloner) : base(original, cloner) { }
    102102    public override IDeepCloneable Clone(Cloner cloner) {
    103103      return new MultiVRPMoveGenerator(this, cloner);
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/General/Moves/MultiVRPMoveOperator/MultiVRPMoveMaker.cs

    r4687 r4696  
    8080
    8181    [StorableConstructor]
    82     private LambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
     82    protected LambdaInterchangeMoveMaker(bool deserializing) : base(deserializing) { }
    8383    protected LambdaInterchangeMoveMaker(LambdaInterchangeMoveMaker original, Cloner cloner) : base(original, cloner) { }
    8484    public override IDeepCloneable Clone(Cloner cloner) {
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Potvin/PotvinEncoding.cs

    r4691 r4696  
    3434    public List<int> Unrouted { get; set; }
    3535
    36     public PotvinEncoding()
    37       : base() {
    38       Unrouted = new List<int>();
    39     }
     36    [StorableConstructor]
     37    protected PotvinEncoding(bool deserializing) : base(deserializing) { }
    4038    protected PotvinEncoding(PotvinEncoding original, Cloner cloner)
    4139      : base(original, cloner) {
     
    4341      Unrouted = new List<int>(original.Unrouted);
    4442    }
     43    public PotvinEncoding()
     44      : base() {
     45      Unrouted = new List<int>();
     46    }
     47
    4548    public override IDeepCloneable Clone(Cloner cloner) {
    4649      return new PotvinEncoding(this, cloner);
    47     }
    48     [StorableConstructor]
    49     private PotvinEncoding(bool serializing)
    50       : base() {
    5150    }
    5251
  • branches/CloningRefactoring/HeuristicLab.Problems.VehicleRouting/3.3/Encodings/Zhu/ZhuEncoding.cs

    r4693 r4696  
    125125
    126126    [StorableConstructor]
    127     private ZhuEncoding(bool serializing)
    128       : base(serializing) {
    129     }
    130 
     127    protected ZhuEncoding(bool deserializing) : base(deserializing) { }
    131128    protected ZhuEncoding(ZhuEncoding original, Cloner cloner)
    132129      : base(original, cloner) {
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/GenderSpecificSelector.cs

    r4670 r4696  
    8181
    8282    [StorableConstructor]
    83     private GenderSpecificSelector(bool deserializing) : base(deserializing) { }
    84     [StorableHook(HookType.AfterDeserialization)]
    85     private void AfterDeserialization() {
    86       Initialize();
    87     }
    88 
     83    protected GenderSpecificSelector(bool deserializing) : base(deserializing) { }
    8984    protected GenderSpecificSelector(GenderSpecificSelector original, Cloner cloner)
    9085      : base(original, cloner) {
    9186      Initialize();
    92     }
    93     public override IDeepCloneable Clone(Cloner cloner) {
    94       return new GenderSpecificSelector(this, cloner);
    9587    }
    9688
     
    131123      #endregion
    132124
     125      Initialize();
     126    }
     127
     128    public override IDeepCloneable Clone(Cloner cloner) {
     129      return new GenderSpecificSelector(this, cloner);
     130    }
     131
     132    [StorableHook(HookType.AfterDeserialization)]
     133    private void AfterDeserialization() {
    133134      Initialize();
    134135    }
  • branches/CloningRefactoring/HeuristicLab.Selection/3.3/OffspringSelector.cs

    r4670 r4696  
    6363
    6464    [StorableConstructor]
    65     private OffspringSelector(bool deserializing) : base(deserializing) { }
    66     private OffspringSelector(OffspringSelector original, Cloner cloner)
    67       : base(original, cloner) {
    68     }
     65    protected OffspringSelector(bool deserializing) : base(deserializing) { }
     66    protected OffspringSelector(OffspringSelector original, Cloner cloner) : base(original, cloner) { }
    6967    public override IDeepCloneable Clone(Cloner cloner) {
    7068      return new OffspringSelector(this, cloner);
  • branches/CloningRefactoring/HeuristicLab/3.3/Tests/StorableConstructorTest.cs

    r4658 r4696  
    3131          if (storableType.IsSealed && !storableConstructor.IsPrivate)
    3232            errorMessage.Append(Environment.NewLine + storableType.ToString() + ": Storable constructor must be private in sealed classes.");
    33           else if (!storableType.IsSealed && !storableConstructor.IsFamily)
    34             errorMessage.Append(Environment.NewLine + storableType.ToString() + ": Storable constructor must be protected.");
     33          else if (!storableType.IsSealed && !(storableConstructor.IsFamily || storableConstructor.IsPublic))
     34            errorMessage.Append(Environment.NewLine + storableType.ToString() + ": Storable constructor must be protected (can be public in rare cases).");
    3535        }
    3636      }
Note: See TracChangeset for help on using the changeset viewer.