Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
11/06/10 01:56:04 (14 years ago)
Author:
swagner
Message:

Merged cloning refactoring branch back into trunk (#922)

Location:
trunk/sources
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources

  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Addition.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/And.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Average.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Constant.cs

    r4089 r4722  
    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}
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/ConstantTreeNode.cs

    r4089 r4722  
    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");
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Cosine.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Division.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Exponential.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/GreaterThan.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/IfThenElse.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/LessThan.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Logarithm.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Multiplication.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Not.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Or.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Sine.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Subtraction.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Tangent.cs

    r4089 r4722  
    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.") {
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/Variable.cs

    r4089 r4722  
    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}
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.GP/3.3/Symbols/VariableTreeNode.cs

    r4089 r4722  
    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");
Note: See TracChangeset for help on using the changeset viewer.