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

AbstractSelectorContainer

public abstract class AbstractSelectorContainer extends org.apache.tools.ant.types.DataType implements SelectorContainer
This is the a base class a container of selectors - it does not need do be a selector itself.
since
1.7

Fields Summary
private Vector
selectorsList
Constructors Summary
Methods Summary
public voidadd(FileSelector selector)
add an arbitary selector

param
selector the selector to add
since
Ant 1.6

        appendSelector(selector);
    
public voidaddAnd(AndSelector selector)
add an "And" selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddContains(ContainsSelector selector)
add a contains selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddContainsRegexp(ContainsRegexpSelector selector)
add a regular expression selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddCustom(ExtendSelector selector)
add an extended selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddDate(DateSelector selector)
add a selector date entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddDepend(DependSelector selector)
add a depends selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddDepth(DepthSelector selector)
add a depth selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddDifferent(DifferentSelector selector)
adds a different selector to the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddFilename(FilenameSelector selector)
add a selector filename entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddMajority(MajoritySelector selector)
add a majority selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddModified(org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector selector)
add the modified selector

param
selector the selector to add
since
ant 1.6

        appendSelector(selector);
    
public voidaddNone(NoneSelector selector)
add a "None" selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddNot(NotSelector selector)
add a "Not" selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddOr(OrSelector selector)
add an "Or" selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddPresent(PresentSelector selector)
add a present selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddSelector(SelectSelector selector)
add a "Select" selector entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddSize(SizeSelector selector)
add a selector size entry on the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidaddType(TypeSelector selector)
adds a type selector to the selector list

param
selector the selector to add

        appendSelector(selector);
    
public voidappendSelector(FileSelector selector)
Add a new selector into this container.

param
selector the new selector to add

        selectorsList.addElement(selector);
    
public FileSelector[]getSelectors(org.apache.tools.ant.Project p)
Returns the set of selectors as an array.

param
p the current project
return
an array of selectors

        FileSelector[] result = new FileSelector[selectorsList.size()];
        selectorsList.copyInto(result);
        return result;
    
public booleanhasSelectors()
Indicates whether there are any selectors here.

return
true if there are selectors


                      
       
        return !(selectorsList.isEmpty());
    
public intselectorCount()
Gives the count of the number of selectors in this container

return
the number of selectors

        return selectorsList.size();
    
public java.util.EnumerationselectorElements()
Returns an enumerator for accessing the set of selectors.

return
an enumerator for the selectors

        return selectorsList.elements();
    
public java.lang.StringtoString()
Convert the Selectors within this container to a string. This will just be a helper class for the subclasses that put their own name around the contents listed here.

return
comma separated list of Selectors contained in this one

        StringBuffer buf = new StringBuffer();
        Enumeration e = selectorElements();
        if (e.hasMoreElements()) {
            while (e.hasMoreElements()) {
                buf.append(e.nextElement().toString());
                if (e.hasMoreElements()) {
                    buf.append(", ");
                }
            }
        }

        return buf.toString();
    
public voidvalidate()

This validates each contained selector provided that the selector implements the validate interface.

Ordinarily, this will validate all the elements of a selector container even if the isSelected() method of some elements is never called. This has two effects:

  • Validation will often occur twice.
  • Since it is not required that selectors derive from BaseSelector, there could be selectors in the container whose error conditions are not detected if their isSelected() call is never made.

        Enumeration e = selectorElements();
        while (e.hasMoreElements()) {
            Object o = e.nextElement();
            if (o instanceof BaseSelector) {
                ((BaseSelector) o).validate();
            }
        }