FileDocCategorySizeDatePackage
Intersect.javaAPI DocApache Ant 1.702180Wed Dec 13 06:16:18 GMT 2006org.apache.tools.ant.types.resources

Intersect

public class Intersect extends BaseResourceCollectionContainer
ResourceCollection representing the intersection of multiple nested ResourceCollections.
since
Ant 1.7

Fields Summary
Constructors Summary
Methods Summary
private java.util.ArrayListcollect(java.lang.Object o)

        ArrayList result = new ArrayList();
        for (Iterator i = ((ResourceCollection) o).iterator(); i.hasNext();) {
            result.add(i.next());
        }
        return result;
    
protected java.util.CollectiongetCollection()
Calculate the intersection of the nested ResourceCollections.

return
a Collection of Resources.

        List rcs = getResourceCollections();
        int size = rcs.size();
        if (size < 2) {
            throw new BuildException("The intersection of " + size
                + " resource collection" + ((size == 1) ? "" : "s")
                + " is undefined.");
        }
        ArrayList al = new ArrayList();
        Iterator rc = rcs.iterator();
        al.addAll(collect(rc.next()));
        while (rc.hasNext()) {
            al.retainAll(collect(rc.next()));
        }
        return al;