mirror of
https://github.com/ZhigalskiiIvan/TextStatisticsProject.git
synced 2024-11-22 07:11:52 +03:00
command center logic commit
This commit is contained in:
parent
39ac71d76d
commit
67c7a9dc6c
@ -1,3 +1,8 @@
|
|||||||
|
import java.util.Scanner
|
||||||
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
val scanner = Scanner(System.`in`)
|
||||||
|
|
||||||
object StatisticBuilder {
|
object StatisticBuilder {
|
||||||
|
|
||||||
fun buildGraphic() {}
|
fun buildGraphic() {}
|
||||||
@ -22,7 +27,9 @@ class TextData() {
|
|||||||
object TextAnalyzer {
|
object TextAnalyzer {
|
||||||
private val DELIMITERS = listOf('.', '!', '?')
|
private val DELIMITERS = listOf('.', '!', '?')
|
||||||
|
|
||||||
fun returnListOfSentences(text: Text): List<Text.Sentence> { TODO() }
|
fun returnListOfSentences(text: Text): List<Text.Sentence> {
|
||||||
|
TODO()
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,20 +48,35 @@ class TextData() {
|
|||||||
|
|
||||||
object CommandCenter {
|
object CommandCenter {
|
||||||
|
|
||||||
enum class Commands(val commandName: String, val executingFun: (Any) -> Any) {
|
private enum class Commands(val executingFun: () -> Unit) {
|
||||||
Exit("exit", TODO()),
|
EXIT({
|
||||||
Add("add", TODO())
|
println("bye!")
|
||||||
|
exitProcess(0)
|
||||||
|
}),
|
||||||
|
ADD_TEXT({ println("add") }),
|
||||||
|
SHOW_STATISTICS({ println("sow") }),
|
||||||
|
REMOVE_TEXT({ println("remove") })
|
||||||
}
|
}
|
||||||
|
|
||||||
fun readCommandFromConsole() {}
|
fun readCommandFromConsole(): () -> Unit {
|
||||||
|
println("Input one Of the commands: ${Commands.values().joinToString { it.name.lowercase() }}:")
|
||||||
|
val funNameInUpCase = scanner.nextLine().uppercase()
|
||||||
|
|
||||||
|
return if (funNameInUpCase in Commands.values().map { it.name })
|
||||||
|
Commands.valueOf(funNameInUpCase).executingFun
|
||||||
|
else ::readCommandFromConsole
|
||||||
|
}
|
||||||
|
|
||||||
fun executeCommand() {}
|
fun executeCommand() {}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fun main(args: Array<String>) {
|
fun main() {
|
||||||
|
|
||||||
mainCycle@ while (true) {
|
mainCycle@ while (true) {
|
||||||
|
|
||||||
|
(CommandCenter.readCommandFromConsole())()
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user