Package org.apache.commons.collections.iterators

Examples of org.apache.commons.collections.iterators.FilterIterator


        private final IteratorChain _itr = new IteratorChain();
        private final int _type;

        public EntryIterator(int type) {
            _type = type;
            _itr.addIterator(new FilterIterator(getView(pinnedMap), this));
            _itr.addIterator(getView(cacheMap));
            _itr.addIterator(getView(softMap));
        }
View Full Code Here


            throw new NullPointerException("Iterator must not be null");
        }
        if (predicate == null) {
            throw new NullPointerException("Predicate must not be null");
        }
        return new FilterIterator(iterator, predicate);
    }
View Full Code Here

     *
     * @param itemStates item state source iterator.
     * @return iterator over reference property states.
     */
    private Iterator filterReferenceProperties(Iterator itemStates) {
        return new FilterIterator(itemStates, new Predicate() {
            public boolean evaluate(Object object) {
                ItemState state = (ItemState) object;
                if (!state.isNode()) {
                    PropertyState prop = (PropertyState) state;
                    return prop.getType() == PropertyType.REFERENCE;
View Full Code Here

    private Iterable<PropertyState> filterReferenceProperties(
            final Iterable<ItemState> itemStates) {
        return new Iterable<PropertyState>() {
            @SuppressWarnings("unchecked")
            public Iterator<PropertyState> iterator() {
                return (Iterator<PropertyState>) new FilterIterator(
                        itemStates.iterator(), new Predicate() {
                    public boolean evaluate(Object object) {
                        ItemState state = (ItemState) object;
                        if (!state.isNode()) {
                            PropertyState prop = (PropertyState) state;
View Full Code Here

            };

            @SuppressWarnings("unchecked")
            public Iterator<ItemInfo> iterator() {
                return new IteratorChain(
                        new FilterIterator(itemInfos.iterator(), isRoot),
                        new FilterIterator(itemInfos.iterator(), NotPredicate.getInstance(isRoot)));
            }
        };

        assertTrue(session.getRootNode().getDepth() == 0);
        checkHierarchy();
View Full Code Here

            };

            @SuppressWarnings("unchecked")
            public Iterator<ItemInfo> iterator() {
                return new IteratorChain(
                        new FilterIterator(itemInfos.iterator(), isTarget),
                        new FilterIterator(itemInfos.iterator(), NotPredicate.getInstance(isTarget)));
            }
        };

        assertEquals(targetPath, session.getItem(targetPath).getPath());
        checkHierarchy();
View Full Code Here

                stale = true;

                NodeId id = getId();
                Path path = id.getPath();

                Iterator<ItemInfo> propertyIds = new TransformIterator(new FilterIterator(itemInfos.iterator(),
                        new Predicate() {
                            public boolean evaluate(Object object) {
                                return object instanceof PropertyInfo;
                            }
                        }),
View Full Code Here

        if (logger.isDebugEnabled())
          logger.debug("Expected bloom filter size : " + expectedBloomFilterSize);

        SSTableWriter writer;
        CompactionIterator ci = new CompactionIterator(cfs, sstables, gcBefore, major); // retain a handle so we can call close()
        Iterator<AbstractCompactedRow> nni = new FilterIterator(ci, PredicateUtils.notNullPredicate());
        executor.beginCompaction(cfs.columnFamily, ci);

        Map<DecoratedKey, Long> cachedKeys = new HashMap<DecoratedKey, Long>();

        try
        {
            if (!nni.hasNext())
            {
                // don't mark compacted in the finally block, since if there _is_ nondeleted data,
                // we need to sync it (via closeAndOpen) first, so there is no period during which
                // a crash could cause data loss.
                cfs.markCompacted(sstables);
                return 0;
            }

            writer = cfs.createCompactionWriter(expectedBloomFilterSize, compactionFileLocation);
            while (nni.hasNext())
            {
                AbstractCompactedRow row = nni.next();
                long position = writer.append(row);
                totalkeysWritten++;

                if (DatabaseDescriptor.getPreheatKeyCache())
                {
View Full Code Here

        CompactionIterator ci = new ValidationCompactionIterator(cfs);
        executor.beginCompaction(cfs.columnFamily, ci);
        try
        {
            Iterator<AbstractCompactedRow> nni = new FilterIterator(ci, PredicateUtils.notNullPredicate());

            // validate the CF as we iterate over it
            validator.prepare(cfs);
            while (nni.hasNext())
            {
                AbstractCompactedRow row = nni.next();
                validator.add(row);
            }
            validator.complete();
        }
        finally
View Full Code Here

    public final TripleCollection getData() {
        return data;
    }
    @SuppressWarnings("unchecked")
    public Iterator<PlainLiteral> getText(UriRef field) {
        return new FilterIterator(new TransformIterator(data.filter(uri, field, null), TRIPLE2OBJECT), PLAIN_LITERALS);
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.collections.iterators.FilterIterator

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.