Package org.rioproject.watch

Examples of org.rioproject.watch.Statistics


            1, 2, 3, 4, 5, 6, 7, 8,
            1, 2, 3, 4, 5, 6, 7, 8, 9,
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10
        });

        Statistics stat = new Statistics(v);

        while (stat.count() > 0) {
            int i = (int) (Math.random() * stat.count());
            stat.removeValue(i);
            v.remove(i);
            Assert.assertEquals(v, stat.getValues());
        }
        assertClean(stat);

        v = asList(new double[]{1, 2, 3, 4, 5});
        stat.setValues(v);
        stat.removeValue(-1);
        stat.removeValue(5);
        Assert.assertEquals(v, stat.getValues());
    }
View Full Code Here


            1, 2, 3, 4, 5, 6, 7,
            1, 2, 3, 4, 5, 6, 7, 8,
            1, 2, 3, 4, 5, 6, 7, 8, 9,
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10
        });
        Statistics stat = new Statistics(vOrg);

        stat.removeValues(new Double(3.5), new Double(3.6));
        Assert.assertEquals(vOrg, stat.getValues());

        stat.removeValues(new Double(3.6), new Double(3.5));
        Assert.assertEquals(vOrg, stat.getValues());

        stat.removeValues(new Double(100), new Double(-100));
        Assert.assertEquals(vOrg, stat.getValues());

        stat.removeValues(new Double(-100), new Double(100));
        Assert.assertEquals(new Vector(), stat.getValues());

        stat.setValues(vOrg);
        stat.removeValues(new Double(3), new Double(3));
        Assert.assertEquals(asList(new double[]{
            1, 2, 4, 5,
            1, 2, 4, 5, 6,
            1, 2, 4, 5, 6, 7,
            1, 2, 4, 5, 6, 7, 8,
            1, 2, 4, 5, 6, 7, 8, 9,
            1, 2, 4, 5, 6, 7, 8, 9, 10
        }), stat.getValues());

        stat.setValues(vOrg);
        stat.removeValues(new Double(3.5), new Double(4.5));
        Assert.assertEquals(asList(new double[]{
            1, 2, 3, 5,
            1, 2, 3, 5, 6,
            1, 2, 3, 5, 6, 7,
            1, 2, 3, 5, 6, 7, 8,
            1, 2, 3, 5, 6, 7, 8, 9,
            1, 2, 3, 5, 6, 7, 8, 9, 10
        }), stat.getValues());

        stat.setValues(vOrg);
        stat.removeValues(new Double(1.1), new Double(9));
        Assert.assertEquals(asList(new double[]{
            1,
            1,
            1,
            1,
            1,
            1, 10
        }), stat.getValues());

        try {
            stat.removeValues(null, (double) 0);
            Assert.fail("IllegalArgumentException expected but not thrown");
        } catch (IllegalArgumentException e) {
        }

        try {
            stat.removeValues((double) 0, null);
            Assert.fail("IllegalArgumentException expected but not thrown");
        } catch (IllegalArgumentException e) {
        }

        try {
            stat.removeValues(null, null);
            Assert.fail("IllegalArgumentException expected but not thrown");
        } catch (IllegalArgumentException e) {
        }
    }
View Full Code Here

            1, 2, 3, 4, 5, 6, 7,
            1, 2, 3, 4, 5, 6, 7, 8,
            1, 2, 3, 4, 5, 6, 7, 8, 9,
            1, 2, 3, 4, 5, 6, 7, 8, 9, 10
        });
        Statistics stat = new Statistics(vOrg);

        stat.removeValues(3.5, 3.6);
        Assert.assertEquals(vOrg, stat.getValues());

        stat.removeValues(3.6, 3.5);
        Assert.assertEquals(vOrg, stat.getValues());

        stat.removeValues(100, -100);
        Assert.assertEquals(vOrg, stat.getValues());

        stat.removeValues(-100, 100);
        Assert.assertEquals(new Vector(), stat.getValues());

        stat.setValues(vOrg);
        stat.removeValues(3, 3);
        Assert.assertEquals(asList(new double[]{
            1, 2, 4, 5,
            1, 2, 4, 5, 6,
            1, 2, 4, 5, 6, 7,
            1, 2, 4, 5, 6, 7, 8,
            1, 2, 4, 5, 6, 7, 8, 9,
            1, 2, 4, 5, 6, 7, 8, 9, 10
        }), stat.getValues());

        stat.setValues(vOrg);
        stat.removeValues(3.5, 4.5);
        Assert.assertEquals(asList(new double[]{
            1, 2, 3, 5,
            1, 2, 3, 5, 6,
            1, 2, 3, 5, 6, 7,
            1, 2, 3, 5, 6, 7, 8,
            1, 2, 3, 5, 6, 7, 8, 9,
            1, 2, 3, 5, 6, 7, 8, 9, 10
        }), stat.getValues());

        stat.setValues(vOrg);
        stat.removeValues(1.1, 9);
        Assert.assertEquals(asList(new double[]{
            1,
            1,
            1,
            1,
            1,
            1, 10
        }), stat.getValues());
    }
View Full Code Here

TOP

Related Classes of org.rioproject.watch.Statistics

Copyright © 2018 www.massapicom. 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.