/** * add a selector size entry on the selector list * @param selector the selector to add */ public void addSize(SizeSelector selector) { appendSelector(selector); }
protected synchronized void dieOnCircularReference(Stack<Object> stk, Project p) throws BuildException { 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 implementation validates the container by calling * verifySettings() and then 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() { verifySettings(); dieOnCircularReference(); String errmsg = getError(); if (errmsg != null) { throw new BuildException(errmsg); } selectorsList.stream().filter(BaseSelector.class::isInstance) .map(BaseSelector.class::cast).forEach(BaseSelector::validate); }
/** * Indicates whether there are any selectors here. * @return true if there are selectors */ public boolean hasSelectors() { dieOnCircularReference(); return !selectorsList.isEmpty(); }
/** * Returns an enumerator for accessing the set of selectors. * @return an enumerator that goes through each of the selectors */ @Override public Enumeration<FileSelector> selectorElements() { if (isReference()) { return getRef().selectorElements(); } return super.selectorElements(); }
/** * Gives the count of the number of selectors in this container * @return the number of selectors in this container */ @Override public int selectorCount() { if (isReference()) { return getRef().selectorCount(); } return super.selectorCount(); }
/** * Returns the set of selectors as an array. * @param p the current project * @return an array of selectors in this container */ @Override public FileSelector[] getSelectors(Project p) { if (isReference()) { return getRef().getSelectors(p); } return super.getSelectors(p); }
/** * Indicates whether there are any selectors here. * @return whether any selectors are in this container */ @Override public boolean hasSelectors() { if (isReference()) { return getRef().hasSelectors(); } return super.hasSelectors(); }
/** * Returns an enumerator for accessing the set of selectors. * @return an enumerator for the selectors */ public Enumeration<FileSelector> selectorElements() { dieOnCircularReference(); return Collections.enumeration(selectorsList); }
/** * add a selector filename entry on the selector list * @param selector the selector to add */ public void addFilename(FilenameSelector selector) { appendSelector(selector); }
/** * Gives the count of the number of selectors in this container * @return the number of selectors */ public int selectorCount() { dieOnCircularReference(); return selectorsList.size(); }
/** * adds a different selector to the selector list * @param selector the selector to add */ public void addDifferent(DifferentSelector selector) { appendSelector(selector); }
/** * Returns the set of selectors as an array. * @param p the current project * @return an array of selectors */ public FileSelector[] getSelectors(Project p) { dieOnCircularReference(); return selectorsList.toArray(new FileSelector[selectorsList.size()]); }
/** * adds a type selector to the selector list * @param selector the selector to add */ public void addType(TypeSelector selector) { appendSelector(selector); }
/** * 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 */ public String toString() { dieOnCircularReference(); return selectorsList.stream().map(Object::toString) .collect(Collectors.joining(", ")); }
/** * @param e ExecutableSelector * @since 1.10.0 */ public void addExecutable(ExecutableSelector e) { appendSelector(e); }
/** * @param e SymlinkSelector * @since 1.10.0 */ public void addSymlink(SymlinkSelector e) { appendSelector(e); }
/** * add a "Select" selector entry on the selector list * @param selector the selector to add */ public void addSelector(SelectSelector 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); }
/** * @param o OwnedBySelector * @since 1.10.0 */ public void addOwnedBy(OwnedBySelector o) { appendSelector(o); }