Top Description Fields Constructors Methods
jdk.javadoc.internal.doclets.toolkit.util

public Class DocPath

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Arrays, .Collections, .List

Abstraction for immutable relative paths. Paths always use '/' as a separator, and never begin or end with '/'.

Field Summary

Modifier and TypeField and Description
public static final DocPath
empty

The empty path.

public static final DocPath
parent

The empty path.

private final String

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public DocPath
public static DocPath

Returns:

the path
create
(String
the string
p
)

Creates a path from a string.

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

Overrides java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

public DocLink

Returns:

the link
fragment
(String
the fragment
fragment
)

Creates a DocLink formed from this path and a fragment identifier.

public String

Returns:

the path
getPath
()

Returns this path as a string.

public int
hashCode()

Overrides java.lang.Object.hashCode.

Returns a hash code value for this object.

public DocPath

Returns:

the path
invert
()

Return the inverse path for this path.

public boolean

Returns:

true if this path is empty
isEmpty
()

Return true if this path is empty.

public DocPath

Returns:

the path
normalize
()

Returns the path formed by eliminating empty components, '.' components, and redundant name/..

private static List<String>
private static List<String>
public DocPath
public DocPath

Returns:

the simplified path
relativize
(DocPath
the path to be relativized.
other
)

Normalize and relativize a path against this path, assuming that this path is for a file (not a directory), in which the other path will appear.

public DocPath

Returns:

the path
resolve
(String
the string
p
)

Returns the path formed by appending the specified string to the current path.

public DocPath

Returns:

the path
resolve
(DocPath
the path
p
)

Returns the path by appending the specified path to the current path.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAlltoStringwaitwaitwait

Field Detail

emptyback to summary
public static final DocPath empty

The empty path.

parentback to summary
public static final DocPath parent

The empty path.

pathback to summary
private final String path

Constructor Detail

DocPathback to summary
protected DocPath(String p)

Method Detail

basenameback to summary
public DocPath basename()
createback to summary
public static DocPath create(String p)

Creates a path from a string.

Parameters
p:String

the string

Returns:DocPath

the path

equalsback to summary
public boolean equals(Object other)

Overrides java.lang.Object.equals.

Doc from java.lang.Object.equals.

Indicates whether some other object is "equal to" this one.

The equals method implements an equivalence relation on non-null object references:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.

Parameters
other:Object

the reference object with which to compare.

Returns:boolean

true if this object is the same as the obj argument; false otherwise.

Annotations
@Override
fragmentback to summary
public DocLink fragment(String fragment)

Creates a DocLink formed from this path and a fragment identifier.

Parameters
fragment:String

the fragment

Returns:DocLink

the link

getPathback to summary
public String getPath()

Returns this path as a string.

Returns:String

the path

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Doc from java.lang.Object.hashCode.

Returns a hash code value for this 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
invertback to summary
public DocPath invert()

Return the inverse path for this path. For example, if the path is a/b/c, the inverse path is ../../..

Returns:DocPath

the path

isEmptyback to summary
public boolean isEmpty()

Return true if this path is empty.

Returns:boolean

true if this path is empty

normalizeback to summary
public DocPath normalize()

Returns the path formed by eliminating empty components, '.' components, and redundant name/.. components.

Returns:DocPath

the path

normalizeback to summary
private static List<String> normalize(String path)
normalizeback to summary
private static List<String> normalize(List<String> parts)
parentback to summary
public DocPath parent()
relativizeback to summary
public DocPath relativize(DocPath other)

Normalize and relativize a path against this path, assuming that this path is for a file (not a directory), in which the other path will appear.

Parameters
other:DocPath

the path to be relativized.

Returns:DocPath

the simplified path

resolveback to summary
public DocPath resolve(String p)

Returns the path formed by appending the specified string to the current path.

Parameters
p:String

the string

Returns:DocPath

the path

resolveback to summary
public DocPath resolve(DocPath p)

Returns the path by appending the specified path to the current path.

Parameters
p:DocPath

the path

Returns:DocPath

the path