Tree types
- Java 99.9%
- CSS 0.1%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .forgejo | ||
| com.io7m.jorchard.core | ||
| com.io7m.jorchard.generators | ||
| com.io7m.jorchard.tests | ||
| src/site/resources | ||
| .gitignore | ||
| .gitmodules | ||
| doc7m-books.json | ||
| pom.xml | ||
| README-CHANGES.xml | ||
| README-LICENSE.txt | ||
| README.in | ||
| README.md | ||
jorchard
jorchard
A generic unbalanced rose tree implementation.
Features
- Generic, mutable rose trees.
- High coverage test suite.
- OSGi-ready
- JPMS-ready
- ISC license.
Usage
Assuming an arbitrary type T, create a tree with a root value of x of
type T:
var t = JOTreeNode.create(x);
Add nodes to the tree:
var t0 = JOTreeNode.create(y0);
var t1 = JOTreeNode.create(y1);
var t2 = JOTreeNode.create(y2);
t0.setParent(t);
t1.setParent(t);
t2.setParent(t);
Iterate over the tree:
t.forEachDepthFirst(order, (input, depth, node) -> {
// ...
});
t.forEachBreadthFirst(order, (input, depth, node) -> {
// ...
});
Detach nodes from the tree:
t2.detach();
