/** * add a selector filename entry on the selector list * @param selector the selector to add */ public void addFilename(FilenameSelector selector) { appendSelector(selector); }
/** * Indicates whether there are any selectors here. * @return true if there are selectors */ @Override public boolean hasSelectors() { if (isReference()) { return getCheckedRef().hasSelectors(); } dieOnCircularReference(); return !selectorsList.isEmpty(); }
/** * Gives the count of the number of selectors in this container * @return the number of selectors */ public int selectorCount() { if (isReference()) { return getCheckedRef().selectorCount(); } dieOnCircularReference(); return selectorsList.size(); }
/** * Returns an enumerator for accessing the set of selectors. * @return an enumerator for the selectors */ public Enumeration<FileSelector> selectorElements() { if (isReference()) { return getCheckedRef().selectorElements(); } dieOnCircularReference(); return Collections.enumeration(selectorsList); }
/** * Returns the set of selectors as an array. * @param p the current project * @return an array of selectors */ public FileSelector[] getSelectors(Project p) { if (isReference()) { return getCheckedRef(AbstractSelectorContainer.class, getDataTypeName(), p).getSelectors(p); } dieOnCircularReference(p); return selectorsList.toArray(new FileSelector[selectorsList.size()]); }
protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) { if (isChecked()) { return; } if (isReference()) { super.dieOnCircularReference(stk, p); } else { for (FileSelector fileSelector : selectorsList) { if (fileSelector instanceof DataType) { pushAndInvokeCircularReferenceCheck((DataType) fileSelector, stk, p); } } setChecked(true); } }
/** * <p> * This validates each contained selector * provided that the selector implements the validate interface. * </p> * <p>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:</p> * <ul> * <li>Validation will often occur twice. * <li>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. * </ul> */ public void validate() { if (isReference()) { getCheckedRef().validate(); } dieOnCircularReference(); selectorsList.stream().filter(BaseSelector.class::isInstance) .map(BaseSelector.class::cast).forEach(BaseSelector::validate); }
/** * Add a new selector into this container. * * @param selector the new selector to add */ public void appendSelector(FileSelector selector) { if (isReference()) { throw noChildrenAllowed(); } selectorsList.add(selector); setChecked(false); }
public synchronized Object clone() { if (isReference()) { return getCheckedRef().clone(); } try { AbstractSelectorContainer sc = (AbstractSelectorContainer) super.clone(); sc.selectorsList = new Vector<>(selectorsList); return sc; } catch (CloneNotSupportedException e) { throw new BuildException(e); } }
/** * Create a deep clone of this instance, except for the nested selectors * (the list of selectors is a shallow clone of this instance's list). * @return a cloned Object. */ @Override public synchronized Object clone() { if (isReference()) { return getRef().clone(); } Files f = (Files) super.clone(); f.defaultPatterns = (PatternSet) defaultPatterns.clone(); f.additionalPatterns = new Vector<>(additionalPatterns.size()); for (PatternSet ps : additionalPatterns) { f.additionalPatterns.add((PatternSet) ps.clone()); } return f; }
/** * add a present selector entry on the selector list * @param selector the selector to add */ public void addPresent(PresentSelector selector) { appendSelector(selector); }
/** * add a depends selector entry on the selector list * @param selector the selector to add */ public void addDepend(DependSelector selector) { appendSelector(selector); }
/** * add an "Or" selector entry on the selector list * @param selector the selector to add */ public void addOr(OrSelector selector) { appendSelector(selector); }
/** * add a regular expression selector entry on the selector list * @param selector the selector to add */ public void addContainsRegexp(ContainsRegexpSelector selector) { appendSelector(selector); }
/** * @param e ExecutableSelector * @since 1.10.0 */ public void addExecutable(ExecutableSelector e) { appendSelector(e); }
/** * add a depth selector entry on the selector list * @param selector the selector to add */ public void addDepth(DepthSelector selector) { appendSelector(selector); }
/** * adds a different selector to the selector list * @param selector the selector to add */ public void addDifferent(DifferentSelector selector) { appendSelector(selector); }
/** * adds a type selector to the selector list * @param selector the selector to add */ public void addType(TypeSelector selector) { appendSelector(selector); }
/** * add a "Select" selector entry on the selector list * @param selector the selector to add */ public void addSelector(SelectSelector selector) { appendSelector(selector); }
/** * add an "And" selector entry on the selector list * @param selector the selector to add */ public void addAnd(AndSelector selector) { appendSelector(selector); }