Changeset 4682
- Timestamp:
- 10/29/10 19:47:39 (14 years ago)
- Location:
- branches/CloningRefactoring
- Files:
-
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Analyzers/MinAverageMaxSymbolicExpressionTreeSizeAnalyzer.cs
r4674 r4682 67 67 [StorableConstructor] 68 68 private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(bool deserializing) : base() { } 69 pr otectedMinAverageMaxSymbolicExpressionTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionTreeSizeAnalyzer original, Cloner cloner)69 private MinAverageMaxSymbolicExpressionTreeSizeAnalyzer(MinAverageMaxSymbolicExpressionTreeSizeAnalyzer original, Cloner cloner) 70 70 : base(original, cloner) { 71 71 AfterDeserialization(); -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/ArchitectureManipulators/MultiSymbolicExpressionTreeArchitectureManipulator.cs
r4674 r4682 47 47 get { return false; } 48 48 } 49 pr ivateoverride bool CreateChildOperation {49 protected override bool CreateChildOperation { 50 50 get { return true; } 51 51 } … … 100 100 } 101 101 102 pr ivateoverride void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {102 protected override void Operators_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) { 103 103 base.Operators_ItemsReplaced(sender, e); 104 104 ParameterizeManipulators(); 105 105 } 106 106 107 pr ivateoverride void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) {107 protected override void Operators_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<ISymbolicExpressionTreeArchitectureManipulator>> e) { 108 108 base.Operators_ItemsAdded(sender, e); 109 109 ParameterizeManipulators(); -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Creators/ProbabilisticTreeCreator.cs
r4674 r4682 45 45 } 46 46 47 pr ivateoverride SymbolicExpressionTree Create(47 protected override SymbolicExpressionTree Create( 48 48 IRandom random, 49 49 ISymbolicExpressionGrammar grammar, -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/DefaultSymbolicExpressionGrammar.cs
r4674 r4682 165 165 } 166 166 167 public override IDeepCloneable Clone(Cloner cloner) {168 return new DefaultSymbolicExpressionGrammar(this, cloner);169 }170 171 167 public void Clear() { 172 168 minSubTreeCount.Clear(); -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/FullTreeShaker.cs
r4674 r4682 39 39 } 40 40 41 pr ivateoverride 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) { 42 42 foreach (var node in symbolicExpressionTree.IterateNodesPrefix()) { 43 43 if (node.HasLocalParameters) { -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Manipulators/ReplaceBranchManipulation.cs
r4674 r4682 43 43 } 44 44 45 pr ivateoverride 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) { 46 46 ReplaceRandomBranch(random, symbolicExpressionTree, grammar, maxTreeSize.Value, maxTreeHeight.Value, out success); 47 47 } -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/SymbolicExpressionTreeNode.cs
r4674 r4682 63 63 clonedSubTree.Parent = this; 64 64 } 65 } 66 public override IDeepCloneable Clone(Cloner cloner) { 67 return new SymbolicExpressionTreeNode(this, cloner); 65 68 } 66 69 … … 181 184 return Grammar.GetMaxSubtreeCount(Symbol); 182 185 } 183 184 public override IDeepCloneable Clone(Cloner cloner) {185 return new SymbolicExpressionTreeNode(this, cloner);186 }187 188 186 public override string ToString() { 189 187 return Symbol.Name; -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/ArgumentTreeNode.cs
r4674 r4682 37 37 [StorableConstructor] 38 38 private ArgumentTreeNode(bool deserializing) : base(deserializing) { } 39 pr otectedArgumentTreeNode(ArgumentTreeNode original, Cloner cloner) : base(original, cloner) { }39 private ArgumentTreeNode(ArgumentTreeNode original, Cloner cloner) : base(original, cloner) { } 40 40 public ArgumentTreeNode(Argument argSymbol) : base(argSymbol) { } 41 41 -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/DefunTreeNode.cs
r4674 r4682 40 40 [StorableConstructor] 41 41 private DefunTreeNode(bool deserializing) : base(deserializing) { } 42 pr otectedDefunTreeNode(DefunTreeNode original, Cloner cloner)42 private DefunTreeNode(DefunTreeNode original, Cloner cloner) 43 43 : base(original, cloner) { 44 44 functionName = original.functionName; -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/InvokeFunctionTreeNode.cs
r4674 r4682 37 37 [StorableConstructor] 38 38 private InvokeFunctionTreeNode(bool deserializing) : base(deserializing) { } 39 pr otectedInvokeFunctionTreeNode(InvokeFunctionTreeNode original, Cloner cloner) : base(original, cloner) { }39 private InvokeFunctionTreeNode(InvokeFunctionTreeNode original, Cloner cloner) : base(original, cloner) { } 40 40 public InvokeFunctionTreeNode(InvokeFunction invokeSymbol) : base(invokeSymbol) { } 41 41 -
branches/CloningRefactoring/HeuristicLab.Encodings.SymbolicExpressionTreeEncoding/3.3/Symbols/Symbol.cs
r4674 r4682 68 68 } 69 69 70 public override IDeepCloneable Clone(Cloner cloner) {71 return new Symbol(this, cloner);72 }73 74 70 #region events 75 71 public event EventHandler Changed; -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs
r4678 r4682 168 168 [StorableConstructor] 169 169 private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(bool deserializing) : base(deserializing) { } 170 pr otectedFixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { }170 private FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer(FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer original, Cloner cloner) : base(original, cloner) { } 171 171 public FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer() 172 172 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/SymbolicRegressionTournamentPruning.cs
r4678 r4682 180 180 [StorableConstructor] 181 181 private SymbolicRegressionTournamentPruning(bool deserializing) : base(deserializing) { } 182 pr otectedSymbolicRegressionTournamentPruning(SymbolicRegressionTournamentPruning original, Cloner cloner) : base(original, cloner) { }182 private SymbolicRegressionTournamentPruning(SymbolicRegressionTournamentPruning original, Cloner cloner) : base(original, cloner) { } 183 183 public SymbolicRegressionTournamentPruning() 184 184 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator.cs
r4678 r4682 54 54 #endregion 55 55 [StorableConstructor] 56 pr otectedMultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { }57 pr otectedMultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner)56 private MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(bool deserializing) : base(deserializing) { } 57 private MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator(MultiObjectiveSymbolicRegressionPearsonsRSquaredEvaluator original, Cloner cloner) 58 58 : base(original, cloner) { 59 59 } -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/SymbolicRegressionModel.cs
r4678 r4682 34 34 public sealed class SymbolicRegressionModel : NamedItem, IDataAnalysisModel { 35 35 [StorableConstructor] 36 pr otectedSymbolicRegressionModel(bool deserializing) : base(deserializing) { }37 pr otectedSymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner)36 private SymbolicRegressionModel(bool deserializing) : base(deserializing) { } 37 private SymbolicRegressionModel(SymbolicRegressionModel original, Cloner cloner) 38 38 : base(original, cloner) { 39 39 tree = (SymbolicExpressionTree)cloner.Clone(original.tree); -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/SimpleArithmeticExpressionInterpreter.cs
r4678 r4682 109 109 [StorableConstructor] 110 110 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) { } 112 112 113 113 public override IDeepCloneable Clone(Cloner cloner) { … … 295 295 296 296 // skips a whole branch 297 pr otectedvoid SkipBakedCode() {297 private void SkipBakedCode() { 298 298 int i = 1; 299 299 while (i > 0) { -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Constant.cs
r4678 r4682 78 78 #endregion 79 79 [StorableConstructor] 80 pr otectedConstant(bool deserializing) : base(deserializing) { }81 pr otectedConstant(Constant original, Cloner cloner)80 private Constant(bool deserializing) : base(deserializing) { } 81 private Constant(Constant original, Cloner cloner) 82 82 : base(original, cloner) { 83 83 minValue = original.minValue; -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/ConstantTreeNode.cs
r4678 r4682 42 42 private ConstantTreeNode(bool deserializing) : base(deserializing) { } 43 43 44 pr otectedConstantTreeNode(ConstantTreeNode original, Cloner cloner)44 private ConstantTreeNode(ConstantTreeNode original, Cloner cloner) 45 45 : base(original, cloner) { 46 46 constantValue = original.constantValue; -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/LaggedVariableTreeNode.cs
r4678 r4682 39 39 [StorableConstructor] 40 40 private LaggedVariableTreeNode(bool deserializing) : base(deserializing) { } 41 pr otectedLaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner)41 private LaggedVariableTreeNode(LaggedVariableTreeNode original, Cloner cloner) 42 42 : base(original, cloner) { 43 43 lag = original.lag; -
branches/CloningRefactoring/HeuristicLab.Problems.DataAnalysis/3.3/Symbolic/Symbols/Variable.cs
r4678 r4682 114 114 } 115 115 116 public override IDeepClon able Clone(Cloner clone) {116 public override IDeepCloneable Clone(Cloner cloner) { 117 117 return new Variable(this, cloner); 118 118 } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Grammar/FullFunctionalExpressionGrammar.cs
r4364 r4682 21 21 22 22 using System.Collections.Generic; 23 using System.Linq;23 using HeuristicLab.Common; 24 24 using HeuristicLab.Core; 25 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 33 33 [Storable] 34 34 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 } 35 41 36 42 public FullFunctionalExpressionGrammar() … … 75 81 var unaryFunctionSymbols = new List<Symbol>() { sin, cos, tan, log, exp, not }; 76 82 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 }; 78 84 79 85 foreach (var symb in allSymbols) -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Interpretation/TreeInterpreter.cs
r4117 r4682 22 22 using System; 23 23 using System.Collections.Generic; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 92 93 private Instruction[] code; 93 94 private int pc; 94 95 95 96 public override bool CanChangeName { 96 97 get { return false; } … … 100 101 } 101 102 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() { } 105 111 106 112 public void Prepare(SymbolicExpressionTree tree) { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeBinaryConverter.cs
r4089 r4682 20 20 #endregion 21 21 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;29 22 using System.IO; 30 23 using Google.ProtocolBuffers; 24 using HeuristicLab.Common; 25 using HeuristicLab.Core; 26 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 28 32 29 namespace HeuristicLab.Problems.ExternalEvaluation.GP { … … 34 31 [StorableClass] 35 32 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() { } 36 42 37 43 protected override void ConvertSymbolicExpressionTree(SymbolicExpressionTree tree, string name, SolutionMessage.Builder builder) { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeConverter.cs
r4089 r4682 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Linq; 25 using System.Text; 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Core; 27 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 33 31 public abstract class SymbolicExpressionTreeConverter : Item, IItemToSolutionMessageConverter { 34 32 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() { } 35 40 36 41 #region IItemToSolutionMessageConverter Members -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/SymbolicExpressionTreeStringConverter.cs
r4089 r4682 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 31 32 SymbolicExpressionTreeStringFormatter formatter; 32 33 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() { 34 45 formatter = new SymbolicExpressionTreeStringFormatter(); 35 46 formatter.Indent = false; -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Addition.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Addition", "Symbol that represents the + operator.")] 29 30 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 } 31 39 public Addition() 32 40 : base("+", "Symbol that represents the + operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/And.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("And", "Symbol that represents the boolean AND operator.")] 29 30 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 } 31 39 public And() 32 40 : base("&&", "Symbol that represents the boolean AND operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Average.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Average", "Symbol that represents the average (arithmetic mean) function.")] 29 30 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 } 31 39 public Average() 32 40 : base("avg", "Symbol that represents the average (arithmetic mean) function.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Constant.cs
r4089 r4682 78 78 } 79 79 #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 } 80 93 public Constant() 81 94 : base("Constant", "Represents a constant value.") { … … 89 102 return new ConstantTreeNode(this); 90 103 } 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 }100 104 } 101 105 } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/ConstantTreeNode.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 39 40 } 40 41 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); 47 49 } 48 50 … … 67 69 } 68 70 69 public override object Clone() {70 return new ConstantTreeNode(this);71 }72 73 71 public override string ToString() { 74 72 return ";" + constantValue.ToString("E4"); -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Cosine.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Cosine", "Symbol that represents the cosine function.")] 29 30 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 } 31 39 public Cosine() 32 40 : base("cos", "Symbol that represents the cosine function.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Division.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Division", "Symbol that represents the / operator.")] 29 30 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 } 31 39 public Division() 32 40 : base("/", "Symbol that represents the / operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Exponential.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Exponential", "Symbol that represents the exponential function.")] 29 30 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 } 31 39 public Exponential() 32 40 : base("exp", "Symbol that represents the exponential function.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/GreaterThan.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("GreaterThan", "Symbol that represents a greater than relation.")] 29 30 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 } 31 39 public GreaterThan() 32 40 : base(">", "Symbol that represents a greater than relation.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/IfThenElse.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("IfThenElse", "Symbol that represents a conditional operator.")] 29 30 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 } 31 39 public IfThenElse() 32 40 : base("if", "Symbol that represents a conditional operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/LessThan.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("LessThan", "Symbol that represents a less than relation.")] 29 30 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 } 31 39 public LessThan() 32 40 : base("<", "Symbol that represents a less than relation.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Logarithm.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Logarithm", "Symbol that represents the logarithm function.")] 29 30 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 } 31 39 public Logarithm() 32 40 : base("ln", "Symbol that represents the logarithm function.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Multiplication.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Multiplication", "Symbol that represents the * operator.")] 29 30 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 } 31 39 public Multiplication() 32 40 : base("*", "Symbol that represents the * operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Not.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Not", "Symbol that represents the boolean NOT operator.")] 29 30 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 } 31 39 public Not() 32 40 : base("!", "Symbol that represents the boolean NOT operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Or.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Or", "Symbol that represents the boolean OR operator.")] 29 30 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 } 31 39 public Or() 32 40 : base("||", "Symbol that represents the boolean OR operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Sine.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Sine", "Symbol that represents the sine function.")] 29 30 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 } 31 39 public Sine() 32 40 : base("sin", "Symbol that represents the sine function.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Subtraction.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Subtraction", "Symbol that represents the - operator.")] 29 30 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 } 31 39 public Subtraction() 32 40 : base("-", "Symbol that represents the - operator.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Tangent.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding.Symbols; … … 28 29 [Item("Tangent", "Symbol that represents the tangent trigonometric function.")] 29 30 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 } 31 39 public Tangent() 32 40 : base("tan", "Symbol that represents the tangent trigonometric function.") { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Variable.cs
r4089 r4682 91 91 } 92 92 #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 93 108 public Variable() 94 109 : base("Variable", "Represents a variable value.") { … … 103 118 return new VariableTreeNode(this); 104 119 } 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 }115 120 } 116 121 } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/VariableTreeNode.cs
r4089 r4682 20 20 #endregion 21 21 22 using HeuristicLab.Common; 22 23 using HeuristicLab.Core; 23 24 using HeuristicLab.Encodings.SymbolicExpressionTreeEncoding; … … 47 48 private VariableTreeNode() { } 48 49 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) { 52 54 weight = original.weight; 53 55 variableName = original.variableName; 56 } 57 public override IDeepCloneable Clone(Cloner cloner) { 58 return new VariableTreeNode(this, cloner); 54 59 } 55 60 … … 57 62 58 63 public override bool HasLocalParameters { 59 get { 60 return true; 61 } 64 get { return true; } 62 65 } 63 66 … … 77 80 } 78 81 79 80 public override object Clone() {81 return new VariableTreeNode(this);82 }83 84 82 public override string ToString() { 85 83 return ";" + variableName + ";" + weight.ToString("E4"); -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/BoolConverter.cs
r3881 r4682 22 22 using System; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 31 32 public class BoolConverter : Item, IItemToSolutionMessageConverter { 32 33 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() { } 33 41 34 42 #region IItemToSolutionMessageConverter Members 35 43 36 44 public Type[] ItemTypes { 37 45 get { return itemTypes; } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DateTimeValueConverter.cs
r4068 r4682 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 30 31 public class DateTimeValueConverter : Item, IItemToSolutionMessageConverter { 31 32 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() { } 32 40 33 41 #region IItemToSolutionMessageConverter Members -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/DoubleConverter.cs
r3881 r4682 22 22 using System; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 32 33 private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<double>), typeof(ValueTypeArray<double>), typeof(ValueTypeMatrix<double>) }; 33 34 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 34 43 #region IItemToSolutionMessageConverter Members 35 44 36 45 public Type[] ItemTypes { 37 46 get { return itemTypes; } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/IntegerConverter.cs
r3881 r4682 22 22 using System; 23 23 using System.Linq; 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; 25 26 using HeuristicLab.Data; … … 32 33 private static readonly Type[] itemTypes = new Type[] { typeof(ValueTypeValue<int>), typeof(ValueTypeArray<int>), typeof(ValueTypeMatrix<int>) }; 33 34 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 34 43 #region IItemToSolutionMessageConverter Members 35 44 36 45 public Type[] ItemTypes { 37 46 get { return itemTypes; } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/StringConverter.cs
r4068 r4682 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 30 31 public class StringConverter : Item, IItemToSolutionMessageConverter { 31 32 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() { } 32 41 33 42 #region IItemToSolutionMessageConverter Members -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Converters/TimeSpanValueConverter.cs
r4068 r4682 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 30 31 public class TimeSpanValueConverter : Item, IItemToSolutionMessageConverter { 31 32 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() { } 32 41 33 42 #region IItemToSolutionMessageConverter Members -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationChannel.cs
r4068 r4682 21 21 22 22 using Google.ProtocolBuffers; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 33 34 [StorableConstructor] 34 35 protected EvaluationChannel(bool deserializing) : base(deserializing) { } 36 protected EvaluationChannel(EvaluationChannel original, Cloner cloner) : base(original, cloner) { } 35 37 protected EvaluationChannel() 36 38 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationProcessChannel.cs
r3895 r4682 58 58 private EvaluationStreamChannel streamingChannel; 59 59 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 60 71 public EvaluationProcessChannel() : this(String.Empty, String.Empty) { } 61 72 public EvaluationProcessChannel(string executable, string arguments) … … 63 74 this.executable = executable; 64 75 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;72 76 } 73 77 … … 96 100 try { 97 101 streamingChannel.Send(message); 98 } catch { 102 } 103 catch { 99 104 Close(); 100 105 throw; … … 105 110 try { 106 111 return streamingChannel.Receive(builder); 107 } catch { 112 } 113 catch { 108 114 Close(); 109 115 throw; … … 121 127 process.WaitForExit(1000); 122 128 process.Close(); 123 } catch { } 129 } 130 catch { } 124 131 } 125 132 // for some reasons the event process_Exited does not fire -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationServiceClient.cs
r4068 r4682 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 44 45 } 45 46 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 } 46 54 public EvaluationServiceClient() 47 55 : base() { -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationStreamChannel.cs
r3872 r4682 23 23 using System.IO; 24 24 using Google.ProtocolBuffers; 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 26 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; … … 33 34 private Stream input; 34 35 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 } 35 43 36 44 public EvaluationStreamChannel() : base() { } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/Drivers/EvaluationTCPChannel.cs
r3895 r4682 58 58 private Socket socket; 59 59 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 60 71 public EvaluationTCPChannel() : this(String.Empty, 0) { } 61 72 public EvaluationTCPChannel(string ip, int port) … … 63 74 this.ipAddress = ip; 64 75 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;72 76 } 73 77 … … 87 91 byte[] buffer = EncodeDelimited(message); 88 92 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) { 93 99 socket = null; 94 100 Close(); … … 122 128 byte[] buffer = GetMessageBuffer(); 123 129 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) { 128 136 socket = null; 129 137 Close(); … … 164 172 socket.Disconnect(false); 165 173 socket.Close(); 166 } catch { } 174 } 175 catch { } 167 176 socket = null; 168 177 } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluationProblem.cs
r4419 r4682 124 124 [StorableConstructor] 125 125 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 } 126 138 public ExternalEvaluationProblem() 127 139 : base() { … … 141 153 } 142 154 143 public override IDeepCloneable Clone(Cloner cloner) {144 ExternalEvaluationProblem clone = (ExternalEvaluationProblem)base.Clone(cloner);145 clone.AttachEventHandlers();146 return clone;147 }148 149 155 #region Events 150 156 public event EventHandler SolutionCreatorChanged; … … 194 200 #endregion 195 201 196 #region Helpers 197 [StorableHook(HookType.AfterDeserialization)] 198 private void AfterDeserializationHook() { 199 AttachEventHandlers(); 200 } 201 202 #region Helper 202 203 private void AttachEventHandlers() { 203 204 SolutionCreatorParameter.ValueChanged += new EventHandler(SolutionCreatorParameter_ValueChanged); -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/ExternalEvaluator.cs
r3881 r4682 21 21 22 22 using System; 23 using HeuristicLab.Common; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.Data; … … 46 47 } 47 48 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 } 48 55 public ExternalEvaluator() 49 56 : base() { … … 64 71 try { 65 72 MessageBuilder.AddToMessage(value, name, protobufBuilder); 66 } catch (ArgumentException ex) { 73 } 74 catch (ArgumentException ex) { 67 75 throw new InvalidOperationException("ERROR in " + Name + ": Parameter " + name + " cannot be added to the message.", ex); 68 76 } -
branches/CloningRefactoring/HeuristicLab.Problems.ExternalEvaluation/3.3/SolutionMessageBuilder.cs
r4643 r4682 50 50 [StorableConstructor] 51 51 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 } 52 65 public SolutionMessageBuilder() 53 66 : base() { … … 63 76 64 77 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;72 78 } 73 79 … … 87 93 } 88 94 89 [StorableHook(HookType.AfterDeserialization)]90 95 private void AttachEventHandlers() { 91 96 // BackwardsCompatibility3.3 92 97 #region Backwards compatible code, remove with 3.4 93 98 #pragma warning disable 0612 94 99 if (converters != null) { 95 100 if (convertersList == null) convertersList = new CheckedItemList<IItemToSolutionMessageConverter>(); … … 99 104 converters = null; 100 105 } 101 106 #pragma warning restore 0612 102 107 #endregion 103 108 convertersList.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<IItemToSolutionMessageConverter>>(convertersList_Changed);
Note: See TracChangeset
for help on using the changeset viewer.