Package net.jcores.jre.cores

Examples of net.jcores.jre.cores.CoreNumber


                if(revisionOnline.contains("UNDEFINED")) {
                    System.out.println(">>> Latest online version unknown. Probably you are not on the internet.");
                    return;
                }

                final CoreNumber n = $(revisionOffline, revisionOnline).number(Long.class).as(CoreNumber.class);
                final long diff = n.get(0).longValue() - n.get(1).longValue();
               
                if(diff == 0) {
                    System.out.println(">>> Your version is up to date.");
                }
               
View Full Code Here


    /**
     * @param args
     */
    @SuppressWarnings("boxing")
    public static void main(String[] args) {
        CoreNumber number = $(2.0, 4, 6, null, 8, 100);

        System.out.println(number.average());
        System.out.println(number.variance());
       
        System.out.println($.range(1, 50000).random(10).as(CoreNumber.class).standarddeviation());
        System.out.println($.range(1, 50).random(6).string().join(" "));
        System.out.println($.range(1, 50).random(1.0).string().join(" "));

View Full Code Here

    public void testCollectionsParallization() {
        // Repeat the last test a number of times
        for (int c = 0; c < 100; c++) {
            final List<String> linked = new LinkedList<String>(Arrays.asList(Data.sn));
            final CoreObject<String> x = $(linked);
            final CoreNumber as = x.map(new F1<String, Integer>() {
                @Override
                public Integer f(String xx) {
                    return $(xx).I(0);
                }
            }).as(CoreNumber.class);

            Assert.assertEquals(Data.sn.length, as.size());
            Assert.assertEquals(Data.sn.length, as.compact().size());

            final long i = Data.sn.length - 1;
            Assert.assertEquals(i * (i + 1) / 2, (long) as.sum());
        }
    }
View Full Code Here

     *
     * @param object The numbers to wrap.
     * @return A CoreNumber wrapping the given compounds.
     */
    public static CoreNumber $(double[] object) {
        return new CoreNumber($, $.box(object));
    }
View Full Code Here

     *
     * @param object The numbers to wrap.
     * @return A CoreNumber wrapping the given compounds.
     */
    public static CoreNumber $(float[] object) {
        return new CoreNumber($, $.box(object));
    }
View Full Code Here

            for (int i = from; i > end; i += stepping) {
                rval[ptr++] = i;
            }
        }

        return new CoreNumber(this, box(rval));
    }
View Full Code Here

     *
     * @param object The numbers to wrap.
     * @return A CoreNumber wrapping the given compounds.
     */
    public static CoreNumber $(Number... object) {
        return new CoreNumber($, object);
    }
View Full Code Here

     *
     * @param object The numbers to wrap.
     * @return A CoreNumber wrapping the given compounds.
     */
    public static CoreNumber $(int[] object) {
        return new CoreNumber($, $.box(object));
    }
View Full Code Here

    /** */
    @SuppressWarnings({ "boxing", "unchecked" })
    @Test
    public void testNullNaN() {
        final CoreObject<Object> mixed = $($.create(1, 100), $.create(null, 100), $.create(Double.NaN, 100)).expand(Object.class);
        final CoreNumber number = mixed.random(1.0).as(CoreNumber.class);
       
        Assert.assertEquals(100, number.sum(), 0.01);
        Assert.assertEquals(1, number.average(), 0.01);
    }
View Full Code Here

TOP

Related Classes of net.jcores.jre.cores.CoreNumber

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.