BaseSelectorContainer (Apache Ant API)

org.apache.tools.ant.types.selectors
Class BaseSelectorContainer


java.lang.Object

  |

  +--org.apache.tools.ant.ProjectComponent

        |

        +--org.apache.tools.ant.types.DataType

              |

              +--org.apache.tools.ant.types.selectors.BaseSelector

                    |

                    +--org.apache.tools.ant.types.selectors.BaseSelectorContainer

All Implemented Interfaces:
FileSelector, SelectorContainer
Direct Known Subclasses:
AndSelector, MajoritySelector, NoneSelector, OrSelector

public abstract class BaseSelectorContainer
extends BaseSelector
implements SelectorContainer

This is the base class for selectors that can contain other selectors.

Since:
1.5
Author:
Bruce Atherton

Field Summary
 
Fields inherited from class org.apache.tools.ant.types.DataType
checked, description, ref
 
Fields inherited from class org.apache.tools.ant.ProjectComponent
project
 
Constructor Summary
BaseSelectorContainer()
          Default constructor.
 
Method Summary
 void addAnd(AndSelector selector)
          add an "And" selector entry on the selector list
 void addContains(ContainsSelector selector)
          add a contains selector entry on the selector list
 void addCustom(ExtendSelector selector)
          add an extended selector entry on the selector list
 void addDate(DateSelector selector)
          add a selector date entry on the selector list
 void addDepend(DependSelector selector)
          add a depends selector entry on the selector list
 void addDepth(DepthSelector selector)
          add a depth selector entry on the selector list
 void addFilename(FilenameSelector selector)
          add a selector filename entry on the selector list
 void addMajority(MajoritySelector selector)
          add a majority selector entry on the selector list
 void addNone(NoneSelector selector)
          add a "None" selector entry on the selector list
 void addNot(NotSelector selector)
          add a "Not" selector entry on the selector list
 void addOr(OrSelector selector)
          add an "Or" selector entry on the selector list
 void addPresent(PresentSelector selector)
          add a present selector entry on the selector list
 void addSelector(SelectSelector selector)
          add a "Select" selector entry on the selector list
 void addSize(SizeSelector selector)
          add a selector size entry on the selector list
 void appendSelector(FileSelector selector)
          Add a new selector into this container.
 FileSelector[] getSelectors(Project p)
          Returns the set of selectors as an array.
 boolean hasSelectors()
          Indicates whether there are any selectors here.
abstract  boolean isSelected(java.io.File basedir, java.lang.String filename, java.io.File file)
          Method that each selector will implement to create their selection behaviour.
 int selectorCount()
          Gives the count of the number of selectors in this container
 java.util.Enumeration selectorElements()
          Returns an enumerator for accessing the set of selectors.
 java.lang.String toString()
          Convert the Selectors within this container to a string.
 void validate()
          This implementation validates the container by calling verifySettings() and then validates each contained selector provided that the selector implements the validate interface.
 
Methods inherited from class org.apache.tools.ant.types.selectors.BaseSelector
getError, setError, verifySettings
 
Methods inherited from class org.apache.tools.ant.types.DataType
circularReference, dieOnCircularReference, getCheckedRef, getDescription, isReference, noChildrenAllowed, setDescription, setRefid, tooManyAttributes
 
Methods inherited from class org.apache.tools.ant.ProjectComponent
getProject, log, log, setProject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BaseSelectorContainer


public BaseSelectorContainer()
Default constructor.

Method Detail

hasSelectors


public boolean hasSelectors()
Indicates whether there are any selectors here.

Specified by:
hasSelectors in interface SelectorContainer
Returns:
whether any selectors are in this container

selectorCount


public int selectorCount()
Gives the count of the number of selectors in this container

Specified by:
selectorCount in interface SelectorContainer
Returns:
the number of selectors in this container

getSelectors


public FileSelector[] getSelectors(Project p)
Returns the set of selectors as an array.

Specified by:
getSelectors in interface SelectorContainer
Returns:
an array of selectors in this container

selectorElements


public java.util.Enumeration selectorElements()
Returns an enumerator for accessing the set of selectors.

Specified by:
selectorElements in interface SelectorContainer
Returns:
an enumerator that goes through each of the selectors

toString


public java.lang.String toString()
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.

Overrides:
toString in class java.lang.Object
Returns:
comma separated list of Selectors contained in this one

appendSelector


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

Specified by:
appendSelector in interface SelectorContainer
Parameters:
selector - the new selector to add
Returns:
the selector that was added

validate


public void validate()

This implementation validates the container by calling verifySettings() and then 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:

Overrides:
validate in class BaseSelector

isSelected


public abstract boolean isSelected(java.io.File basedir,
                                   java.lang.String filename,
                                   java.io.File file)
Method that each selector will implement to create their selection behaviour. This is what makes SelectorContainer abstract.

Specified by:
isSelected in interface FileSelector
Specified by:
isSelected in class BaseSelector
Parameters:
basedir - the base directory the scan is being done from
filename - the name of the file to check
file - a java.io.File object for the filename that the selector can use
Returns:
whether the file should be selected or not

addSelector


public void addSelector(SelectSelector selector)
add a "Select" selector entry on the selector list

Specified by:
addSelector in interface SelectorContainer

addAnd


public void addAnd(AndSelector selector)
add an "And" selector entry on the selector list

Specified by:
addAnd in interface SelectorContainer

addOr


public void addOr(OrSelector selector)
add an "Or" selector entry on the selector list

Specified by:
addOr in interface SelectorContainer

addNot


public void addNot(NotSelector selector)
add a "Not" selector entry on the selector list

Specified by:
addNot in interface SelectorContainer

addNone


public void addNone(NoneSelector selector)
add a "None" selector entry on the selector list

Specified by:
addNone in interface SelectorContainer

addMajority


public void addMajority(MajoritySelector selector)
add a majority selector entry on the selector list

Specified by:
addMajority in interface SelectorContainer

addDate


public void addDate(DateSelector selector)
add a selector date entry on the selector list

Specified by:
addDate in interface SelectorContainer

addSize


public void addSize(SizeSelector selector)
add a selector size entry on the selector list

Specified by:
addSize in interface SelectorContainer

addFilename


public void addFilename(FilenameSelector selector)
add a selector filename entry on the selector list

Specified by:
addFilename in interface SelectorContainer

addCustom


public void addCustom(ExtendSelector selector)
add an extended selector entry on the selector list

Specified by:
addCustom in interface SelectorContainer

addContains


public void addContains(ContainsSelector selector)
add a contains selector entry on the selector list

Specified by:
addContains in interface SelectorContainer

addPresent


public void addPresent(PresentSelector selector)
add a present selector entry on the selector list

Specified by:
addPresent in interface SelectorContainer

addDepth


public void addDepth(DepthSelector selector)
add a depth selector entry on the selector list

Specified by:
addDepth in interface SelectorContainer

addDepend


public void addDepend(DependSelector selector)
add a depends selector entry on the selector list

Specified by:
addDepend in interface SelectorContainer


Copyright © 2000-2002 Apache Software Foundation. All Rights Reserved.