using System; using System.Diagnostics; namespace BotSharp.Algorithm.Bayesian { /// /// Class ClassBase. /// [DebuggerDisplay("Class {Name}, base P = {Probability}")] public abstract class ClassBase : IClass { /// /// Gets the name. /// /// The name. public string Name { get; private set; } /// /// Gets the class' base probability. /// /// The probability. public double Probability { get; set; } /// /// Initializes a new instance of the class. /// /// The name. /// The probability. /// name /// /// probability;Class base probability must be greater than or equal to zero. /// or /// probability;Class base probability must be less than or equal to one. /// protected ClassBase(string name, double probability) { if (ReferenceEquals(name, null)) throw new ArgumentNullException("name"); if (probability < 0) throw new ArgumentOutOfRangeException("probability", "Class base probability must be greater than or equal to zero."); if (probability > 1) throw new ArgumentOutOfRangeException("probability", "Class base probability must be less than or equal to one."); Name = name; Probability = probability; } /// /// Indicates whether the current object is equal to another object of the same type. /// /// An object to compare with this object. /// true if the current object is equal to the parameter; otherwise, false. public abstract bool Equals(IClass other); } }