vt-middleware / passay

Password policy enforcement for Java.
http://www.passay.org
Other
282 stars 64 forks source link

Ternary Tree print improvements #84

Closed amichair closed 5 years ago

amichair commented 5 years ago

Ternary Tree had some bugs in its printing implementation, like not printing the complete tree (or not printing at all small trees) on some platforms, first-level indentation was wrong (some second-level nodes appeared at the same indentation of the root node), etc.

Also optimized it to use a single StringBuilder instead of creating a whole lot of them, made the code shorter and cleaner, added command line option to print the full path on every line (easier for some analyses, and useful to see full words and not just their suffix), added indication of words ending in the middle of a path (prefix of other words), and changed the chars and spacing to make the printout look more like a standard tree diagram.

This helped me in analysing and understanding later modifications and their effect on the tree structure, correctness and performance.

dfish3r commented 5 years ago

Looks good. Just had one trivial comment.

amichair commented 5 years ago

Thanks!

Updated the usage, hope the wording is ok.