Changeset 13001
- Timestamp:
- 10/14/15 17:46:45 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/Regression/ConstantRegressionModel.cs
r12509 r13001 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 24 using System.Linq; 24 25 using HeuristicLab.Common; 25 26 using HeuristicLab.Core; 27 using HeuristicLab.Data; 26 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 29 … … 29 31 [StorableClass] 30 32 [Item("Constant Regression Model", "A model that always returns the same constant value regardless of the presented input data.")] 31 public class ConstantRegressionModel : NamedItem, IRegressionModel {33 public class ConstantRegressionModel : NamedItem, IRegressionModel, IStringConvertibleValue { 32 34 [Storable] 33 pr otecteddouble constant;35 private double constant; 34 36 public double Constant { 35 37 get { return constant; } 38 // setter not implemented because manipulation of the constant is not allowed 36 39 } 37 40 … … 49 52 this.description = ItemDescription; 50 53 this.constant = constant; 54 this.ReadOnly = true; // changing a constant regression model is not supported 51 55 } 52 56 … … 58 62 return new ConstantRegressionSolution(this, new RegressionProblemData(problemData)); 59 63 } 64 65 public override string ToString() { 66 return string.Format("Constant: {0}", GetValue()); 67 } 68 69 #region IStringConvertibleValue 70 public bool ReadOnly { get; private set; } 71 public bool Validate(string value, out string errorMessage) { 72 throw new NotSupportedException(); // changing a constant regression model is not supported 73 } 74 75 public string GetValue() { 76 return string.Format("{0:E4}", constant); 77 } 78 79 public bool SetValue(string value) { 80 throw new NotSupportedException(); // changing a constant regression model is not supported 81 } 82 83 public event EventHandler ValueChanged; 84 #endregion 60 85 } 61 86 }
Note: See TracChangeset
for help on using the changeset viewer.