Example #1
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            assertCDFWithNull(DIST);
            assertPDFWithNull(DIST);
            assertEquals(K, DIST.K, 0);
            assertEquals(THETA, DIST.Theta, 0);
            GammaDistribution other = new GammaDistribution(K, THETA, ENGINE);

            assertEquals(DIST, other);
            assertEquals(DIST.GetHashCode(), other.GetHashCode());
            other = new GammaDistribution(K, THETA);
            assertEquals(DIST, other);
            assertEquals(DIST.GetHashCode(), other.GetHashCode());
            other = new GammaDistribution(K + 1, THETA);
            assertFalse(other.Equals(DIST));
            other = new GammaDistribution(K, THETA + 1);
            assertFalse(other.Equals(DIST));
        }
Example #2
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            GammaDistribution other = (GammaDistribution)obj;

            if (System.BitConverter.DoubleToInt64Bits(_k) != Double.doubleToLongBits(other._k))
            {
                return(false);
            }
            return(System.BitConverter.DoubleToInt64Bits(_theta) == Double.doubleToLongBits(other._theta));
        }