|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jboss.dna.graph.property.basic.AbstractPath
org.jboss.dna.graph.property.basic.RootPath
@Immutable public class RootPath

Optimized implementation of Path that serves as the root path.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface org.jboss.dna.graph.property.Path |
|---|
Path.Segment |
| Field Summary | |
|---|---|
static Path |
INSTANCE
|
| Fields inherited from class org.jboss.dna.graph.property.basic.AbstractPath |
|---|
SELF_PATH |
| Fields inherited from interface org.jboss.dna.graph.property.Path |
|---|
DEFAULT_DECODER, DEFAULT_ENCODER, DEFAULT_INDEX, DELIMITER, DELIMITER_STR, JSR283_DECODER, JSR283_ENCODER, NO_OP_DECODER, NO_OP_ENCODER, PARENT, PARENT_NAME, PARENT_SEGMENT, SELF, SELF_NAME, SELF_SEGMENT, URL_DECODER, URL_ENCODER |
| Method Summary | |
|---|---|
int |
compareTo(Path other)
|
boolean |
equals(Object obj)
|
Path |
getAncestor(int degree)
Return the path to the ancestor of the supplied degree. |
Path |
getCanonicalPath()
Get the canonical form of this path. A canonical path has is absolute and Path.isNormalized(). |
Path |
getCommonAncestor(Path that)
Find the lowest common ancestor of this path and the supplied path. |
Path.Segment |
getLastSegment()
Get the last segment in this path. |
Path |
getNormalizedPath()
Get a normalized path with as many ".." segments and all "." resolved. The relative path ".", however, will return itself as the normalized path, since it cannot be resolved any further. |
Path |
getParent()
Return the path to the parent, or this path if it is the root. This is an efficient operation that does
not require copying any data. |
Path.Segment |
getSegment(int index)
Get the segment at the supplied index. |
Path.Segment[] |
getSegmentsArray()
Obtain a copy of the segments in this path. None of the segments are encoded. |
List<Path.Segment> |
getSegmentsList()
Get an unmodifiable list of the path segments. |
String |
getString()
Get the string form of the path. The default encoder is used to encode characters in each of the
path segments. |
String |
getString(NamespaceRegistry namespaceRegistry)
Get the string form of the path, using the supplied namespace registry to convert the names' namespace URIs to prefixes. The default encoder is used to encode characters in each of the path segments. The second encoder
is used to encode (or convert) the delimiter between the namespace prefix and the
local part. |
String |
getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder)
Get the encoded string form of the path, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters in each of the path segments. |
String |
getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder,
TextEncoder delimiterEncoder)
Get the encoded string form of the path, using the supplied namespace registry to convert the names' namespace URIs to prefixes and the supplied encoder to encode characters in each of the path segments. |
String |
getString(TextEncoder encoder)
Get the encoded string form of the path, using the supplied encoder to encode characters in each of the path segments. |
boolean |
hasSameAncestor(Path that)
Determine whether this path and the supplied path have the same immediate ancestor. In other words, this method determines whether the node represented by this path is a sibling of the node represented by the supplied path. |
boolean |
isAbsolute()
Return whether this path is an absolute path. |
boolean |
isAncestorOf(Path decendant)
Determine whether this path is an ancestor of the supplied path. A path is considered an ancestor of another path if the the ancestor path appears in its entirety at the beginning of the decendant path, and where the decendant path contains at least one additional segment. |
boolean |
isAtOrAbove(Path other)
Determine whether this path is the same as to or a ancestor of the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other), and is a convenience method that is identical to calling other.isAtOrBelow(this). |
boolean |
isAtOrBelow(Path other)
Determine whether this path is the same as to or a decendant of the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other). |
boolean |
isDecendantOf(Path ancestor)
Determine whether this path is an decendant of the supplied path. A path is considered a decendant of another path if the the decendant path starts exactly with the entire ancestor path but contains at least one additional segment. |
boolean |
isNormalized()
Return whether this path is normalized and contains no "." segments and as few ".." segments as possible. |
boolean |
isRoot()
Return whether this path represents the root path. |
boolean |
isSameAs(Path other)
Determine whether this path represents the same as the supplied path. This is equivalent to calling
this.compareTo(other) == 0 . |
Iterator<Path.Segment> |
iterator()
|
Iterator<Path> |
pathsFromRoot()
Return an iterator that walks the paths from the root path down to this path. This method always returns at least one path (the root returns an iterator containing itself). |
Path |
resolve(Path relativePath)
Get the absolute path by resolving the supplied relative (non-absolute) path against this absolute path. |
int |
size()
Return the number of segments in this path. |
Path |
subpath(int beginIndex)
Return a new path consisting of the segments starting at beginIndex index (inclusive). This is equivalent to
calling path.subpath(beginIndex,path.size()-1). |
Path |
subpath(int beginIndex,
int endIndex)
Return a new path consisting of the segments between the beginIndex index (inclusive) and the endIndex
index (exclusive). |
| Methods inherited from class org.jboss.dna.graph.property.basic.AbstractPath |
|---|
hashCode, relativeTo, resolveAgainst, toString |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final Path INSTANCE
| Method Detail |
|---|
public Path getAncestor(int degree)
x is the path that is x
levels up along the path. For example, degree = 0 returns this path, while degree = 1
returns the parent of this path, degree = 2 returns the grandparent of this path, and so on. Note that the
result may be unexpected if this path is not normalized, as a non-normalized path contains ".." and
"." segments.
Path.getAncestor(int)public Path getCanonicalPath()
absolute and Path.isNormalized().
getCanonicalPath in interface PathgetCanonicalPath in class AbstractPathPath.getCanonicalPath()public Path getCommonAncestor(Path that)
getCommonAncestor in interface PathgetCommonAncestor in class AbstractPaththat - the other path
Path.getCommonAncestor(org.jboss.dna.graph.property.Path)public Path.Segment getLastSegment()
getLastSegment in interface PathgetLastSegment in class AbstractPathPath.getLastSegment()public Path getNormalizedPath()
getNormalizedPath in interface PathgetNormalizedPath in class AbstractPathPath.getNormalizedPath()public Path resolve(Path relativePath)
resolve in interface Pathresolve in class AbstractPathrelativePath - the relative path that is to be resolved against this path
AbstractPath.resolve(org.jboss.dna.graph.property.Path)public Path getParent()
root. This is an efficient operation that does
not require copying any data.
getParent in interface PathgetParent in class AbstractPathPath.getParent()public Path.Segment getSegment(int index)
getSegment in interface PathgetSegment in class AbstractPathindex - the index
Path.getSegment(int)public Path.Segment[] getSegmentsArray()
getSegmentsArray in interface PathgetSegmentsArray in class AbstractPathPath.getSegmentsArray()public List<Path.Segment> getSegmentsList()
Path.getSegmentsList()public String getString()
default encoder is used to encode characters in each of the
path segments.
getString in interface PathgetString in class AbstractPathPath.getString()public String getString(TextEncoder encoder)
getString in interface PathgetString in class AbstractPathencoder - the encoder to use, or null if the default encoder should be used
Path.getString(org.jboss.dna.common.text.TextEncoder)public String getString(NamespaceRegistry namespaceRegistry)
default encoder is used to encode characters in each of the path segments. The second encoder
is used to encode (or convert) the delimiter between the namespace prefix and the
local part.
getString in interface PathgetString in class AbstractPathnamespaceRegistry - the namespace registry that should be used to obtain the prefix for the
namespace URIs in the segment names
Path.getString(org.jboss.dna.graph.property.NamespaceRegistry)
public String getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder)
getString in interface PathgetString in class AbstractPathnamespaceRegistry - the namespace registry that should be used to obtain the prefix for the
namespace URIs in the segment names, or null if the
namespace registry should not be usedencoder - the encoder to use for encoding the local part and
namespace prefix of each segment, or null if the
default encoder should be used
Path.getString(org.jboss.dna.graph.property.NamespaceRegistry,
org.jboss.dna.common.text.TextEncoder)
public String getString(NamespaceRegistry namespaceRegistry,
TextEncoder encoder,
TextEncoder delimiterEncoder)
getString in interface PathgetString in class AbstractPathnamespaceRegistry - the namespace registry that should be used to obtain the prefix for the
namespace URIs in the segment namesencoder - the encoder to use for encoding the local part and
namespace prefix of each segment, or null if the
default encoder should be useddelimiterEncoder - the encoder to use for encoding the delimiter between the local part
and namespace prefix of each segment, and for encoding
the path delimiter, or null if the standard delimiters should be used
Path.getString(org.jboss.dna.graph.property.NamespaceRegistry,
org.jboss.dna.common.text.TextEncoder, org.jboss.dna.common.text.TextEncoder)public boolean hasSameAncestor(Path that)
hasSameAncestor in interface PathhasSameAncestor in class AbstractPaththat - the other path
Path.hasSameAncestor(org.jboss.dna.graph.property.Path)public boolean isAbsolute()
absolute. An absolute path
starts with a "/".
Path.isAbsolute()public boolean isAncestorOf(Path decendant)
isAncestorOf in interface PathisAncestorOf in class AbstractPathdecendant - the path that may be the decendant; may be null
Path.isAncestorOf(org.jboss.dna.graph.property.Path)public boolean isAtOrAbove(Path other)
same as to or a ancestor of the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other), and is a convenience method that is identical to calling other.isAtOrBelow(this).
isAtOrAbove in interface PathisAtOrAbove in class AbstractPathother - the other path to compare with this path; may be null
Path.isAtOrAbove(org.jboss.dna.graph.property.Path)public boolean isAtOrBelow(Path other)
same as to or a decendant of the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other).
isAtOrBelow in interface PathisAtOrBelow in class AbstractPathother - the other path to compare with this path; may be null
Path.isAtOrBelow(org.jboss.dna.graph.property.Path)public boolean isDecendantOf(Path ancestor)
isDecendantOf in interface PathisDecendantOf in class AbstractPathancestor - the path that may be the ancestor; may be null
Path.isDecendantOf(org.jboss.dna.graph.property.Path)public boolean isNormalized()
Path.isNormalized()public boolean isRoot()
Path.isRoot()public boolean isSameAs(Path other)
this.compareTo(other) == 0 .
isSameAs in interface PathisSameAs in class AbstractPathother - the other path to compare with this path; may be null
Path.isSameAs(org.jboss.dna.graph.property.Path)public Iterator<Path.Segment> iterator()
iterator in interface Iterable<Path.Segment>iterator in interface Pathiterator in class AbstractPathPath.iterator()public Iterator<Path> pathsFromRoot()
pathsFromRoot in interface PathpathsFromRoot in class AbstractPathPath.pathsFromRoot()public int size()
Path.size()public Path subpath(int beginIndex)
beginIndex index (inclusive). This is equivalent to
calling path.subpath(beginIndex,path.size()-1).
subpath in interface Pathsubpath in class AbstractPathbeginIndex - the beginning index, inclusive.
Path.subpath(int)
public Path subpath(int beginIndex,
int endIndex)
beginIndex index (inclusive) and the endIndex
index (exclusive).
subpath in interface Pathsubpath in class AbstractPathbeginIndex - the beginning index, inclusive.endIndex - the ending index, exclusive.
Path.subpath(int, int)public int compareTo(Path other)
compareTo in interface Comparable<Path>compareTo in class AbstractPathComparable.compareTo(java.lang.Object)public boolean equals(Object obj)
equals in class AbstractPathObject.equals(java.lang.Object)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||