Package org.teiid.query.util

Examples of org.teiid.query.util.Permutation


        }
       
        double bestSubScore = Double.MAX_VALUE;
        Object[] bestSubOrder = null;
       
        Permutation perms = new Permutation(orderList.toArray());

        int exhaustive = regionCount;

        //after 16 sources this will be completely greedy. before that it will try to strike a compromise between the exhaustive
        //and non-exhaustive searches
        if (regionCount > EXHAUSTIVE_SEARCH_GROUPS) {
            exhaustive = Math.max(2, EXHAUSTIVE_SEARCH_GROUPS - (int)Math.ceil(Math.sqrt((regionCount - EXHAUSTIVE_SEARCH_GROUPS))));
        }
       
        Iterator permIter = perms.generate(exhaustive);
       
        while(permIter.hasNext()) {
            Object[] order = (Object[]) permIter.next();

            double score = region.scoreRegion(order, 0, metadata, capFinder, context);
View Full Code Here


        }   
    }

    public void testNull() {
        try {
            new Permutation(null);
            fail("Expected IllegalArgumentException"); //$NON-NLS-1$
        } catch(IllegalArgumentException e) {               
        }                   
    }
View Full Code Here

        } catch(IllegalArgumentException e) {               
        }                   
    }
   
    public void test1() {
        Permutation perm = new Permutation(exampleItems(0));
        Iterator iter = perm.generate();                       
        assertTrue("Should get no permutations for no items", ! iter.hasNext()); //$NON-NLS-1$
       
        try {
            iter.next();
            fail("Expected NoSuchElementException"); //$NON-NLS-1$
View Full Code Here

        } catch(NoSuchElementException e) {
        }
    }

    public void test2() {
        Permutation perm = new Permutation(exampleItems(2));
        Iterator iter = perm.generate(0);                       
        assertTrue("Should get no permutations for no items", ! iter.hasNext()); //$NON-NLS-1$
    }
View Full Code Here

        Iterator iter = perm.generate(0);                       
        assertTrue("Should get no permutations for no items", ! iter.hasNext()); //$NON-NLS-1$
    }

    public void test3() {
        Permutation perm = new Permutation(exampleItems(1));
        Iterator iter = perm.generate();
       
        List orders = new ArrayList();
        while(iter.hasNext()) {
            orders.add(iter.next());   
        }
View Full Code Here

        assertEquals("Should get one permutations for one item", 1, orders.size()); //$NON-NLS-1$
        compareArrays(exampleItems(1), (Object[]) orders.get(0));
    }
   
    public void test4() {
        Permutation perm = new Permutation(exampleItems(2));
        Iterator iter = perm.generate();
       
        List orders = new ArrayList();
        while(iter.hasNext()) {
            orders.add(iter.next());   
        }
View Full Code Here

        compareOrders(expected, orders);
       
    }

    public void test5() {
        Permutation perm = new Permutation(exampleItems(3));
        Iterator iter = perm.generate();
       
        List orders = new ArrayList();
        while(iter.hasNext()) {
            orders.add(iter.next());   
        }
View Full Code Here

        compareOrders(expected, orders);
       
    }

    public void test6() {
        Permutation perm = new Permutation(exampleItems(3));
        Iterator iter = perm.generate(1);
       
        List orders = new ArrayList();
        while(iter.hasNext()) {
            orders.add(iter.next());   
        }
View Full Code Here

TOP

Related Classes of org.teiid.query.util.Permutation

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.