Java 类org.apache.commons.collections.iterators.IteratorChain 实例源码

项目:SparkSeq    文件:PileupElementTracker.java   
public Iterable<PE> unorderedIterable() {
    return new Iterable<PE>() {
        @Override
        public Iterator<PE> iterator() {
            return new Iterator<PE>() {
                final private IteratorChain chain = new IteratorChain();

                { // initialize the chain with the unordered iterators of the per sample pileups
                    for ( PileupElementTracker<PE> pet : pileup.values() ) {
                        chain.addIterator(pet.unorderedIterator());
                    }
                }
                @Override
                public boolean hasNext() { return chain.hasNext(); }
                @Override
                public PE next() { return (PE)chain.next(); }
                @Override
                public void remove() { throw new UnsupportedOperationException("Cannot remove"); }
            };
        }
    };
}
项目:sakai    文件:ContentCheckJob.java   
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    MessageDigest digest;
    try {
        digest = MessageDigest.getInstance(ALGORITHM);
    } catch (NoSuchAlgorithmException e) {
        throw new JobExecutionException("Can't get digest for "+ ALGORITHM);
    }
    String[] types = {
            ResourceType.TYPE_HTML, ResourceType.MIME_TYPE_TEXT, ResourceType.TYPE_UPLOAD
    };
    IteratorChain allFiles = new IteratorChain();
    for (String type : types) {
        Iterator<ContentResource> resourceIterator = new ContentHostingIterator<ContentResource>(type);
        allFiles.addIterator(resourceIterator);
    }
    // Now check all the files.
    ContentResourceChecker checker = new ContentResourceChecker(allFiles, digest);
    checker.check();
}
项目:sakai    文件:ContentCheckJob.java   
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    MessageDigest digest;
    try {
        digest = MessageDigest.getInstance(ALGORITHM);
    } catch (NoSuchAlgorithmException e) {
        throw new JobExecutionException("Can't get digest for "+ ALGORITHM);
    }
    String[] types = {
            ResourceType.TYPE_HTML, ResourceType.MIME_TYPE_TEXT, ResourceType.TYPE_UPLOAD
    };
    IteratorChain allFiles = new IteratorChain();
    for (String type : types) {
        Iterator<ContentResource> resourceIterator = new ContentHostingIterator<ContentResource>(type);
        allFiles.addIterator(resourceIterator);
    }
    // Now check all the files.
    ContentResourceChecker checker = new ContentResourceChecker(allFiles, digest);
    checker.check();
}
项目:feathers-sdk    文件:IteratorList.java   
public Iterator toIterator()
{
    switch (size())
    {
           case 0:     return Collections.emptyList().iterator();
        case 1:     return get(0);
        default:    return new IteratorChain(this);
    }
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 *
 */
public final Iterator<Initializer> getNonStagePropertyInitializerIterator()
{
    return new FilterIterator(new IteratorChain(root.getPropertyInitializerIterator(false),
            getTopLevelInitializerIterator()), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            if (object instanceof NamedInitializer)
                return (!StandardDefs.isStageProperty(((NamedInitializer)object).getName())) &&
                          (!((NamedInitializer)object).isDesignLayer());
            return true;
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
 *
 */
public final Iterator<Initializer> getStagePropertyInitializerIterator()
{
    return new FilterIterator(new IteratorChain(root.getPropertyInitializerIterator(false),
            getTopLevelInitializerIterator()), new Predicate()
    {
        public boolean evaluate(Object object)
        {
            if (object instanceof NamedInitializer)
                return StandardDefs.isStageProperty(((NamedInitializer)object).getName());
            return false;
        }
    });
}
项目:feathers-sdk    文件:MxmlDocument.java   
/**
    * a little trickiness here: we need to initialize both our superclass properties, and document variables that
    * have initializers
    */
public final Iterator<Initializer> getPropertyInitializerIterator()
   {
    return new IteratorChain(root.getPropertyInitializerIterator(false),
               getTopLevelInitializerIterator());
   }
项目:James    文件:ToRecipientFolder.java   
@Override
public void init() throws MessagingException {
    super.init();
    sieveMailet = new SieveMailet();
    sieveMailet.setUsersRepository(usersRepository);
    sieveMailet.setMailboxManager(mailboxManager);
    sieveMailet.setFileSystem(fileSystem);
    sieveMailet.init(new MailetConfig() {
        /*
         * @see org.apache.mailet.MailetConfig#getInitParameter(java.lang.String)
         */
        public String getInitParameter(String name) {
            if ("addDeliveryHeader".equals(name)) {
                return "Delivered-To";
            } else if ("resetReturnPath".equals(name)) {
                return "true";
            } else {
                return getMailetConfig().getInitParameter(name);
            }
        }
        /*
         * @see org.apache.mailet.MailetConfig#getInitParameterNames()
         */
        public Iterator<String> getInitParameterNames() {
            IteratorChain c = new IteratorChain();
            Collection<String> h = new ArrayList<String>();
            h.add("addDeliveryHeader");
            h.add("resetReturnPath");
            c.addIterator(getMailetConfig().getInitParameterNames());
            c.addIterator(h.iterator());
            return c;
        }
        /*
         * @see org.apache.mailet.MailetConfig#getMailetContext()
         */
        public MailetContext getMailetContext() {
            return getMailetConfig().getMailetContext();
        }
        /*
         * @see org.apache.mailet.MailetConfig#getMailetName()
         */
        public String getMailetName() {
            return getMailetConfig().getMailetName();
        }

    });
    // Override the default value of "quiet"
    sieveMailet.setQuiet(getInitParameter("quiet", true));
    sieveMailet.setFolder(getInitParameter("folder", "INBOX"));
}
项目:James    文件:LocalDelivery.java   
/**
 * @see org.apache.mailet.base.GenericMailet#init()
 */
public void init() throws MessagingException {

    super.init();

    recipientRewriteTable = new RecipientRewriteTable();
    recipientRewriteTable.setDomainList(domainList);
    recipientRewriteTable.setRecipientRewriteTable(rrt);
    recipientRewriteTable.init(getMailetConfig());

    sieveMailet = new SieveMailet();
    sieveMailet.setUsersRepository(usersRepository);
    sieveMailet.setMailboxManager(mailboxManager);
    sieveMailet.setFileSystem(fileSystem);
    sieveMailet.init(new MailetConfig() {
        /*
         * @see org.apache.mailet.MailetConfig#getInitParameter(java.lang.String)
         */
        public String getInitParameter(String name) {
            if ("addDeliveryHeader".equals(name)) {
                return "Delivered-To";
            } else if ("resetReturnPath".equals(name)) {
                return "true";
            } else {
                return getMailetConfig().getInitParameter(name);
            }
        }
        /*
         * @see org.apache.mailet.MailetConfig#getInitParameterNames()
         */
        public Iterator<String> getInitParameterNames() {
            IteratorChain c = new IteratorChain();
            Collection<String> h = new ArrayList<String>();
            h.add("addDeliveryHeader");
            h.add("resetReturnPath");
            c.addIterator(getMailetConfig().getInitParameterNames());
            c.addIterator(h.iterator());
            return c;
        }
        /*
         * @see org.apache.mailet.MailetConfig#getMailetContext()
         */
        public MailetContext getMailetContext() {
            return getMailetConfig().getMailetContext();
        }
        /*
         * @see org.apache.mailet.MailetConfig#getMailetName()
         */
        public String getMailetName() {
            return getMailetConfig().getMailetName();
        }

    });
    // Override the default value of "quiet"
    sieveMailet.setQuiet(getInitParameter("quiet", true));
    sieveMailet.setFolder("INBOX");

}
项目:playweb    文件:Iterators.java   
/**
 * Returns an iterator for the concatenation of <code>iterator1</code> and
 * <code>iterator2</code>.
 *
 * @param <T>
 * @param iterator1
 * @param iterator2
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Iterator<T> iteratorChain(Iterator<? extends T> iterator1, Iterator<? extends T> iterator2) {
    return new IteratorChain(iterator1, iterator2);
}
项目:playweb    文件:Iterators.java   
/**
 * Returns an iterator for the concatenation of all the given <code>iterators</code>.
 *
 * @param <T>
 * @param iterators
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Iterator<T> iteratorChain(Iterator<? extends T>[] iterators) {
    return new IteratorChain(iterators);
}
项目:playweb    文件:Iterators.java   
/**
 * Returns an iterator for the concatenation of all the given <code>iterators</code>.
 *
 * @param <T>
 * @param iterators
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> Iterator<T> iteratorChain(Collection<? extends T> iterators) {
    return new IteratorChain(iterators);
}