|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.jcr.value.basic.AbstractPath
org.modeshape.jcr.value.basic.ChildPath
@Immutable public class ChildPath
Implementation of a Path
that has the information for the last segment but that points to another Path for the parent
information.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.modeshape.jcr.value.Path |
---|
Path.Segment |
Field Summary |
---|
Fields inherited from class org.modeshape.jcr.value.basic.AbstractPath |
---|
EMPTY_PATH_ITERATOR, SELF_PATH |
Fields inherited from interface org.modeshape.jcr.value.Path |
---|
DEFAULT_DECODER, DEFAULT_ENCODER, DEFAULT_INDEX, DELIMITER, DELIMITER_STR, IDENTIFIER_LEADING_TERMINAL, IDENTIFIER_TRAILING_TERMINAL, JSR283_DECODER, JSR283_ENCODER, NO_OP_DECODER, NO_OP_ENCODER, PARENT, PARENT_NAME, PARENT_SEGMENT, ROOT_NAME, ROOT_PATH, SELF, SELF_NAME, SELF_SEGMENT, URL_DECODER, URL_ENCODER |
Constructor Summary | |
---|---|
ChildPath(Path parent,
Path.Segment child)
|
Method Summary | |
---|---|
Path |
getAncestor(int degree)
Return the path to the ancestor of the supplied degree. |
Path.Segment |
getLastSegment()
Get the last segment in this path. |
Path |
getParent()
Return the path to the parent, or this path if it is the root . |
Path.Segment |
getSegment(int index)
Get the segment at the supplied index. |
List<Path.Segment> |
getSegmentsList()
Get an unmodifiable list of the path segments. |
protected Iterator<Path.Segment> |
getSegmentsOfParent()
Method used by AbstractPath.equals(Object) implementation to quickly get an Iterator over the segments in the
parent. |
boolean |
hasSameAncestor(Path that)
Determine whether this path and the supplied path have the same immediate ancestor. |
boolean |
isAbsolute()
Return whether this path is an absolute path. |
boolean |
isAtOrBelow(Path other)
Determine whether this path is the same as to or a descendant of the
supplied path. |
boolean |
isDescendantOf(Path ancestor)
Determine whether this path is an descendant of the supplied path. |
boolean |
isNormalized()
Return whether this path is normalized and contains no unnecessary "." segments and as few ".." segments as possible. |
boolean |
isRoot()
Return whether this path represents the root path. |
Iterator<Path.Segment> |
iterator()
|
int |
size()
Return the number of segments in this path. |
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.modeshape.jcr.value.basic.AbstractPath |
---|
compareTo, createSegmentsSubList, doGetString, endsWith, endsWith, equals, getCanonicalPath, getCommonAncestor, getNormalizedPath, getSegmentsArray, getString, getString, getString, getString, getString, hashCode, isAncestorOf, isAtOrAbove, isIdentifier, isNormalized, isSameAs, pathsFromRoot, relativeTo, relativeToRoot, resolve, resolveAgainst, subpath, toString |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ChildPath(Path parent, Path.Segment child)
Method Detail |
---|
public Path getAncestor(int degree)
Path
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.
protected Iterator<Path.Segment> getSegmentsOfParent()
AbstractPath
AbstractPath.equals(Object)
implementation to quickly get an Iterator over the segments in the
parent.
getSegmentsOfParent
in class AbstractPath
public Path.Segment getLastSegment()
Path
getLastSegment
in interface Path
getLastSegment
in class AbstractPath
public Path getParent()
Path
root
. This is an efficient operation that does
not require copying any data.
getParent
in interface Path
getParent
in class AbstractPath
public Path.Segment getSegment(int index)
Path
getSegment
in interface Path
getSegment
in class AbstractPath
index
- the index
public List<Path.Segment> getSegmentsList()
Path
public boolean hasSameAncestor(Path that)
Path
hasSameAncestor
in interface Path
hasSameAncestor
in class AbstractPath
that
- the other path
public boolean isAbsolute()
Path
absolute
. An absolute path
starts with a "/".
public boolean isAtOrBelow(Path other)
Path
same as
to or a descendant of
the
supplied path. This method is equivalent to (but may be more efficient than) calling isSame(other) ||
isAncestor(other)
.
isAtOrBelow
in interface Path
isAtOrBelow
in class AbstractPath
other
- the other path to compare with this path; may be null
public boolean isDescendantOf(Path ancestor)
Path
isDescendantOf
in interface Path
isDescendantOf
in class AbstractPath
ancestor
- the path that may be the ancestor; may be null
public boolean isNormalized()
Path
public boolean isRoot()
Path
public Iterator<Path.Segment> iterator()
iterator
in interface Iterable<Path.Segment>
iterator
in class AbstractPath
public int size()
Path
public Path subpath(int beginIndex, int endIndex)
Path
beginIndex
index (inclusive) and the endIndex
index (exclusive).
subpath
in interface Path
subpath
in class AbstractPath
beginIndex
- the beginning index, inclusive.endIndex
- the ending index, exclusive.
|
ModeShape Distribution 3.0.0.Beta4 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |