FileDocCategorySizeDatePackage
ResourceSelectorContainer.javaAPI DocApache Ant 1.703882Wed Dec 13 06:16:20 GMT 2006org.apache.tools.ant.types.resources.selectors

ResourceSelectorContainer

public class ResourceSelectorContainer extends org.apache.tools.ant.types.DataType
ResourceSelector container.
since
Ant 1.7

Fields Summary
private Vector
v
Constructors Summary
public ResourceSelectorContainer()
Default constructor.


           
      
    
public ResourceSelectorContainer(ResourceSelector[] r)
Construct a new ResourceSelectorContainer with the specified array of selectors.

param
r the ResourceSelector[] to add.

        for (int i = 0; i < r.length; i++) {
            add(r[i]);
        }
    
Methods Summary
public voidadd(ResourceSelector s)
Add a ResourceSelector to the container.

param
s the ResourceSelector to add.

        if (isReference()) {
            throw noChildrenAllowed();
        }
        if (s == null) {
            return;
        }
        v.add(s);
        setChecked(false);
    
protected voiddieOnCircularReference(java.util.Stack stk, org.apache.tools.ant.Project p)
Overrides the version from DataType to recurse on nested ResourceSelectors.

param
stk the Stack of references.
param
p the Project to resolve against.
throws
BuildException on error.

        if (isChecked()) {
            return;
        }
        if (isReference()) {
            super.dieOnCircularReference(stk, p);
        } else {
            for (Iterator i = v.iterator(); i.hasNext();) {
                Object o = i.next();
                if (o instanceof DataType) {
                    stk.push(o);
                    invokeCircularReferenceCheck((DataType) o, stk, p);
                }
            }
            setChecked(true);
        }
    
public java.util.IteratorgetSelectors()
Return an Iterator over the nested selectors.

return
Iterator of ResourceSelectors.

        if (isReference()) {
            return ((ResourceSelectorContainer) getCheckedRef()).getSelectors();
        }
        dieOnCircularReference();
        return Collections.unmodifiableList(v).iterator();
    
public booleanhasSelectors()
Learn whether this ResourceSelectorContainer has selectors.

return
boolean indicating whether selectors have been added to the container.

        if (isReference()) {
            return ((ResourceSelectorContainer) getCheckedRef()).hasSelectors();
        }
        dieOnCircularReference();
        return !v.isEmpty();
    
public intselectorCount()
Get the count of nested selectors.

return
the selector count as int.

        if (isReference()) {
            return ((ResourceSelectorContainer) getCheckedRef()).selectorCount();
        }
        dieOnCircularReference();
        return v.size();