@Override public boolean contains(File file) { for (FileCollection collection : getSourceCollections()) { if (collection.contains(file)) { return true; } } return false; }
@Override public boolean isEmpty() { for (FileCollection collection : getSourceCollections()) { if (!collection.isEmpty()) { return false; } } return true; }
@Override protected void addAsResourceCollection(Object builder, String nodeName) { for (FileCollection fileCollection : getSourceCollections()) { fileCollection.addToAntBuilder(builder, nodeName, AntType.ResourceCollection); } }
@Override protected Collection<DirectoryFileTree> getAsFileTrees() { List<DirectoryFileTree> fileTree = new ArrayList<DirectoryFileTree>(); for (FileCollection source : getSourceCollections()) { AbstractFileCollection collection = (AbstractFileCollection) source; fileTree.addAll(collection.getAsFileTrees()); } return fileTree; }
@Override public void registerWatchPoints(FileSystemSubset.Builder builder) { for (FileCollectionInternal files : getSourceCollections()) { files.registerWatchPoints(builder); } }
@Override public void visitRootElements(FileCollectionVisitor visitor) { for (FileCollectionInternal element : getSourceCollections()) { element.visitRootElements(visitor); } } }
public Set<File> getFiles() { // Gather each of the backing Sets first, so we can set the initial capacity of the LinkedHashSet List<Set<File>> fileSets = new LinkedList<Set<File>>(); int fileCount = 0; for (FileCollection collection : getSourceCollections()) { Set<File> files = collection.getFiles(); fileCount += files.size(); fileSets.add(files); } Set<File> allFiles = new LinkedHashSet<File>(fileCount); for (Set<File> fileSet : fileSets) { allFiles.addAll(fileSet); } return allFiles; }
protected Collection<? extends FileTreeInternal> getSourceCollections() { return Cast.uncheckedCast(super.getSourceCollections()); }
@Override public void visitContents(FileCollectionResolveContext context) { for (FileCollection collection : CompositeFileCollection.this.getSourceCollections()) { context.add(collection.filter(filterSpec)); } }