public void setFinal ( Path path ) { // Step through the nodes creating any nodes which don't exist. Node currentNode = root ; for ( Term t : path . getTerms ( ) ) { Node nextNode = currentNode . getChild ( t ) ; if ( nextNode == null ) { nextNode = currentNode . newChild ( t ) ; } currentNode = nextNode ; } // The current node is now the one corresponding to the last term in the // path. Set this as final. currentNode . setFinal ( ) ; }
Mark the given Path as being final .