StateBuilder(val name:String) { private val events = mutableMapOf<String, EventBuilder>() infix fun String.transitTo(to:String): EventBuilder { val eventBuilder = EventBuilder(this, to) events[this]= eventBuilder return eventBuilder
} fun build() = State(name, events.map { it.key to it.value.build() }.toMap())
}
String型の拡張関数