Categories:
Audio (13)
Biotech (29)
Bytecode (36)
Database (77)
Framework (7)
Game (7)
General (507)
Graphics (53)
I/O (35)
IDE (2)
JAR Tools (101)
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 (309)
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/TokenizedPattern.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.function.Predicate; import java.util.stream.Stream; /** * Provides reusable path pattern matching. PathPattern is preferable * to equivalent SelectorUtils methods if you need to execute multiple * matching with the same pattern because here the pattern itself will * be parsed only once. * @see SelectorUtils#matchPath(String, String) * @see SelectorUtils#matchPath(String, String, boolean) * @since 1.8.0 */ public class TokenizedPattern { /** * Instance that holds no tokens at all. */ public static final TokenizedPattern EMPTY_PATTERN = new TokenizedPattern("", new String[0]); private final String pattern; private final String[] tokenizedPattern; /** * Initialize the PathPattern by parsing it. * @param pattern The pattern to match against. Must not be * <code>null</code>. */ public TokenizedPattern(String pattern) { this(pattern, SelectorUtils.tokenizePathAsArray(pattern)); } TokenizedPattern(String pattern, String[] tokens) { this.pattern = pattern; this.tokenizedPattern = tokens; } /** * Tests whether or not a given path matches a given pattern. * * @param path The path to match, as a String. Must not be * <code>null</code>. * @param isCaseSensitive Whether or not matching should be performed * case sensitively. * * @return <code>true</code> if the pattern matches against the string, * or <code>false</code> otherwise. */ public boolean matchPath(TokenizedPath path, boolean isCaseSensitive) { return SelectorUtils.matchPath(tokenizedPattern, path.getTokens(), isCaseSensitive); } /** * Tests whether or not this pattern matches the start of * a path. * * @param path TokenizedPath * @param caseSensitive boolean * @return boolean */ public boolean matchStartOf(TokenizedPath path, boolean caseSensitive) { return SelectorUtils.matchPatternStart(tokenizedPattern, path.getTokens(), caseSensitive); } /** * @return The pattern String */ public String toString() { return pattern; } public String getPattern() { return pattern; } /** * true if the original patterns are equal. * * @param o Object */ public boolean equals(Object o) { return o instanceof TokenizedPattern && pattern.equals(((TokenizedPattern) o).pattern); } public int hashCode() { return pattern.hashCode(); } /** * The depth (or length) of a pattern. * * @return int */ public int depth() { return tokenizedPattern.length; } /** * Does the tokenized pattern contain the given string? * * @param pat String * @return boolean */ public boolean containsPattern(String pat) { return Stream.of(tokenizedPattern).anyMatch(Predicate.isEqual(pat)); } /** * Returns a new TokenizedPath where all tokens of this pattern to * the right containing wildcards have been removed * * @return the leftmost part of the pattern without wildcards */ public TokenizedPath rtrimWildcardTokens() { StringBuilder sb = new StringBuilder(); int newLen = 0; for (; newLen < tokenizedPattern.length; newLen++) { if (SelectorUtils.hasWildcards(tokenizedPattern[newLen])) { break; } if (newLen > 0 && sb.charAt(sb.length() - 1) != File.separatorChar) { sb.append(File.separator); } sb.append(tokenizedPattern[newLen]); } if (newLen == 0) { return TokenizedPath.EMPTY_PATH; } String[] newPats = new String[newLen]; System.arraycopy(tokenizedPattern, 0, newPats, 0, newLen); return new TokenizedPath(sb.toString(), newPats); } /** * true if the last token equals the given string. * * @param s String * @return boolean */ public boolean endsWith(String s) { return tokenizedPattern.length > 0 && tokenizedPattern[tokenizedPattern.length - 1].equals(s); } /** * Returns a new pattern without the last token of this pattern. * * @return TokenizedPattern */ public TokenizedPattern withoutLastToken() { if (tokenizedPattern.length == 0) { throw new IllegalStateException("can't strip a token from nothing"); } if (tokenizedPattern.length == 1) { return EMPTY_PATTERN; } String toStrip = tokenizedPattern[tokenizedPattern.length - 1]; int index = pattern.lastIndexOf(toStrip); String[] tokens = new String[tokenizedPattern.length - 1]; System.arraycopy(tokenizedPattern, 0, tokens, 0, tokenizedPattern.length - 1); return new TokenizedPattern(pattern.substring(0, index), tokens); } }
⏎ org/apache/tools/ant/types/selectors/TokenizedPattern.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, 111020👍, 0💬
Popular Posts:
What Is log4j-1.2.13.jar? I got the JAR file from logging-log4j-1.2.13.zip .log4j-1.2.13.jar is the ...
Apache Neethi provides general framework for the programmers to use WS Policy. It is compliant with ...
XML Serializer, Release 2.7.1, allows you to write out XML, HTML etc. as a stream of characters from...
commons-collections4-4.2 -sources.jaris the source JAR file for Apache Commons Collections 4.2, whic...
Java Architecture for XML Binding (JAXB) is a Java API that allows Java developers to map Java class...