-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
See commit: aecf003
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.wax911.emojify.util.tree | ||
|
||
import io.wax911.emojify.model.Emoji | ||
import java.util.HashMap | ||
|
||
/** | ||
* Node representation of an emoji tree | ||
* | ||
* @see io.wax911.emojify.util.EmojiTree | ||
*/ | ||
class Node { | ||
private val children = HashMap<Char, Node>() | ||
|
||
internal var emoji: Emoji? = null | ||
|
||
internal val isEndOfEmoji: Boolean | ||
get() = emoji != null | ||
|
||
internal fun hasChild(child: Char): Boolean { | ||
return children.containsKey(child) | ||
} | ||
|
||
internal fun addChild(child: Char) { | ||
children[child] = Node() | ||
} | ||
|
||
internal fun getChild(child: Char): Node? { | ||
return children[child] | ||
} | ||
} |