Files
ITMO/general/src/main/kotlin/elements/Coordinates.kt
T
LeterZP 1d57fb83a4 Squashed 'Programming/ProgLab6/' content from commit 3e98b8e
git-subtree-dir: Programming/ProgLab6
git-subtree-split: 3e98b8e205b1a576c861f90028b198d5052a79c3
2026-05-17 15:29:12 +03:00

28 lines
967 B
Kotlin
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package elements
import exceptions.InvalidElementValueException
import kotlinx.serialization.Serializable
/**
* Координаты для города [City].
*
* @param x Координата по оси X типа [Int] больше -827.
* @param y Координата по оси Y типа [Double].
*
* @throws InvalidElementValueException В случае, если координаты не соответствуют необходимым требованиям.
*
* @constructor Принимает все указанные выше параметры, создавая готовый к использованию
* объект с заданными координатами.
*
* @since 1.0
*/
@Serializable
class Coordinates(private val x: Int, private val y: Double) {
init{
if(x <= -827) throw InvalidElementValueException(x)
}
override fun toString(): String {
return "x = $x, y = $y"
}
}