22 lines
817 B
Kotlin
22 lines
817 B
Kotlin
package commands
|
|
|
|
import collection.CollectionManager
|
|
import kotlinx.serialization.Contextual
|
|
import kotlinx.serialization.Serializable
|
|
import models.HumanBeing
|
|
import network.Response
|
|
|
|
/**
|
|
* Выводит сумму значений поля [models.HumanBeing.minutesOfWaiting].
|
|
*/
|
|
@Serializable
|
|
class SumOfMinutesCommand(@Contextual private val manager: CollectionManager) : Command {
|
|
override val name = "sum_of_minutes_of_waiting"
|
|
override val description = "вывести сумму minutesOfWaiting всех элементов"
|
|
override val type = CommandType.SIMPLE
|
|
override val args = listOf(CommandArgType.NONE)
|
|
|
|
override fun execute(args: List<String>, humanBeing: HumanBeing?): Response =
|
|
Response(true, "Сумма minutesOfWaiting: ${manager.sumOfMinutesOfWaiting()}")
|
|
}
|