Demo of full-path node name
insertInPath() uses setData()
Dynamic node names
New tests following mutation testing
Tidy the Node interface
Named nodes
Update code style
Drop lombok in production (still using it in test)
Demo of full-path node name
insertInPath() uses setData()
Dynamic node names
New tests following mutation testing
Tidy the Node interface
Named nodes
Update code style
Drop lombok in production (still using it in test)
Where an empty node is already found in the tree where we want to insert
a node, use the setData() method to place the data. This replaces the
previous process of attempting to swapping in the new node.
Previously the name was set when the node was created and only a call to
setName() would have changed it.
isNamed() uses the generated name, so this may change if the generated name
is even null or the empty string.
removeChild(node): removes the node from children of the current node,
making the child node into a new root node.
removeParent(): removes the current from from it's parent's children,
making itself into a new root node.
Both methods look for a child with the given name as an immediate child of
the current node.
findChildNamed:
Will return an Optional containing the found node or empty.
getChildNames:
Is more insistent and will return the found node itself. If a node by that
name is not found, then a NodeException will be thrown.
Names, where present, must be unique for each parent.
Node:
* String getName()
* void setName(String name)
* boolean isNamed()
NodeItem - replaces all constructor:
* (data)
* (data, name)
* (data, nameSupplier)
* (data, parent)
* (data, nameSupplier, parent)
The name supplier takes a node and generates a string at the time the node
is constructed. The root node has a default name supplier that returns null
which means that the node is considered unnamed. Other nodes may provide
their own name supplier that would be used be new nodes created within
their subtree.