Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4682


Ignore:
Timestamp:
10/29/10 19:47:39 (13 years ago)
Author:
mkommend
Message:

Refactored ExternalEvaluation.* and fixed some errors and warnings (ticket #922).

Location:
branches/CloningRefactoring
Files:
59 edited

Legend:

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

    r4674 r4682  
    6767    [StorableConstructor]
    6868    private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(bool deserializing) : base() { }
    69     protected MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionTreeSizeAnalyzer original, Cloner cloner)
     69    private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionTreeSizeAnalyzer original, Cloner cloner)
    7070      : base(original, cloner) {
    7171      AfterDeserialization();
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs

    r4674 r4682  
    4747      get { return false; }
    4848    }
    49     private override bool CreateChildOperation {
     49    protected override bool CreateChildOperation {
    5050      get { return true; }
    5151    }
     
    100100    }
    101101
    102     private override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {
     102    protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {
    103103      base.Operators_ItemsReplaced(sender, e);
    104104      ParameterizeManipulators();
    105105    }
    106106
    107     private override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {
     107    protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {
    108108      base.Operators_ItemsAdded(sender, e);
    109109      ParameterizeManipulators();
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs

    r4674 r4682  
    4545    }
    4646
    47     private override SymbolicExpressionTree Create(
     47    protected override SymbolicExpressionTree Create(
    4848      IRandom random,
    4949      ISymbolicExpressionGrammar grammar,
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs

    r4674 r4682  
    165165    }
    166166
    167     public override IDeepCloneable Clone(Cloner cloner) {
    168       return new DefaultSymbolicExpressionGrammar(this, cloner);
    169     }
    170 
    171167    public void Clear() {
    172168      minSubTreeCount.Clear();
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs

    r4674 r4682  
    3939    }
    4040
    41     private override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
     41    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
    4242      foreach (var node in symbolicExpressionTree.IterateNodesPrefix()) {
    4343        if (node.HasLocalParameters) {
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ReplaceBranchManipulation.cs

    r4674 r4682  
    4343    }
    4444
    45     private override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
     45    protected override void Manipulate(IRandom random, SymbolicExpressionTree symbolicExpressionTree, ISymbolicExpressionGrammar grammar, IntValue maxTreeSize, IntValue maxTreeHeight, out bool success) {
    4646      ReplaceRandomBranch(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, out success);
    4747    }
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs

    r4674 r4682  
    6363        clonedSubTree.Parent = this;
    6464      }
     65    }
     66    public override IDeepCloneable Clone(Cloner cloner) {
     67      return new SymbolicExpressionTreeNode(this, cloner);
    6568    }
    6669
     
    181184      return Grammar.GetMaxSubtreeCount(Symbol);
    182185    }
    183 
    184     public override IDeepCloneable Clone(Cloner cloner) {
    185       return new SymbolicExpressionTreeNode(this, cloner);
    186     }
    187 
    188186    public override string ToString() {
    189187      return Symbol.Name;
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs

    r4674 r4682  
    3737    [StorableConstructor]
    3838    private ArgumentTreeNode(bool deserializing) : base(deserializing) { }
    39     protected ArgumentTreeNode(ArgumentTreeNode original, Cloner cloner) : base(original, cloner) { }
     39    private ArgumentTreeNode(ArgumentTreeNode original, Cloner cloner) : base(original, cloner) { }
    4040    public ArgumentTreeNode(Argument argSymbol) : base(argSymbol) { }
    4141
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs

    r4674 r4682  
    4040    [StorableConstructor]
    4141    private DefunTreeNode(bool deserializing) : base(deserializing) { }
    42     protected DefunTreeNode(DefunTreeNode original, Cloner cloner)
     42    private DefunTreeNode(DefunTreeNode original, Cloner cloner)
    4343      : base(original, cloner) {
    4444      functionName = original.functionName;
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs

    r4674 r4682  
    3737    [StorableConstructor]
    3838    private InvokeFunctionTreeNode(bool deserializing) : base(deserializing) { }
    39     protected InvokeFunctionTreeNode(InvokeFunctionTreeNode original, Cloner cloner) : base(original, cloner) { }
     39    private InvokeFunctionTreeNode(InvokeFunctionTreeNode original, Cloner cloner) : base(original, cloner) { }
    4040    public InvokeFunctionTreeNode(InvokeFunction invokeSymbol) : base(invokeSymbol) { }
    4141
  • branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs

    r4674 r4682  
    6868    }
    6969
    70     public override IDeepCloneable Clone(Cloner cloner) {
    71       return new Symbol(this, cloner);
    72     }
    73 
    7470    #region events
    7571    public event EventHandler Changed;
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r4678 r4682  
    168168    [StorableConstructor]
    169169    private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { }
    170     protected FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
     170    private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }
    171171    public FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer()
    172172      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionTournamentPruning.cs

    r4678 r4682  
    180180    [StorableConstructor]
    181181    private SymbolicRegressionTournamentPruning(bool deserializing) : base(deserializing) { }
    182     protected SymbolicRegressionTournamentPruning(SymbolicRegressionTournamentPruning original, Cloner cloner) : base(original, cloner) { }
     182    private SymbolicRegressionTournamentPruning(SymbolicRegressionTournamentPruning original, Cloner cloner) : base(original, cloner) { }
    183183    public SymbolicRegressionTournamentPruning()
    184184      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator.cs

    r4678 r4682  
    5454    #endregion
    5555    [StorableConstructor]
    56     protected MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }
    57     protected MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)
     56    private MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }
     57    private MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)
    5858      : base(original, cloner) {
    5959    }
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs

    r4678 r4682  
    3434  public sealed class SymbolicRegressionModel : NamedItem, IDataAnalysisModel {
    3535    [StorableConstructor]
    36     protected SymbolicRegressionModel(bool deserializing) : base(deserializing) { }
    37     protected SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner)
     36    private SymbolicRegressionModel(bool deserializing) : base(deserializing) { }
     37    private SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner)
    3838      : base(original, cloner) {
    3939      tree = (SymbolicExpressionTree)cloner.Clone(original.tree);
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs

    r4678 r4682  
    109109    [StorableConstructor]
    110110    private SimpleArithmeticExpressionInterpreter(bool deserializing) : base(deserializing) { }
    111     private SimpleArithmeticExpressionInterpreter(SimpleArithmeticExpressionInterpreter original, Cloner cloner)      : base(original, cloner) {    }
     111    private SimpleArithmeticExpressionInterpreter(SimpleArithmeticExpressionInterpreter original, Cloner cloner) : base(original, cloner) { }
    112112
    113113    public override IDeepCloneable Clone(Cloner cloner) {
     
    295295
    296296    // skips a whole branch
    297     protected void SkipBakedCode() {
     297    private void SkipBakedCode() {
    298298      int i = 1;
    299299      while (i > 0) {
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs

    r4678 r4682  
    7878    #endregion
    7979    [StorableConstructor]
    80     protected Constant(bool deserializing) : base(deserializing) { }
    81     protected Constant(Constant original, Cloner cloner)
     80    private Constant(bool deserializing) : base(deserializing) { }
     81    private Constant(Constant original, Cloner cloner)
    8282      : base(original, cloner) {
    8383      minValue = original.minValue;
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs

    r4678 r4682  
    4242    private ConstantTreeNode(bool deserializing) : base(deserializing) { }
    4343
    44     protected ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
     44    private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
    4545      : base(original, cloner) {
    4646      constantValue = original.constantValue;
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs

    r4678 r4682  
    3939    [StorableConstructor]
    4040    private LaggedVariableTreeNode(bool deserializing) : base(deserializing) { }
    41     protected LaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner)
     41    private LaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner)
    4242      : base(original, cloner) {
    4343      lag = original.lag;
  • branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs

    r4678 r4682  
    114114    }
    115115
    116     public override IDeepClonable Clone(Cloner clone) {
     116    public override IDeepCloneable Clone(Cloner cloner) {
    117117      return new Variable(this, cloner);
    118118    }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Grammar/FullFunctionalExpressionGrammar.cs

    r4364 r4682  
    2121
    2222using System.Collections.Generic;
    23 using System.Linq;
     23using HeuristicLab.Common;
    2424using HeuristicLab.Core;
    2525using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3333    [Storable]
    3434    private HeuristicLab.Problems.ExternalEvaluation.GP.Variable variableSymbol;
     35    [StorableConstructor]
     36    protected FullFunctionalExpressionGrammar(bool deserializing) : base(deserializing) { }
     37    protected FullFunctionalExpressionGrammar(FullFunctionalExpressionGrammar original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new FullFunctionalExpressionGrammar(this, cloner);
     40    }
    3541
    3642    public FullFunctionalExpressionGrammar()
     
    7581      var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not };
    7682      var binaryFunctionSymbols = new List<Symbol>() { gt, lt };
    77       var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or};
     83      var functionSymbols = new List<Symbol>() { add, sub, mul, div, mean, and, or };
    7884
    7985      foreach (var symb in allSymbols)
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Interpretation/TreeInterpreter.cs

    r4117 r4682  
    2222using System;
    2323using System.Collections.Generic;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    9293    private Instruction[] code;
    9394    private int pc;
    94    
     95
    9596    public override bool CanChangeName {
    9697      get { return false; }
     
    100101    }
    101102
    102     public TreeInterpreter()
    103       : base() {
    104     }
     103
     104    [StorableConstructor]
     105    protected TreeInterpreter(bool deserializing) : base(deserializing) { }
     106    protected TreeInterpreter(TreeInterpreter original, Cloner cloner) : base(original, cloner) { }
     107    public override IDeepCloneable Clone(Cloner cloner) {
     108      return new TreeInterpreter(this, cloner);
     109    }
     110    public TreeInterpreter() : base() { }
    105111
    106112    public void Prepare(SymbolicExpressionTree tree) {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeBinaryConverter.cs

    r4089 r4682  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
    26 using HeuristicLab.Core;
    27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    28 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
    2922using System.IO;
    3023using Google.ProtocolBuffers;
     24using HeuristicLab.Common;
     25using HeuristicLab.Core;
     26using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     27using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3128
    3229namespace HeuristicLab.Problems.ExternalEvaluation.GP {
     
    3431  [StorableClass]
    3532  public class SymbolicExpressionTreeBinaryConverter : SymbolicExpressionTreeConverter {
     33    [StorableConstructor]
     34    protected SymbolicExpressionTreeBinaryConverter(bool deserializing) : base(deserializing) { }
     35    protected SymbolicExpressionTreeBinaryConverter(SymbolicExpressionTreeBinaryConverter original, Cloner cloner)
     36      : base(original, cloner) {
     37    }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new SymbolicExpressionTreeBinaryConverter(this, cloner);
     40    }
     41    public SymbolicExpressionTreeBinaryConverter() : base() { }
    3642
    3743    protected override void ConvertSymbolicExpressionTree(SymbolicExpressionTree tree, string name, SolutionMessage.Builder builder) {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeConverter.cs

    r4089 r4682  
    2121
    2222using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
     23using HeuristicLab.Common;
    2624using HeuristicLab.Core;
    2725using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3331  public abstract class SymbolicExpressionTreeConverter : Item, IItemToSolutionMessageConverter {
    3432    private static readonly Type[] itemTypes = new Type[] { typeof(SymbolicExpressionTree) };
     33
     34    [StorableConstructor]
     35    protected SymbolicExpressionTreeConverter(bool deserializing) : base(deserializing) { }
     36    protected SymbolicExpressionTreeConverter(SymbolicExpressionTreeConverter original, Cloner cloner)
     37      : base(original, cloner) {
     38    }
     39    public SymbolicExpressionTreeConverter() : base() { }
    3540
    3641    #region IItemToSolutionMessageConverter Members
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeStringConverter.cs

    r4089 r4682  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3132    SymbolicExpressionTreeStringFormatter formatter;
    3233
    33     public SymbolicExpressionTreeStringConverter() {
     34    [StorableConstructor]
     35    protected SymbolicExpressionTreeStringConverter(bool deserializing) : base(deserializing) { }
     36    protected SymbolicExpressionTreeStringConverter(SymbolicExpressionTreeStringConverter original, Cloner cloner)
     37      : base(original, cloner) {
     38    }
     39    public override IDeepCloneable Clone(Cloner cloner) {
     40      return new SymbolicExpressionTreeStringConverter(this, cloner);
     41    }
     42
     43    public SymbolicExpressionTreeStringConverter()
     44      : base() {
    3445      formatter = new SymbolicExpressionTreeStringFormatter();
    3546      formatter.Indent = false;
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Addition.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Addition", "Symbol that represents the + operator.")]
    2930  public sealed class Addition : Symbol {
    30 
     31    [StorableConstructor]
     32    private Addition(bool deserializing) : base(deserializing) { }
     33    private Addition(Addition original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Addition(this, cloner);
     38    }
    3139    public Addition()
    3240      : base("+", "Symbol that represents the + operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/And.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("And", "Symbol that represents the boolean AND operator.")]
    2930  public sealed class And : Symbol {
    30 
     31    [StorableConstructor]
     32    private And(bool deserializing) : base(deserializing) { }
     33    private And(And original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new And(this, cloner);
     38    }
    3139    public And()
    3240      : base("&&", "Symbol that represents the boolean AND operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Average.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Average", "Symbol that represents the average (arithmetic mean) function.")]
    2930  public sealed class Average : Symbol {
    30 
     31    [StorableConstructor]
     32    private Average(bool deserializing) : base(deserializing) { }
     33    private Average(Average original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Average(this, cloner);
     38    }
    3139    public Average()
    3240      : base("avg", "Symbol that represents the average (arithmetic mean) function.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Constant.cs

    r4089 r4682  
    7878    }
    7979    #endregion
     80
     81    [StorableConstructor]
     82    private Constant(bool deserializing) : base(deserializing) { }
     83    private Constant(Constant original, Cloner cloner)
     84      : base(original, cloner) {
     85      minValue = original.minValue;
     86      maxValue = original.maxValue;
     87      manipulatorNu = original.manipulatorNu;
     88      manipulatorSigma = original.manipulatorSigma;
     89    }
     90    public override IDeepCloneable Clone(Cloner cloner) {
     91      return new Constant(this, cloner);
     92    }
    8093    public Constant()
    8194      : base("Constant", "Represents a constant value.") {
     
    89102      return new ConstantTreeNode(this);
    90103    }
    91 
    92     public override IDeepCloneable Clone(Cloner cloner) {
    93       Constant clone = (Constant)base.Clone(cloner);
    94       clone.minValue = minValue;
    95       clone.maxValue = maxValue;
    96       clone.manipulatorNu = manipulatorNu;
    97       clone.manipulatorSigma = manipulatorSigma;
    98       return clone;
    99     }
    100104  }
    101105}
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/ConstantTreeNode.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    3940    }
    4041
    41     private ConstantTreeNode() : base() { }
    42 
    43     // copy constructor
    44     private ConstantTreeNode(ConstantTreeNode original)
    45       : base(original) {
    46       constantValue = original.constantValue;
     42    [StorableConstructor]
     43    private ConstantTreeNode(bool deserializing) : base(deserializing) { }
     44    private ConstantTreeNode(ConstantTreeNode original, Cloner cloner)
     45      : base(original, cloner) {
     46    }
     47    public override IDeepCloneable Clone(Cloner cloner) {
     48      return new ConstantTreeNode(this, cloner);
    4749    }
    4850
     
    6769    }
    6870
    69     public override object Clone() {
    70       return new ConstantTreeNode(this);
    71     }
    72 
    7371    public override string ToString() {
    7472      return ";" + constantValue.ToString("E4");
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Cosine.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Cosine", "Symbol that represents the cosine function.")]
    2930  public sealed class Cosine : Symbol {
    30 
     31    [StorableConstructor]
     32    private Cosine(bool deserializing) : base(deserializing) { }
     33    private Cosine(Cosine original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Cosine(this, cloner);
     38    }
    3139    public Cosine()
    3240      : base("cos", "Symbol that represents the cosine function.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Division.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Division", "Symbol that represents the / operator.")]
    2930  public sealed class Division : Symbol {
    30 
     31    [StorableConstructor]
     32    private Division(bool deserializing) : base(deserializing) { }
     33    private Division(Division original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Division(this, cloner);
     38    }
    3139    public Division()
    3240      : base("/", "Symbol that represents the / operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Exponential.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Exponential", "Symbol that represents the exponential function.")]
    2930  public sealed class Exponential : Symbol {
    30 
     31    [StorableConstructor]
     32    private Exponential(bool deserializing) : base(deserializing) { }
     33    private Exponential(Exponential original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Exponential(this, cloner);
     38    }
    3139    public Exponential()
    3240      : base("exp", "Symbol that represents the exponential function.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/GreaterThan.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("GreaterThan", "Symbol that represents a greater than relation.")]
    2930  public sealed class GreaterThan : Symbol {
    30 
     31    [StorableConstructor]
     32    private GreaterThan(bool deserializing) : base(deserializing) { }
     33    private GreaterThan(GreaterThan original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new GreaterThan(this, cloner);
     38    }
    3139    public GreaterThan()
    3240      : base(">", "Symbol that represents a greater than relation.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/IfThenElse.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("IfThenElse", "Symbol that represents a conditional operator.")]
    2930  public sealed class IfThenElse : Symbol {
    30 
     31    [StorableConstructor]
     32    private IfThenElse(bool deserializing) : base(deserializing) { }
     33    private IfThenElse(IfThenElse original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new IfThenElse(this, cloner);
     38    }
    3139    public IfThenElse()
    3240      : base("if", "Symbol that represents a conditional operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/LessThan.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("LessThan", "Symbol that represents a less than relation.")]
    2930  public sealed class LessThan : Symbol {
    30 
     31    [StorableConstructor]
     32    private LessThan(bool deserializing) : base(deserializing) { }
     33    private LessThan(LessThan original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new LessThan(this, cloner);
     38    }
    3139    public LessThan()
    3240      : base("<", "Symbol that represents a less than relation.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Logarithm.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Logarithm", "Symbol that represents the logarithm function.")]
    2930  public sealed class Logarithm : Symbol {
    30 
     31    [StorableConstructor]
     32    private Logarithm(bool deserializing) : base(deserializing) { }
     33    private Logarithm(Logarithm original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Logarithm(this, cloner);
     38    }
    3139    public Logarithm()
    3240      : base("ln", "Symbol that represents the logarithm function.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Multiplication.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Multiplication", "Symbol that represents the * operator.")]
    2930  public sealed class Multiplication : Symbol {
    30 
     31    [StorableConstructor]
     32    private Multiplication(bool deserializing) : base(deserializing) { }
     33    private Multiplication(Multiplication original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Multiplication(this, cloner);
     38    }
    3139    public Multiplication()
    3240      : base("*", "Symbol that represents the * operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Not.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Not", "Symbol that represents the boolean NOT operator.")]
    2930  public sealed class Not : Symbol {
    30 
     31    [StorableConstructor]
     32    private Not(bool deserializing) : base(deserializing) { }
     33    private Not(Not original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Not(this, cloner);
     38    }
    3139    public Not()
    3240      : base("!", "Symbol that represents the boolean NOT operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Or.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Or", "Symbol that represents the boolean OR operator.")]
    2930  public sealed class Or : Symbol {
    30 
     31    [StorableConstructor]
     32    private Or(bool deserializing) : base(deserializing) { }
     33    private Or(Or original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Or(this, cloner);
     38    }
    3139    public Or()
    3240      : base("||", "Symbol that represents the boolean OR operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Sine.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Sine", "Symbol that represents the sine function.")]
    2930  public sealed class Sine : Symbol {
    30 
     31      [StorableConstructor]
     32    private Sine(bool deserializing) : base(deserializing) { }
     33    private Sine(Sine original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Sine(this, cloner);
     38    }
    3139    public Sine()
    3240      : base("sin", "Symbol that represents the sine function.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Subtraction.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Subtraction", "Symbol that represents the - operator.")]
    2930  public sealed class Subtraction : Symbol {
    30 
     31    [StorableConstructor]
     32    private Subtraction(bool deserializing) : base(deserializing) { }
     33    private Subtraction(Subtraction original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Subtraction(this, cloner);
     38    }
    3139    public Subtraction()
    3240      : base("-", "Symbol that represents the - operator.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Tangent.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols;
     
    2829  [Item("Tangent", "Symbol that represents the tangent trigonometric function.")]
    2930  public sealed class Tangent : Symbol {
    30 
     31    [StorableConstructor]
     32    private Tangent(bool deserializing) : base(deserializing) { }
     33    private Tangent(Tangent original, Cloner cloner)
     34      : base(original, cloner) {
     35    }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new Tangent(this, cloner);
     38    }
    3139    public Tangent()
    3240      : base("tan", "Symbol that represents the tangent trigonometric function.") {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Variable.cs

    r4089 r4682  
    9191    }
    9292    #endregion
     93
     94    [StorableConstructor]
     95    private Variable(bool deserializing) : base(deserializing) { }
     96    private Variable(Variable original, Cloner cloner)
     97      : base(original, cloner) {
     98      weightNu = original.weightNu;
     99      weightSigma = original.weightSigma;
     100      variableNames = new List<string>(original.variableNames);
     101      weightManipulatorNu = original.weightManipulatorNu;
     102      weightManipulatorSigma = original.weightManipulatorSigma;
     103    }
     104    public override IDeepCloneable Clone(Cloner cloner) {
     105      return new Variable(this, cloner);
     106    }
     107
    93108    public Variable()
    94109      : base("Variable", "Represents a variable value.") {
     
    103118      return new VariableTreeNode(this);
    104119    }
    105 
    106     public override IDeepCloneable Clone(Cloner cloner) {
    107       Variable clone = (Variable)base.Clone(cloner);
    108       clone.weightNu = weightNu;
    109       clone.weightSigma = weightSigma;
    110       clone.variableNames = new List<string>(variableNames);
    111       clone.weightManipulatorNu = weightManipulatorNu;
    112       clone.weightManipulatorSigma = weightManipulatorSigma;
    113       return clone;
    114     }
    115120  }
    116121}
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/VariableTreeNode.cs

    r4089 r4682  
    2020#endregion
    2121
     22using HeuristicLab.Common;
    2223using HeuristicLab.Core;
    2324using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding;
     
    4748    private VariableTreeNode() { }
    4849
    49     // copy constructor
    50     private VariableTreeNode(VariableTreeNode original)
    51       : base(original) {
     50    [StorableConstructor]
     51    private VariableTreeNode(bool deserializing) : base(deserializing) { }
     52    private VariableTreeNode(VariableTreeNode original, Cloner cloner)
     53      : base(original, cloner) {
    5254      weight = original.weight;
    5355      variableName = original.variableName;
     56    }
     57    public override IDeepCloneable Clone(Cloner cloner) {
     58      return new VariableTreeNode(this, cloner);
    5459    }
    5560
     
    5762
    5863    public override bool HasLocalParameters {
    59       get {
    60         return true;
    61       }
     64      get { return true; }
    6265    }
    6366
     
    7780    }
    7881
    79 
    80     public override object Clone() {
    81       return new VariableTreeNode(this);
    82     }
    83 
    8482    public override string ToString() {
    8583      return ";" + variableName + ";" + weight.ToString("E4");
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/BoolConverter.cs

    r3881 r4682  
    2222using System;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3132  public class BoolConverter : Item, IItemToSolutionMessageConverter {
    3233    private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<bool>), typeof(ValueTypeArray<bool>), typeof(ValueTypeMatrix<bool>) };
     34    [StorableConstructor]
     35    protected BoolConverter(bool deserializing) : base(deserializing) { }
     36    protected BoolConverter(BoolConverter original, Cloner cloner) : base(original, cloner) { }
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new BoolConverter(this, cloner);
     39    }
     40    public BoolConverter() : base() { }
    3341
    3442    #region IItemToSolutionMessageConverter Members
    35    
     43
    3644    public Type[] ItemTypes {
    3745      get { return itemTypes; }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DateTimeValueConverter.cs

    r4068 r4682  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3031  public class DateTimeValueConverter : Item, IItemToSolutionMessageConverter {
    3132    private static readonly Type[] itemTypes = new Type[] { typeof(DateTimeValue) };
     33    [StorableConstructor]
     34    protected DateTimeValueConverter(bool deserializing) : base(deserializing) { }
     35    protected DateTimeValueConverter(DateTimeValueConverter original, Cloner cloner) : base(original, cloner) { }
     36    public override IDeepCloneable Clone(Cloner cloner) {
     37      return new DateTimeValueConverter(this, cloner);
     38    }
     39    public DateTimeValueConverter() : base() { }
    3240
    3341    #region IItemToSolutionMessageConverter Members
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DoubleConverter.cs

    r3881 r4682  
    2222using System;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3233    private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<double>), typeof(ValueTypeArray<double>), typeof(ValueTypeMatrix<double>) };
    3334
     35    [StorableConstructor]
     36    protected DoubleConverter(bool deserializing) : base(deserializing) { }
     37    protected DoubleConverter(DoubleConverter original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new DoubleConverter(this, cloner);
     40    }
     41    public DoubleConverter() : base() { }
     42
    3443    #region IItemToSolutionMessageConverter Members
    35    
     44
    3645    public Type[] ItemTypes {
    3746      get { return itemTypes; }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/IntegerConverter.cs

    r3881 r4682  
    2222using System;
    2323using System.Linq;
     24using HeuristicLab.Common;
    2425using HeuristicLab.Core;
    2526using HeuristicLab.Data;
     
    3233    private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<int>), typeof(ValueTypeArray<int>), typeof(ValueTypeMatrix<int>) };
    3334
     35    [StorableConstructor]
     36    protected IntegerConverter(bool deserializing) : base(deserializing) { }
     37    protected IntegerConverter(IntegerConverter original, Cloner cloner) : base(original, cloner) { }
     38    public override IDeepCloneable Clone(Cloner cloner) {
     39      return new IntegerConverter(this, cloner);
     40    }
     41    public IntegerConverter() : base() { }
     42
    3443    #region IItemToSolutionMessageConverter Members
    35    
     44
    3645    public Type[] ItemTypes {
    3746      get { return itemTypes; }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/StringConverter.cs

    r4068 r4682  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3031  public class StringConverter : Item, IItemToSolutionMessageConverter {
    3132    private static readonly Type[] itemTypes = new Type[] { typeof(StringValue), typeof(StringArray), typeof(StringMatrix), typeof(IStringConvertibleValue), typeof(IStringConvertibleArray), typeof(IStringConvertibleMatrix) };
     33
     34    [StorableConstructor]
     35    protected StringConverter(bool deserializing) : base(deserializing) { }
     36    protected StringConverter(StringConverter original, Cloner cloner) : base(original, cloner) { }
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new StringConverter(this, cloner);
     39    }
     40    public StringConverter() : base() { }
    3241
    3342    #region IItemToSolutionMessageConverter Members
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/TimeSpanValueConverter.cs

    r4068 r4682  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    3031  public class TimeSpanValueConverter : Item, IItemToSolutionMessageConverter {
    3132    private static readonly Type[] itemTypes = new Type[] { typeof(TimeSpanValue) };
     33
     34    [StorableConstructor]
     35    protected TimeSpanValueConverter(bool deserializing) : base(deserializing) { }
     36    protected TimeSpanValueConverter(TimeSpanValueConverter original, Cloner cloner) : base(original, cloner) { }
     37    public override IDeepCloneable Clone(Cloner cloner) {
     38      return new TimeSpanValueConverter(this, cloner);
     39    }
     40    public TimeSpanValueConverter() : base() { }
    3241
    3342    #region IItemToSolutionMessageConverter Members
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationChannel.cs

    r4068 r4682  
    2121
    2222using Google.ProtocolBuffers;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    [StorableConstructor]
    3435    protected EvaluationChannel(bool deserializing) : base(deserializing) { }
     36    protected EvaluationChannel(EvaluationChannel original, Cloner cloner) : base(original, cloner) { }
    3537    protected EvaluationChannel()
    3638      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationProcessChannel.cs

    r3895 r4682  
    5858    private EvaluationStreamChannel streamingChannel;
    5959
     60    [StorableConstructor]
     61    protected EvaluationProcessChannel(bool deserializing) : base(deserializing) { }
     62    protected EvaluationProcessChannel(EvaluationProcessChannel original, Cloner cloner)
     63      : base(original, cloner) {
     64      executable = original.executable;
     65      arguments = original.arguments;
     66    }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new EvaluationProcessChannel(this, cloner);
     69    }
     70
    6071    public EvaluationProcessChannel() : this(String.Empty, String.Empty) { }
    6172    public EvaluationProcessChannel(string executable, string arguments)
     
    6374      this.executable = executable;
    6475      this.arguments = arguments;
    65     }
    66 
    67     public override IDeepCloneable Clone(Cloner cloner) {
    68       EvaluationProcessChannel clone = (EvaluationProcessChannel)base.Clone(cloner);
    69       clone.executable = executable;
    70       clone.arguments = arguments;
    71       return clone;
    7276    }
    7377
     
    96100      try {
    97101        streamingChannel.Send(message);
    98       } catch {
     102      }
     103      catch {
    99104        Close();
    100105        throw;
     
    105110      try {
    106111        return streamingChannel.Receive(builder);
    107       } catch {
     112      }
     113      catch {
    108114        Close();
    109115        throw;
     
    121127              process.WaitForExit(1000);
    122128              process.Close();
    123             } catch { }
     129            }
     130            catch { }
    124131          }
    125132          // for some reasons the event process_Exited does not fire
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationServiceClient.cs

    r4068 r4682  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4445    }
    4546
     47
     48    [StorableConstructor]
     49    protected EvaluationServiceClient(bool deserializing) : base(deserializing) { }
     50    protected EvaluationServiceClient(EvaluationServiceClient original, Cloner cloner) : base(original, cloner) { }
     51    public override IDeepCloneable Clone(Cloner cloner) {
     52      return new EvaluationServiceClient(this, cloner);
     53    }
    4654    public EvaluationServiceClient()
    4755      : base() {
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationStreamChannel.cs

    r3872 r4682  
    2323using System.IO;
    2424using Google.ProtocolBuffers;
     25using HeuristicLab.Common;
    2526using HeuristicLab.Core;
    2627using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
     
    3334    private Stream input;
    3435    private Stream output;
     36
     37    [StorableConstructor]
     38    protected EvaluationStreamChannel(bool deserializing) : base(deserializing) { }
     39    protected EvaluationStreamChannel(EvaluationStreamChannel original, Cloner cloner) : base(original, cloner) { }
     40    public override IDeepCloneable Clone(Cloner cloner) {
     41      return new EvaluationStreamChannel(this, cloner);
     42    }
    3543
    3644    public EvaluationStreamChannel() : base() { }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationTCPChannel.cs

    r3895 r4682  
    5858    private Socket socket;
    5959
     60    [StorableConstructor]
     61    protected EvaluationTCPChannel(bool deserializing) : base(deserializing) { }
     62    protected EvaluationTCPChannel(EvaluationTCPChannel original, Cloner cloner)
     63      : base(original, cloner) {
     64      ipAddress = original.ipAddress;
     65      port = original.port;
     66    }
     67    public override IDeepCloneable Clone(Cloner cloner) {
     68      return new EvaluationTCPChannel(this, cloner);
     69    }
     70
    6071    public EvaluationTCPChannel() : this(String.Empty, 0) { }
    6172    public EvaluationTCPChannel(string ip, int port)
     
    6374      this.ipAddress = ip;
    6475      this.port = port;
    65     }
    66 
    67     public override IDeepCloneable Clone(Cloner cloner) {
    68       EvaluationTCPChannel clone = (EvaluationTCPChannel)base.Clone(cloner);
    69       clone.ipAddress = ipAddress;
    70       clone.port = port;
    71       return clone;
    7276    }
    7377
     
    8791        byte[] buffer = EncodeDelimited(message);
    8892        socket.Send(buffer);
    89       } catch (SocketException) {
    90         Close();
    91         throw;
    92       } catch (ObjectDisposedException) {
     93      }
     94      catch (SocketException) {
     95        Close();
     96        throw;
     97      }
     98      catch (ObjectDisposedException) {
    9399        socket = null;
    94100        Close();
     
    122128        byte[] buffer = GetMessageBuffer();
    123129        return builder.WeakMergeFrom(ByteString.CopyFrom(buffer)).WeakBuild();
    124       } catch (SocketException) {
    125         Close();
    126         throw;
    127       } catch (ObjectDisposedException) {
     130      }
     131      catch (SocketException) {
     132        Close();
     133        throw;
     134      }
     135      catch (ObjectDisposedException) {
    128136        socket = null;
    129137        Close();
     
    164172            socket.Disconnect(false);
    165173          socket.Close();
    166         } catch { }
     174        }
     175        catch { }
    167176        socket = null;
    168177      }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs

    r4419 r4682  
    124124    [StorableConstructor]
    125125    private ExternalEvaluationProblem(bool deserializing) : base(deserializing) { }
     126    [StorableHook(HookType.AfterDeserialization)]
     127    private void AfterDeserializationHook() {
     128      AttachEventHandlers();
     129    }
     130
     131    private ExternalEvaluationProblem(ExternalEvaluationProblem original, Cloner cloner)
     132      : base(original, cloner) {
     133      AttachEventHandlers();
     134    }
     135    public override IDeepCloneable Clone(Cloner cloner) {
     136      return new ExternalEvaluationProblem(this, cloner);
     137    }
    126138    public ExternalEvaluationProblem()
    127139      : base() {
     
    141153    }
    142154
    143     public override IDeepCloneable Clone(Cloner cloner) {
    144       ExternalEvaluationProblem clone = (ExternalEvaluationProblem)base.Clone(cloner);
    145       clone.AttachEventHandlers();
    146       return clone;
    147     }
    148 
    149155    #region Events
    150156    public event EventHandler SolutionCreatorChanged;
     
    194200    #endregion
    195201
    196     #region Helpers
    197     [StorableHook(HookType.AfterDeserialization)]
    198     private void AfterDeserializationHook() {
    199       AttachEventHandlers();
    200     }
    201 
     202    #region Helper
    202203    private void AttachEventHandlers() {
    203204      SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged);
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs

    r3881 r4682  
    2121
    2222using System;
     23using HeuristicLab.Common;
    2324using HeuristicLab.Core;
    2425using HeuristicLab.Data;
     
    4647    }
    4748
     49    [StorableConstructor]
     50    protected ExternalEvaluator(bool deserializing) : base(deserializing) { }
     51    protected ExternalEvaluator(ExternalEvaluator original, Cloner cloner) : base(original, cloner) { }
     52    public override IDeepCloneable Clone(Cloner cloner) {
     53      return new ExternalEvaluator(this, cloner);
     54    }
    4855    public ExternalEvaluator()
    4956      : base() {
     
    6471          try {
    6572            MessageBuilder.AddToMessage(value, name, protobufBuilder);
    66           } catch (ArgumentException ex) {
     73          }
     74          catch (ArgumentException ex) {
    6775            throw new InvalidOperationException("ERROR in " + Name + ": Parameter " + name + " cannot be added to the message.", ex);
    6876          }
  • branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilder.cs

    r4643 r4682  
    5050    [StorableConstructor]
    5151    protected SolutionMessageBuilder(bool deserializing) : base(deserializing) { }
     52    [StorableHook(HookType.AfterDeserialization)]
     53    private void AfterDeserialization() {
     54      AttachEventHandlers();
     55    }
     56
     57    protected SolutionMessageBuilder(SolutionMessageBuilder original, Cloner cloner)
     58      : base(original, cloner) {
     59      convertersList = cloner.Clone(original.convertersList);
     60      AttachEventHandlers();
     61    }
     62    public override IDeepCloneable Clone(Cloner cloner) {
     63      return new SolutionMessageBuilder(this, cloner);
     64    }
    5265    public SolutionMessageBuilder()
    5366      : base() {
     
    6376
    6477      AttachEventHandlers();
    65     }
    66 
    67     public override IDeepCloneable Clone(Cloner cloner) {
    68       SolutionMessageBuilder clone = (SolutionMessageBuilder)base.Clone(cloner);
    69       clone.convertersList = (CheckedItemList<IItemToSolutionMessageConverter>)cloner.Clone(convertersList);
    70       clone.AttachEventHandlers();
    71       return clone;
    7278    }
    7379
     
    8793    }
    8894
    89     [StorableHook(HookType.AfterDeserialization)]
    9095    private void AttachEventHandlers() {
    9196      // BackwardsCompatibility3.3
    9297      #region Backwards compatible code, remove with 3.4
    93       #pragma warning disable 0612
     98#pragma warning disable 0612
    9499      if (converters != null) {
    95100        if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>();
     
    99104        converters = null;
    100105      }
    101       #pragma warning restore 0612
     106#pragma warning restore 0612
    102107      #endregion
    103108      convertersList.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);
Note: See TracChangeset for help on using the changeset viewer.