/// <summary> /// Compares Sufficient Statistics. /// </summary> /// <param name="stats">Sufficient Statistics.</param> /// <returns>Returns true if equal.</returns> public override bool Equals(SufficientStatistics stats) { if (stats == null) { return(false); } if (IsMissing() && stats.IsMissing()) { return(true); } StatisticsList other = stats.AsStatisticsList(); if (other._stats.Count != _stats.Count || GetHashCode() != other.GetHashCode()) { return(false); } for (int i = 0; i < _stats.Count; i++) { if (!_stats[i].Equals(other._stats[i])) { return(false); } } return(true); }
/// <summary> /// Compares Sufficient Statistics. /// </summary> /// <param name="stats">Sufficient Statistics.</param> /// <returns>Returns true if equal.</returns> public override bool Equals(SufficientStatistics stats) { if (stats == null) { return(false); } if (IsMissing() && stats.IsMissing()) { return(true); } StatisticsList other = stats.AsStatisticsList(); if (other.stats.Count != this.stats.Count || GetHashCode() != other.GetHashCode()) { return(false); } return(!this.stats.Where((t, i) => !t.Equals(other.stats[i])).Any()); }