Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (102)
JavaBeans (21)
JDBC (121)
JDK (426)
JSP (20)
Logging (108)
Mail (58)
Messaging (8)
Network (84)
PDF (97)
Report (7)
Scripting (84)
Security (32)
Server (121)
Servlet (26)
SOAP (24)
Testing (54)
Web (15)
XML (322)
Collections:
Other Resources:
Apache Ant Source Code Files
Apache Ant Source Code Files are inside the Apache Ant source package file
like apache-ant-1.10.10-src.zip.
Unzip the source package file and go to the "src/main" sub-directory,
you will see source code files.
Here is the list of Java source code files of the Apache Ant 1.10.10 in \Users\fyicenter\apache-ant-1.10.10\src\main:
✍: FYIcenter.com
⏎ org/apache/tools/ant/types/selectors/SelectSelector.java
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package org.apache.tools.ant.types.selectors;
import java.io.File;
import java.util.Enumeration;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.PropertyHelper;
/**
* This selector just holds one other selector and forwards all
* requests to it. It exists so that there is a single selector
* type that can exist outside of any targets, as an element of
* project. It overrides all of the reference stuff so that it
* works as expected. Note that this is the only selector you
* can reference.
*
* @since 1.5
*/
public class SelectSelector extends BaseSelectorContainer {
private Object ifCondition;
private Object unlessCondition;
/**
* @return a string describing this object
*/
public String toString() {
StringBuilder buf = new StringBuilder();
if (hasSelectors()) {
buf.append("{select");
if (ifCondition != null) {
buf.append(" if: ");
buf.append(ifCondition);
}
if (unlessCondition != null) {
buf.append(" unless: ");
buf.append(unlessCondition);
}
buf.append(" ");
buf.append(super.toString());
buf.append("}");
}
return buf.toString();
}
/**
* Performs the check for circular references and returns the
* referenced Selector.
*/
private SelectSelector getRef() {
return getCheckedRef(SelectSelector.class);
}
/**
* 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();
}
/**
* 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);
}
/**
* 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();
}
/**
* Add a new selector into this container.
*
* @param selector the new selector to add
*/
@Override
public void appendSelector(FileSelector selector) {
if (isReference()) {
throw noChildrenAllowed();
}
super.appendSelector(selector);
}
/**
* Makes sure that there is only one entry, sets an error message if
* not.
*/
@Override
public void verifySettings() {
int cnt = selectorCount();
if (cnt < 0 || cnt > 1) {
setError("Only one selector is allowed within the <selector> tag");
}
}
/**
* Ensures that the selector passes the conditions placed
* on it with <code>if</code> and <code>unless</code>.
* @return true if conditions are passed
*/
public boolean passesConditions() {
PropertyHelper ph = PropertyHelper.getPropertyHelper(getProject());
return ph.testIfCondition(ifCondition)
&& ph.testUnlessCondition(unlessCondition);
}
/**
* Sets the if attribute to an expression which must evaluate to
* true or the name of an existing property for the
* selector to select any files.
* @param ifProperty the expression to check
* @since Ant 1.8.0
*/
public void setIf(Object ifProperty) {
this.ifCondition = ifProperty;
}
/**
* Sets the if attribute to an expression which must evaluate to
* true or the name of an existing property for the
* selector to select any files.
* @param ifProperty the expression to check
*/
public void setIf(String ifProperty) {
setIf((Object) ifProperty);
}
/**
* Sets the unless attribute to an expression which must evaluate to
* false or the name of a property which cannot exist for the
* selector to select any files.
* @param unlessProperty the expression to check
* @since Ant 1.8.0
*/
public void setUnless(Object unlessProperty) {
this.unlessCondition = unlessProperty;
}
/**
* Sets the unless attribute to an expression which must evaluate to
* false or the name of a property which cannot exist for the
* selector to select any files.
* @param unlessProperty the expression to check
*/
public void setUnless(String unlessProperty) {
setUnless((Object) unlessProperty);
}
/**
* Returns true (the file is selected) only if the if property (if any)
* exists, the unless property (if any) doesn't exist, and the
* contained selector (if any) selects the file. If there is no contained
* selector, return true (because we assume that the point was to test
* the if and unless conditions).
*
* @param basedir the base directory the scan is being done from
* @param filename the name of the file to check
* @param file a java.io.File object for the filename that the selector
* can use
* @return whether the file should be selected or not
*/
@Override
public boolean isSelected(File basedir, String filename, File file) {
validate();
// Deal with if and unless properties first
if (!passesConditions()) {
return false;
}
Enumeration<FileSelector> e = selectorElements();
return !e.hasMoreElements() || e.nextElement().isSelected(basedir, filename, file);
}
}
⏎ org/apache/tools/ant/types/selectors/SelectSelector.java
Or download all of them as a single archive file:
File name: apache-ant-1.10.10-fyi.zip File size: 2392938 bytes Release date: 2021-04-17 Download
⇐ Download Apache Ant Source Package
2021-07-10, ≈1532🔥, 0💬
Popular Posts:
JDK 17 jdk.incubator.foreign.jm odis the JMOD file for JDK 17 HTTP Server module. JDK 17 Incubator F...
What Is javaws.jar in JRE (Java Runtime Environment) 8? javaws.jar in JRE (Java Runtime Environment)...
Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. A pure Java...
How to download and install iText7-Core-7.1.4.zip? iText7-Core-7.1.4.zip is the binary package of iT...
What Is poi-3.5.jar - Part 2? poi-3.5.jar is one of the JAR files for Apache POI 3.5, which provides...