/** * Learn whether this {@link ResourceCollection} is empty. * @return boolean */ default boolean isEmpty() { return size() == 0; } }
/** * Set the source resource. * @param a the resource to load as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { if (a.size() != 1) { throw new BuildException( "only single argument resource collections are supported"); } src = a.iterator().next(); }
/** * Set the source resource. * @param a the resource to load as a single element Resource collection. * @since Ant 1.7 */ public synchronized void addConfigured(ResourceCollection a) { if (src != null) { throw new BuildException("only a single source is supported"); } if (a.size() != 1) { throw new BuildException( "only single-element resource collections are supported"); } src = a.iterator().next(); }
/** * Fulfill the condition contract. * @return true if the specified ResourceCollection satisfies the set criteria. * @throws BuildException if an error occurs. */ @Override public boolean eval() { if (rc == null) { throw new BuildException(ONE_NESTED_MESSAGE); } if (count == null) { throw new BuildException(COUNT_REQUIRED); } return when.evaluate(Integer.valueOf(rc.size()).compareTo(count)); }
/** * Take all elements except for the last <code>count</code> elements. * @return a Collection of Resources. */ @Override protected Collection<Resource> getCollection() { int ct = getValidCount(); ResourceCollection nested = getResourceCollection(); if (ct > nested.size()) { return Collections.emptyList(); } return nested.stream().limit((long) nested.size() - ct) .collect(Collectors.toList()); }
/** * Set the source resource. * @param a the resource to pack as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { if (a.size() != 1) { throw new BuildException( "only single argument resource collections are supported as archives"); } setSrcResource(a.iterator().next()); }
/** * Set the source Archive resource. * @param a the archive as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { if (a.size() != 1) { throw new BuildException( "only single argument resource collections are supported as archives"); } setSrcResource(a.iterator().next()); }
/** * Set the source resource. * @param a the resource to pack as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { if (a.size() == 0) { throw new BuildException( "No resource selected, %s needs exactly one resource.", getTaskName()); } if (a.size() != 1) { throw new BuildException( "%s cannot handle multiple resources at once. (%d resources were selected.)", getTaskName(), a.size()); } setSrcResource(a.iterator().next()); }
/** * Set the source resource. * @param a the source resource collection. * @since Ant 1.7 */ public void addConfigured(ResourceCollection a) { if (a.size() != 1) { throw new BuildException( "only single argument resource collections are supported."); } setSrcResource(a.iterator().next()); }
/** * Efficient size implementation. * @return int size */ @Override public synchronized int size() { return Math.min(getResourceCollection().size(), getValidCount()); }
@Override public synchronized int size() { return Math.max(getResourceCollection().size() - getValidCount(), 0); }
@Override public synchronized int size() { return Math.max(getResourceCollection().size() - getValidCount(), 0); }
/** * Sets the archive that holds this as a single element Resource * collection. * @param a the archive as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { checkChildrenAllowed(); if (archive != null) { throw new BuildException( "you must not specify more than one archive"); } if (a.size() != 1) { throw new BuildException( "only single argument resource collections are supported as archives"); } archive = a.iterator().next(); }
/** * Sets the resource to wrap using a single-element collection. * @param a the resource to wrap as a single element Resource collection. */ public final void addConfigured(ResourceCollection a) { checkChildrenAllowed(); if (resource != null) { throw new BuildException( "you must not specify more than one resource"); } if (a.size() != 1) { throw new BuildException( "only single argument resource collections are supported"); } setChecked(false); resource = a.iterator().next(); }
/** * Set the source Archive file for the archivefileset. Prevents both * "dir" and "src" from being specified. * @param a the archive as a single element Resource collection. */ public void addConfigured(ResourceCollection a) { checkChildrenAllowed(); if (a.size() != 1) { throw new BuildException("only single argument resource collections" + " are supported as archives"); } setSrcResource(a.iterator().next()); }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. */ @Override public synchronized int size() { if (isReference()) { return getRef().size(); } validate(); return coll.size(); }
/** * Fulfill the ResourceCollection contract. * * @return number of elements as int. */ @Override public synchronized int size() { if (isReference()) { return getCheckedRef().size(); } return cache().size(); }
/** * Fulfill the ResourceCollection contract. * @return number of elements as int. */ @Override public synchronized int size() { if (isReference()) { return ((Path) getCheckedRef()).size(); } dieOnCircularReference(); return union == null ? 0 : assertFilesystemOnly(union).size(); }
/** * Fulfill the ResourceCollection contract. * @return size of the collection as int. * @since Ant 1.7 */ @Override public int size() { if (isReference()) { return ((ResourceCollection) (getRef(getProject()))).size(); } if (src == null) { return super.size(); } ArchiveScanner as = (ArchiveScanner) getDirectoryScanner(getProject()); return as.getIncludedFilesCount(); }