Skip to content

Commit

Permalink
empty * case enhancement
Browse files Browse the repository at this point in the history
  • Loading branch information
homuhe committed Dec 4, 2016
1 parent b0d068d commit 0ee4455
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/scala/com/ir/Trie.scala
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,8 @@ object Trie {
if (input.forall(char => (char - 97) >= 0 && (char - 97) < 25 || char == '*')) {

if (input.count(_ == '*') == 1) {
if (trie.contains(input.filter(_ != '*'))) //empty '*' case
if (trie.contains(input.filter(_ != '*')) && input.startsWith("*") //empty '*' case
|| input.endsWith("*"))
println(input.filter(_ != '*'))
query(input).foreach(println)
}
Expand Down

0 comments on commit 0ee4455

Please sign in to comment.