/// <summary> /// Determines whether the specified <see cref="DecisionRule"/> is equal to this instance. /// </summary> /// /// <param name="other">The <see cref="DecisionRule"/> to compare with this instance.</param> /// /// <returns> /// <c>true</c> if the specified <see cref="DecisionRule"/> /// is equal to this instance; otherwise, <c>false</c>. /// </returns> /// public bool Equals(DecisionRule other) { if ((object)other == null) { return(false); } return(this.Output == other.output && this.Antecedents.SetEquals(other.Antecedents)); }
/// <summary> /// Compares this instance to another <see cref="DecisionRule"/>. /// </summary> /// public int CompareTo(DecisionRule other) { int order = this.Output.CompareTo(other.Output); if (order == 0) { return(this.Antecedents.Count.CompareTo(other.Antecedents.Count)); } return(order); }
/// <summary> /// Gets whether this rule and another rule have /// the same antecedents but different outputs. /// </summary> /// /// <param name="rule"></param> /// /// <returns>True if the two rules are contradictory; /// false otherwise.</returns> /// public bool IsInconsistentWith(DecisionRule rule) { return(Antecedents.SetEquals(rule.Antecedents) && Output != rule.Output); }