コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }