- Timestamp:
- 03/28/11 17:22:36 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Parameters/3.3/ValueParameter.cs
r5445 r5843 21 21 22 22 using System; 23 using System.Reflection; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 43 44 protected ValueParameter(bool deserializing) : base(deserializing) { } 44 45 protected ValueParameter(ValueParameter<T> original, Cloner cloner) : base(original, cloner) { } 46 45 47 public ValueParameter() : base() { } 46 public ValueParameter(string name) : base(name) { }47 public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { }48 public ValueParameter(string name) : base(name) { base.Value = CreateDefaultValue(); } 49 public ValueParameter(string name, bool getsCollected) : base(name, getsCollected) { base.Value = CreateDefaultValue(); } 48 50 public ValueParameter(string name, T value) : base(name, value) { } 49 51 public ValueParameter(string name, T value, bool getsCollected) : base(name, value, getsCollected) { } 50 public ValueParameter(string name, string description) : base(name, description) { }51 public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { }52 public ValueParameter(string name, string description) : base(name, description) { base.Value = CreateDefaultValue(); } 53 public ValueParameter(string name, string description, bool getsCollected) : base(name, description, getsCollected) { base.Value = CreateDefaultValue(); } 52 54 public ValueParameter(string name, string description, T value) : base(name, description, value) { } 53 55 public ValueParameter(string name, string description, T value, bool getsCollected) : base(name, description, value, getsCollected) { } 56 57 protected T CreateDefaultValue() { 58 ConstructorInfo defaultConstructor = typeof(T).GetConstructor(Type.EmptyTypes); 59 if (defaultConstructor != null) 60 return (T)defaultConstructor.Invoke(new object[0]); 61 return null; 62 } 54 63 55 64 public override IDeepCloneable Clone(Cloner cloner) {
Note: See TracChangeset
for help on using the changeset viewer.