= TreePath
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Provides an unambiguous way to address nodes by position within a tree-structure. Examples:

* /0 ... the tree root
* /0/1 ... the second child of root
* /0/0/0 ... the first child of first child of root

== API

[source,java]
.TreePath.java
----
interface TreePath {
  TreePath append(int indexWithinSiblings)     // <.>
  TreePath getParentIfAny()     // <.>
  boolean isRoot()
  IntStream streamPathElements()
  String stringify(String delimiter)
  Stream<TreePath> streamUpTheHierarchyStartingAtSelf()
  TreePath of(int... canonicalPath)
  TreePath root()
  TreePath parse(String treePathStringified, String delimiter)     // <.>
}
----

<.> xref:#append_int[append(int)]
<.> xref:#getParentIfAny_[getParentIfAny()]
+
--
Returns a TreePath instance that represents the parent path of this TreePath, if this is not the root.
--
<.> xref:#parse_String_String[parse(String, String)]
+
--
Parses stringified tree path of format _031_ ..., as returned by _TreePath#stringify(String)_ .
--

== Members

[#append_int]
=== append(int)

[#getParentIfAny_]
=== getParentIfAny()

Returns a TreePath instance that represents the parent path of this TreePath, if this is not the root.

[#parse_String_String]
=== parse(String, String)

Parses stringified tree path of format _031_ ..., as returned by _TreePath#stringify(String)_ .

For null or empty input the root is returned.
