Package edu.brown.mappings

Examples of edu.brown.mappings.RatioMapping.calculate()


    /**
     * testNoSamples
     */
    public void testNoSamples() {
        RatioMapping p = new RatioMapping();
        assertNull(p.calculate());
    }
   
    /**
     * testClear
     */
 
View Full Code Here


        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(i, i);
        } // FOR
        p.clear();
        assertEquals(0, p.size());
        assertNull(p.calculate());
    }
   
    /**
     * testSingleSample
     */
 
View Full Code Here

     * testSingleSample
     */
    public void testSingleSample() {
        RatioMapping p = new RatioMapping();
        p.addOccurrence(1, 1);
        Double result = p.calculate();
        assertNotNull(result);
        assertEquals(1.0d, roundToDecimals(result, 1));
    }
   
    /**
 
View Full Code Here

    public void testIntegers() {
        RatioMapping p = new RatioMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Integer.MAX_VALUE, Integer.MAX_VALUE);
        }
        assertEquals(1.0d, roundToDecimals(p.calculate(), 1));
       
        p.clear();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Integer.MIN_VALUE, Integer.MIN_VALUE);
        }
View Full Code Here

       
        p.clear();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Integer.MIN_VALUE, Integer.MIN_VALUE);
        }
        assertEquals(1.0d, roundToDecimals(p.calculate(), 1));
    }

    /**
     * testLongs
     */
 
View Full Code Here

    public void testLongs() {
        RatioMapping p = new RatioMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Long.MAX_VALUE, Long.MAX_VALUE);
        }
        assertEquals(1.0d, roundToDecimals(p.calculate(), 1));
       
        p.clear();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Long.MIN_VALUE, Long.MIN_VALUE);
        }
View Full Code Here

       
        p.clear();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Long.MIN_VALUE, Long.MIN_VALUE);
        }
        assertEquals(1.0d, roundToDecimals(p.calculate(), 1));
    }
   
    /**
     * testDoubles
     */
 
View Full Code Here

    public void testDoubles() {
        RatioMapping p = new RatioMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Double.MAX_VALUE, Double.MAX_VALUE);
        }
        assertEquals(1.0d, roundToDecimals(p.calculate(), 1));
       
        p.clear();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Double.MIN_VALUE, Double.MIN_VALUE);
        }
View Full Code Here

       
        p.clear();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(Double.MIN_VALUE, Double.MIN_VALUE);
        }
        assertEquals(1.0d, roundToDecimals(p.calculate(), 1));
    }

    /**
     * testRandomCorrelation
     */
 
View Full Code Here

    public void testRandomCorrelation() {
        RatioMapping p = new RatioMapping();
        for (int i = 0; i < num_samples; i++) {
            p.addOccurrence(i, (this.rand.nextDouble() - 0.5) * i);
        }
        assertTrue(Math.abs(p.calculate()) < 0.1);
    }

    /**
     * testHalf
     */
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.