Package com.inadco.hbl.client.impl.scanner

Examples of com.inadco.hbl.client.impl.scanner.GroupingScanStrategy


        InputIterator<RawScanResult>[] inputs = new InputIterator[filteringScanners.size()];

        int i = 0;
        for (FilteringScanSpecScanner filteredScanner : filteringScanners) {

            GroupingScanStrategy gsc = new GroupingScanStrategy(filteredScanner.getScanSpec(), afr, false);
            final InputIterator<RawScanResult> groupingScanner =
                new GroupingIterator<RawScanResult, RawScanResult>(filteredScanner, gsc);
            closeables.addFirst(groupingScanner);
            inputs[i++] = groupingScanner;
        }
        filteringScanners = null;

        InputIterator<RawScanResult> mergingIter;

        if (inputs.length > 1) {

            /*
             * we have more than one input and have to decorate them with N-way
             * merge in order to proceed.
             */

            StatefulHeapSortMergeStrategy<RawScanResult> sortMergeStrategy =
                new StatefulHeapSortMergeStrategy<RawScanResult>(new RawScanResult.GroupComparator());
            mergingIter = new NWayMergingIterator<RawScanResult>(inputs, sortMergeStrategy, false);
            closeables.addFirst(mergingIter);
        } else {

            // no merging
            mergingIter = inputs[0];
        }

        /*
         * final grouping decoration -- we need to add this if we have merging
         * AND grouping is enabled. The following condition checks just for
         * that.
         */
        if (!(mergingIter instanceof GroupingIterator)) {

            // grouping enabled. Decorate with grouping iterator.
            GroupingScanStrategy gsc = new GroupingScanStrategy(spec, afr, true);
            delegate = new GroupingIterator<RawScanResult, RawScanResult>(mergingIter, gsc);
            closeables.addFirst(delegate);
        } else {
            // no grouping. no decoration.
            delegate = mergingIter;
View Full Code Here

TOP

Related Classes of com.inadco.hbl.client.impl.scanner.GroupingScanStrategy

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.