Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.graph.property.basic
Class ChildPath

    java.lang.Object
      org.modeshape.graph.property.basic.AbstractPath
          org.modeshape.graph.property.basic.ChildPath

All Implemented Interfaces:
  Serializable, Comparable<Path>, Iterable<Path.Segment>, Path, Readable

    @Immutable
    public class ChildPath

extends AbstractPath

Implementation of a `Path` that has the information for the last segment but that points to another Path for the parent information.

See Also:
  Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from class org.modeshape.graph.property.basic.AbstractPath
`AbstractPath.SingleIterator<T>`

Nested classes/interfaces inherited from interface org.modeshape.graph.property.Path
`Path.Segment`

Field Summary

Fields inherited from class org.modeshape.graph.property.basic.AbstractPath
`EMPTY_PATH_ITERATOR, SELF_PATH`

Fields inherited from interface org.modeshape.graph.property.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, 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 `decendant of` the supplied path.
`boolean` | `isDecendantOf(Path ancestor)` Determine whether this path is an decendant 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.graph.property.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

### ChildPath

    public ChildPath(Path parent,
                     Path.Segment child)

Method Detail

### getAncestor

    public Path getAncestor(int degree)

  Return the path to the ancestor of the supplied degree. An ancestor of 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.

  Returns:
    the ancestor of the supplied degree
  See Also:
    `Path.getAncestor(int)`

### getSegmentsOfParent

    protected Iterator<Path.Segment> getSegmentsOfParent()

  Method used by `AbstractPath.equals(Object)` implementation to quickly get an Iterator over the segments in the parent.

  Specified by:
    `getSegmentsOfParent` in class `AbstractPath`
  Returns:
    the iterator over the segments; never null, but may not have any elements
  See Also:
    `AbstractPath.getSegmentsOfParent()`

### getLastSegment

    public Path.Segment getLastSegment()

  Get the last segment in this path.

  Specified by:
    `getLastSegment` in interface `Path`
  Overrides:
    `getLastSegment` in class `AbstractPath`
  Returns:
    the last segment, or null if the path is empty
  See Also:
    `Path.getLastSegment()`

### getParent

    public 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.

  Specified by:
    `getParent` in interface `Path`
  Overrides:
    `getParent` in class `AbstractPath`
  Returns:
    the parent path, or this null if it is already the root
  See Also:
    `Path.getParent()`

### getSegment

    public Path.Segment getSegment(int index)

  Get the segment at the supplied index.

  Specified by:
    `getSegment` in interface `Path`
  Overrides:
    `getSegment` in class `AbstractPath`
  Parameters:
    `index` - the index
  Returns:
    the segment
  See Also:
    `Path.getSegment(int)`

### getSegmentsList

    public List<Path.Segment> getSegmentsList()

  Get an unmodifiable list of the path segments.

  Returns:
    the unmodifiable list of path segments; never null
  See Also:
    `Path.getSegmentsList()`

### hasSameAncestor

    public 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.

  Specified by:
    `hasSameAncestor` in interface `Path`
  Overrides:
    `hasSameAncestor` in class `AbstractPath`
  Parameters:
    `that` - the other path
  Returns:
    true if this path and the supplied path have the same immediate ancestor.
  See Also:
    `Path.hasSameAncestor(org.modeshape.graph.property.Path)`

### isAbsolute

    public boolean isAbsolute()

  Return whether this path is an absolute path. A path is either relative or `absolute`. An absolute path starts with a "/".

  Returns:
    true if the path is absolute, or false otherwise
  See Also:
    `Path.isAbsolute()`

### isAtOrBelow

    public 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)`.

  Specified by:
    `isAtOrBelow` in interface `Path`
  Overrides:
    `isAtOrBelow` in class `AbstractPath`
  Parameters:
    `other` - the other path to compare with this path; may be null
  Returns:
    true if the paths are equivalent or if this path is considered a decendant of the other path, or false otherwise
  See Also:
    `Path.isAtOrBelow(org.modeshape.graph.property.Path)`

### isDecendantOf

    public 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.

  Specified by:
    `isDecendantOf` in interface `Path`
  Overrides:
    `isDecendantOf` in class `AbstractPath`
  Parameters:
    `ancestor` - the path that may be the ancestor; may be null
  Returns:
    true if this path is an decendant of the supplied path, or false otherwise
  See Also:
    `Path.isDecendantOf(org.modeshape.graph.property.Path)`

### isNormalized

    public boolean isNormalized()

  Return whether this path is normalized and contains no unnecessary "." segments and as few ".." segments as possible. For example, the path "../a" is normalized, while "/a/b/c/../d" is not normalized.

  Returns:
    true if this path is normalized, or false otherwise
  See Also:
    `Path.isNormalized()`

### isRoot

    public boolean isRoot()

  Return whether this path represents the root path.

  Returns:
    true if this path is the root path, or false otherwise
  See Also:
    `Path.isRoot()`

### iterator

    public Iterator<Path.Segment> iterator()

  Specified by:
    `iterator` in interface `Iterable<Path.Segment>`
  Specified by:
    `iterator` in interface `Path`
  Overrides:
    `iterator` in class `AbstractPath`
  See Also:
    `Path.iterator()`

### size

    public int size()

  Return the number of segments in this path.

  Returns:
    the number of path segments
  See Also:
    `Path.size()`

### subpath

    public Path subpath(int beginIndex,
                        int endIndex)

  Return a new path consisting of the segments between the `beginIndex` index (inclusive) and the `endIndex` index (exclusive).

  Specified by:
    `subpath` in interface `Path`
  Overrides:
    `subpath` in class `AbstractPath`
  Parameters:
    `beginIndex` - the beginning index, inclusive.
    `endIndex` - the ending index, exclusive.
  Returns:
    the specified subpath
  See Also:
    `Path.subpath(int, int)`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.