Skip to content

Commit

Permalink
Add option to TernaryTreeDictionary command line to show tree node de…
Browse files Browse the repository at this point in the history
…pth histogram.
  • Loading branch information
amichair committed Feb 11, 2019
1 parent 887734d commit 4b1eb48
Showing 1 changed file with 6 additions and 0 deletions.
Expand Up @@ -165,6 +165,7 @@ public static void main(final String[] args)
boolean partialSearch = false;
boolean nearSearch = false;
boolean print = false;
boolean stats = false;

// operation parameters
String word = null;
Expand All @@ -187,6 +188,8 @@ public static void main(final String[] args)
distance = Integer.parseInt(args[++i]);
} else if ("-p".equals(args[i])) {
print = true;
} else if ("-st".equals(args[i])) {
stats = true;
} else if ("-h".equals(args[i])) {
throw new ArrayIndexOutOfBoundsException();
} else {
Expand Down Expand Up @@ -228,6 +231,9 @@ public static void main(final String[] args)
Arrays.asList(matches)));
} else if (print) {
dict.getTernaryTree().print(new PrintWriter(System.out, true));
} else if (stats) {
System.out.println("word path depths histogram:");
System.out.println(dict.getTernaryTree().getNodeStats());
} else {
throw new ArrayIndexOutOfBoundsException();
}
Expand Down

0 comments on commit 4b1eb48

Please sign in to comment.