Top Description Fields Constructors Methods
org.apache.tools.ant.types.selectors

public Class TokenizedPath

extends Object
Class Inheritance
Imports
java.io.File, java.nio.file.Files, .Path, .Paths, org.apache.tools.ant.BuildException, org.apache.tools.ant.util.FileUtils

Container for a path that has been split into its components.
Since
1.8.0

Field Summary

Modifier and TypeField and Description
private static final boolean[]
CS_SCAN_ONLY

iterations for case-sensitive scanning.

private static final boolean[]
CS_THEN_NON_CS

iterations for non-case-sensitive scanning.

public static final TokenizedPath
EMPTY_PATH

Instance that holds no tokens at all.

private static final FileUtils
FILE_UTILS

Helper.

private final String
private final String[]

Constructor Summary

AccessConstructor and Description
public
TokenizedPath(String
The path to tokenize. Must not be null.
path
)

Initialize the TokenizedPath by parsing it.

public
TokenizedPath(TokenizedPath
the parent path
parent
,
String
the child, must not contain the file separator
child
)

Creates a new path as a child of another path.

pack-priv
TokenizedPath(String path, String[] tokens)

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

int
depth
()

The depth (or length) of a path.

public boolean

Returns:

boolean
equals
(Object
the reference object with which to compare.
o
)

Overrides java.lang.Object.equals.

true if the original paths are equal.
public File

Returns:

File object that points to the file in question or null.
findFile
(File
base File (dir).
base
,
final boolean
whether to scan case-sensitively.
cs
)

From base traverse the filesystem in order to find a file that matches the given name.

private static File

Returns:

File object that points to the file in question or null.
findFile
(File
base File (dir) - must not be null.
base
,
final String[]
array of path elements (dirs...file).
pathElements
,
final boolean
whether to scan case-sensitively.
cs
)

From base traverse the filesystem in order to find a file that matches the given stack of names.

pack-priv String[]
public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for the object.
public TokenizedPattern

Returns:

TokenizedPattern
toPattern
()

Creates a TokenizedPattern from the same tokens that make up this path.

public String

Returns:

The original path String
toString
()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

CS_SCAN_ONLYback to summary
private static final boolean[] CS_SCAN_ONLY

iterations for case-sensitive scanning.

CS_THEN_NON_CSback to summary
private static final boolean[] CS_THEN_NON_CS

iterations for non-case-sensitive scanning.

EMPTY_PATHback to summary
public static final TokenizedPath EMPTY_PATH

Instance that holds no tokens at all.

FILE_UTILSback to summary
private static final FileUtils FILE_UTILS

Helper.

pathback to summary
private final String path
tokenizedPathback to summary
private final String[] tokenizedPath

Constructor Detail

TokenizedPathback to summary
public TokenizedPath(String path)

Initialize the TokenizedPath by parsing it.

Parameters
path:String

The path to tokenize. Must not be null.

TokenizedPathback to summary
public TokenizedPath(TokenizedPath parent, String child)

Creates a new path as a child of another path.

Parameters
parent:TokenizedPath

the parent path

child:String

the child, must not contain the file separator

TokenizedPathback to summary
pack-priv TokenizedPath(String path, String[] tokens)

Method Detail

depthback to summary
public int depth()

The depth (or length) of a path.

Returns:int

int

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

true if the original paths are equal.

Parameters
o:Object

Doc from java.lang.Object.equals.

the reference object with which to compare.

Returns:boolean

boolean

Annotations
@Override
findFileback to summary
public File findFile(File base, final boolean cs)

From base traverse the filesystem in order to find a file that matches the given name.

Parameters
base:File

base File (dir).

cs:boolean

whether to scan case-sensitively.

Returns:File

File object that points to the file in question or null.

findFileback to summary
private static File findFile(File base, final String[] pathElements, final boolean cs)

From base traverse the filesystem in order to find a file that matches the given stack of names.

Parameters
base:File

base File (dir) - must not be null.

pathElements:String[]

array of path elements (dirs...file).

cs:boolean

whether to scan case-sensitively.

Returns:File

File object that points to the file in question or null.

getTokensback to summary
pack-priv String[] getTokens()
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for the object. This method is supported for the benefit of hash tables such as those provided by java.util.HashMap.

The general contract of hashCode is:

  • Whenever it is invoked on the same object more than once during an execution of a Java application, the hashCode method must consistently return the same integer, provided no information used in equals comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application.
  • If two objects are equal according to the equals method, then calling the hashCode method on each of the two objects must produce the same integer result.
  • It is not required that if two objects are unequal according to the equals method, then calling the hashCode method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns:int

a hash code value for this object.

Annotations
@Override
toPatternback to summary
public TokenizedPattern toPattern()

Creates a TokenizedPattern from the same tokens that make up this path.

Returns:TokenizedPattern

TokenizedPattern

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

The original path String

Annotations
@Override