code: public boolean isFinal(Path path) {
  
  		// Step through the nodes based on the given path. If any intermediate
  		// nodes are marked as final, we can just return true.
  		Node currentNode = root;
  		for (Term t : path.getTerms()) {
  			Node nextNode = currentNode.getChild(t);
  			if (nextNode == null) {
  				return false;
  			} else if (nextNode.isFinal()) {
  				return true;
  			}
  			currentNode = nextNode;
  		}
  
  		// If we've made it to here, then the current node is the one which
  		// corresponds to the last element in the path. Return true if it is
  		// marked as final or it has any descendants.
  		return currentNode.isFinal() || currentNode.hasChild();
  	}
docs: Determine if the given path is marked as final. The path is final if the
  path or any parent is marked as final or the full path has descendants
  which are marked as final. If the path is final, then the
  getFinalReason() method should be called to determine why.
  
  @param path
  Path to check
  
  @return boolean indicating if the Path is final