further cleanup

This commit is contained in:
Miwa / Ensan
2024-03-17 10:46:23 +09:00
parent f4e48610a3
commit 09914f919b
2 changed files with 11 additions and 8 deletions

View File

@ -58,13 +58,7 @@ struct InputGraph {
self.nextCorrectNodeIndices[newIndex] = correctGraph.allowedNextIndex[nodeIndex]
//
let startNode = switch cgNode.inputStyle {
case .systemFlickDirect:
ReplaceSuffixTree.direct
case .systemRomanKana:
ReplaceSuffixTree.roman2kana
default: fatalError("implement it")
}
let startNode = InputGraphInputStyle.init(from: cgNode.inputStyle).replaceSuffixTree
// nodes
typealias SearchItem = (
suffixTreeNode: ReplaceSuffixTree.Node,

View File

@ -51,7 +51,16 @@ struct InputGraphInputStyle: Identifiable {
}
}
init(id: InputGraphInputStyle.ID, replaceSuffixTree: ReplaceSuffixTree.Node, correctPrefixTree: CorrectPrefixTree.Node) {
init(from id: InputGraphInputStyle.ID) {
self = switch id {
case .all: .all
case .systemFlickDirect: .systemFlickDirect
case .systemRomanKana: .systemRomanKana
default: fatalError("Unimplemented")
}
}
private init(id: InputGraphInputStyle.ID, replaceSuffixTree: ReplaceSuffixTree.Node, correctPrefixTree: CorrectPrefixTree.Node) {
self.id = id
self.replaceSuffixTree = replaceSuffixTree
self.correctPrefixTree = correctPrefixTree