Package org.drools.core.util

Examples of org.drools.core.util.BinaryHeapQueue


    public AgendaGroupQueueImpl(final String name,
                                final InternalRuleBase ruleBase) {
        this.name = name;
        if (ruleBase.getConfiguration().isPhreakEnabled()) {
            this.priorityQueue = new BinaryHeapQueue(new PhreakConflictResolver());
        }
        if (ruleBase.getConfiguration().isSequential()) {
            this.priorityQueue = new BinaryHeapQueue(new SequentialConflictResolver());
        } else {
            this.priorityQueue = new BinaryHeapQueue(ruleBase.getConfiguration().getConflictResolver());
        }

        this.clearedForRecency = -1;
    }
View Full Code Here


    @Test
    public void testOptimised() {
        final Random random = new Random();
        final List items = new LinkedList();

        final Queue queue = new BinaryHeapQueue( NaturalComparator.INSTANCE,
                                                 100000 );

        for ( int i = 0; i < 100000; ++i ) {
            items.add( new LongQueueable( queue, random.nextLong() ) );
        }

        final long startEnqueue = System.currentTimeMillis();

        for ( final Iterator i = items.iterator(); i.hasNext(); ) {
            queue.enqueue( (Queueable) i.next() );
        }

        final long elapsedEnqueue = System.currentTimeMillis() - startEnqueue;

        final long startDequeue = System.currentTimeMillis();
View Full Code Here

    @Test
    public void testBasic() {
        final Random random = new Random();
        final List items = new LinkedList();

        final BinaryHeapQueue queue = new BinaryHeapQueue( NaturalComparator.INSTANCE,
                                                           100000 );

        for ( int i = 0; i < 100000; ++i ) {
            items.add( new LongQueueable( queue, random.nextLong() ) );
        }

        final long startEnqueue = System.currentTimeMillis();

        for ( final Iterator i = items.iterator(); i.hasNext(); ) {
            queue.enqueue( (Queueable) i.next() );
        }

        final long elapsedEnqueue = System.currentTimeMillis() - startEnqueue;

        final long startDequeue = System.currentTimeMillis();

        for ( final Iterator i = items.iterator(); i.hasNext(); ) {
            queue.enqueue( (Queueable) i.next() );
        }

        //        while (!queue.isEmpty()) {
        //            queue.pop();
        //        }
View Full Code Here

TOP

Related Classes of org.drools.core.util.BinaryHeapQueue

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.