Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            GeneralizedExtremeValueDistribution other = (GeneralizedExtremeValueDistribution)obj;

            if (System.BitConverter.DoubleToInt64Bits(_ksi) != Double.doubleToLongBits(other._ksi))
            {
                return(false);
            }
            if (System.BitConverter.DoubleToInt64Bits(_mu) != Double.doubleToLongBits(other._mu))
            {
                return(false);
            }
            return(System.BitConverter.DoubleToInt64Bits(_sigma) == Double.doubleToLongBits(other._sigma));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testObject()
        public virtual void testObject()
        {
            assertEquals(MU, DIST.Mu, 0);
            assertEquals(SIGMA, DIST.Sigma, 0);
            assertEquals(KSI, DIST.Ksi, 0);
            GeneralizedExtremeValueDistribution other = new GeneralizedExtremeValueDistribution(MU, SIGMA, KSI);

            assertEquals(DIST, other);
            assertEquals(DIST.GetHashCode(), other.GetHashCode());
            other = new GeneralizedExtremeValueDistribution(MU + 1, SIGMA, KSI);
            assertFalse(other.Equals(DIST));
            other = new GeneralizedExtremeValueDistribution(MU, SIGMA + 1, KSI);
            assertFalse(other.Equals(DIST));
            other = new GeneralizedExtremeValueDistribution(MU, SIGMA, KSI + 1);
            assertFalse(other.Equals(DIST));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testSupport()
        public virtual void testSupport()
        {
            ProbabilityDistribution <double> dist = new GeneralizedExtremeValueDistribution(MU, SIGMA, KSI);
            double limit = MU - SIGMA / KSI;

            assertLimit(dist, limit - EPS);
            assertEquals(dist.getCDF(limit + EPS), 0, EPS);
            assertEquals(dist.getCDF(LARGE_X), 1, EPS);
            dist  = new GeneralizedExtremeValueDistribution(MU, SIGMA, -KSI);
            limit = MU + SIGMA / KSI;
            assertLimit(dist, limit + EPS);
            assertEquals(dist.getCDF(-LARGE_X), 0, EPS);
            assertEquals(dist.getCDF(limit - EPS), 1, EPS);
            dist = new GeneralizedExtremeValueDistribution(MU, SIGMA, 0);
            assertEquals(dist.getCDF(-LARGE_X), 0, EPS);
            assertEquals(dist.getCDF(LARGE_X), 1, EPS);
        }