@Test public void isRoot() throws Exception { ListTreeNode<String> root = new ListTreeNode<>("root"); assertTrue("isRoot", root.isRoot()); ListTreeNode<String> child = new ListTreeNode<>("child"); root.addChild(child); assertFalse("isRoot", child.isRoot()); }
@Override public boolean isRoot() { return parent == null; }
ListTreeNode implements TreeNode<T> { @Override public boolean isRoot() { return parent == null; } }
ListTreeNode implements TreeNode<T> { @Override public boolean isRoot() { return parent == null; } ListTreeNode(T label); }
ListTreeNode implements TreeNode<T> { @Override public boolean isRoot() { return parent == null; } ListTreeNode(T label); @Override T getLabel(); @Override Iterable<TreeNode<T>> children(); @Override int getLevel(); @Override int getChildCount(); @Override TreeNode<T> getParent(); @Override TreeNode<T> setParent(TreeNode<T> parent); @Override ListTreeNode<T> addChild(TreeNode<T> child); @Override boolean isRoot(); @Override NodeTraversal<T> breadthFirstTraversal(); @Override boolean isLeaf(); @Override String toString(); }
ListTreeNode implements TreeNode<T> { @Override public boolean isRoot() { return parent == null; } ListTreeNode(T label); @Override T getLabel(); @Override Iterable<TreeNode<T>> children(); @Override int getLevel(); @Override int getChildCount(); @Override TreeNode<T> getParent(); @Override TreeNode<T> setParent(TreeNode<T> parent); @Override ListTreeNode<T> addChild(TreeNode<T> child); @Override boolean isRoot(); @Override NodeTraversal<T> breadthFirstTraversal(); @Override boolean isLeaf(); @Override String toString();  }