Save This Page
Home » apache-ant-1.8.1 » org.apache.tools » ant » types » selectors » [javadoc | source]
org.apache.tools.ant.types.selectors
public class: MajoritySelector [javadoc | source]
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
               org.apache.tools.ant.types.selectors.MajoritySelector

All Implemented Interfaces:
    SelectorContainer, FileSelector, Cloneable

This selector is here just to shake up your thinking a bit. Don't get too caught up in boolean, there are other ways you can evaluate a collection of selectors. This one takes a vote of the selectors it contains, and majority wins. You could also have an "all-but-one" selector, a "weighted-average" selector, and so on. These are left as exercises for the reader (as are the usecases where this would be necessary).
Fields inherited from org.apache.tools.ant.types.DataType:
ref,  checked
Fields inherited from org.apache.tools.ant.ProjectComponent:
project,  location,  description
Constructor:
 public MajoritySelector() 
Method from org.apache.tools.ant.types.selectors.MajoritySelector Summary:
isSelected,   setAllowtie,   toString
Methods from org.apache.tools.ant.types.selectors.BaseSelectorContainer:
add,   addAnd,   addContains,   addContainsRegexp,   addCustom,   addDate,   addDepend,   addDepth,   addDifferent,   addFilename,   addMajority,   addModified,   addNone,   addNot,   addOr,   addPresent,   addReadable,   addSelector,   addSize,   addType,   addWritable,   appendSelector,   dieOnCircularReference,   getSelectors,   hasSelectors,   isSelected,   selectorCount,   selectorElements,   toString,   validate
Methods from org.apache.tools.ant.types.selectors.BaseSelector:
getError,   isSelected,   setError,   validate,   verifySettings
Methods from org.apache.tools.ant.types.DataType:
checkAttributesAllowed,   checkChildrenAllowed,   circularReference,   clone,   dieOnCircularReference,   dieOnCircularReference,   dieOnCircularReference,   getCheckedRef,   getCheckedRef,   getCheckedRef,   getCheckedRef,   getDataTypeName,   getRefid,   invokeCircularReferenceCheck,   isChecked,   isReference,   noChildrenAllowed,   pushAndInvokeCircularReferenceCheck,   setChecked,   setRefid,   toString,   tooManyAttributes
Methods from org.apache.tools.ant.ProjectComponent:
clone,   getDescription,   getLocation,   getProject,   log,   log,   setDescription,   setLocation,   setProject
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.tools.ant.types.selectors.MajoritySelector Detail:
 public boolean isSelected(File basedir,
    String filename,
    File file) 
    Returns true (the file is selected) if most of the other selectors agree. In case of a tie, go by the allowtie setting. That defaults to true, meaning in case of a tie, the file is selected.
 public  void setAllowtie(boolean tiebreaker) 
    A attribute to specify what will happen if number of yes votes is the same as the number of no votes defaults to true
 public String toString()