Changeset 890
- Timestamp:
- 12/03/08 07:14:04 (16 years ago)
- Location:
- branches/CloningRefactorBranch
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/CloningRefactorBranch/HeuristicLab.GP.Boolean/HeuristicLabGPBooleanPlugin.cs
r720 r890 25 25 using HeuristicLab.PluginInfrastructure; 26 26 27 namespace HeuristicLab.GP. SantaFe{27 namespace HeuristicLab.GP.Boolean { 28 28 [ClassInfo(Name = "HeuristicLab.GP.Boolean-1.0")] 29 29 [PluginFile(Filename = "HeuristicLab.GP.Boolean-1.0.dll", Filetype = PluginFileType.Assembly)] -
branches/CloningRefactorBranch/HeuristicLab.GP.StructureIdentification/Constant.cs
r656 r890 57 57 } 58 58 59 public Constant(Constant original) : this(original, new Dictionary<Guid, object>()) { } 60 private Constant(Constant original, IDictionary<Guid, object> clonedObjects) 61 : base(original, clonedObjects) { } 62 59 63 private void SetupInitialization() { 60 64 // initialization operator … … 90 94 AddVariable(new HeuristicLab.Core.Variable(MANIPULATION, combinedOp)); 91 95 } 96 97 public override object Clone(IDictionary<Guid, object> clonedObjects) { 98 return new Constant(this, clonedObjects); 99 } 92 100 } 93 101 } -
branches/CloningRefactorBranch/HeuristicLab.GP/BakedFunctionTree.cs
r767 r890 90 90 foreach(IFunctionTree subTree in tree.SubTrees) { 91 91 AddSubTree(new BakedFunctionTree(subTree)); 92 } 93 } 94 95 public BakedFunctionTree(BakedFunctionTree original) : this(original, new Dictionary<Guid, object>()) { } 96 protected BakedFunctionTree(BakedFunctionTree original, IDictionary<Guid, object> clonedObjects) 97 : base(original, clonedObjects) { 98 // in case the user (de)serialized the tree between evaluation and selection we have to flatten the tree again. 99 if (original.treesExpanded) original.FlattenTrees(); 100 if (original.variablesExpanded) original.FlattenVariables(); 101 foreach (LightWeightFunction f in original.linearRepresentation) { 102 this.linearRepresentation.Add(f.Clone()); 92 103 } 93 104 } … … 325 336 326 337 public override object Clone(IDictionary<Guid, object> clonedObjects) { 327 BakedFunctionTree clone = new BakedFunctionTree(); 328 // in case the user (de)serialized the tree between evaluation and selection we have to flatten the tree again. 329 if(treesExpanded) FlattenTrees(); 330 if(variablesExpanded) FlattenVariables(); 331 foreach(LightWeightFunction f in linearRepresentation) { 332 clone.linearRepresentation.Add(f.Clone()); 333 } 334 return clone; 338 return new BakedFunctionTree(this, clonedObjects); 335 339 } 336 340 … … 338 342 return new FunctionTreeView(this); 339 343 } 340 341 //public override string ToString() {342 // SymbolicExpressionExporter exporter = new SymbolicExpressionExporter();343 // exporter.Visit(this);344 // return exporter.GetStringRepresentation();345 //}346 344 } 347 345 } -
branches/CloningRefactorBranch/HeuristicLab.GP/FunctionBase.cs
r656 r890 40 40 private int minArity = -1; 41 41 private int maxArity = -1; 42 43 /// <summary> 44 /// Default constructor. 45 /// </summary> 46 protected FunctionBase() { } 47 48 protected FunctionBase(FunctionBase original, IDictionary<Guid, object> clonedObjects) 49 : base(original, clonedObjects) { 50 this.minArity = original.minArity; 51 this.maxArity = original.maxArity; 52 } 42 53 43 54 public virtual double Apply() { -
branches/CloningRefactorBranch/HeuristicLab.GP/GPOperatorLibrary.cs
r656 r890 28 28 29 29 namespace HeuristicLab.GP { 30 public class GPOperatorLibrary : ItemBase, IOperatorLibrary, IEditable 30 public class GPOperatorLibrary : ItemBase, IOperatorLibrary, IEditable { 31 31 // constants for variable names 32 32 internal const string MIN_TREE_HEIGHT = "MinTreeHeight"; … … 39 39 get { return group; } 40 40 } 41 public GPOperatorLibrary(GPOperatorLibrary original) : this(original, new Dictionary<Guid, object>()) { } 42 protected GPOperatorLibrary(GPOperatorLibrary original, IDictionary<Guid, object> clonedObjects) 43 : base(original, clonedObjects) { 44 this.group = (GPOperatorGroup)Auxiliary.Clone(original.group, clonedObjects); 45 } 46 41 47 #region IOperatorLibrary Members 42 48 … … 58 64 59 65 public override object Clone(IDictionary<Guid, object> clonedObjects) { 60 GPOperatorLibrary clone = (GPOperatorLibrary)base.Clone(clonedObjects); 61 clone.group = (GPOperatorGroup)group.Clone(clonedObjects); 62 return clone; 66 return new GPOperatorLibrary(this, clonedObjects); 63 67 } 64 68 … … 72 76 public override void Populate(System.Xml.XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 73 77 base.Populate(node, restoredObjects); 74 group = (GPOperatorGroup) 78 group = (GPOperatorGroup)PersistenceManager.Restore(node.SelectSingleNode("Group"), restoredObjects); 75 79 } 76 80 #endregion
Note: See TracChangeset
for help on using the changeset viewer.