public double MaxDiff(object thatd) { DistributionCursorArray <DistributionType, DomainType> that = thatd as DistributionCursorArray <DistributionType, DomainType>; if (that == null) { return(Double.PositiveInfinity); } if (!IsCompatibleWith(that)) { return(Double.PositiveInfinity); } double max = 0; IEnumerator <DistributionType> iter = that.GetEnumerator(); foreach (DistributionType d in this) { bool ok = iter.MoveNext(); Assert.IsTrue(ok); double diff = ((Diffable)d).MaxDiff(iter.Current); if (diff > max) { max = diff; } } return(max); }
public override bool Equals(object thatd) { DistributionCursorArray <DistributionType, DomainType> that = thatd as DistributionCursorArray <DistributionType, DomainType>; if (that == null) { return(false); } if (!IsCompatibleWith(that)) { return(false); } IEnumerator <DistributionType> iter = that.GetEnumerator(); foreach (DistributionType d in this) { bool ok = iter.MoveNext(); Assert.IsTrue(ok); if (!d.Equals(iter.Current)) { return(false); } } return(true); }