File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
src/main/kotlin/entity/zone Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (c) 2023. Smart Operating Block
3
+ *
4
+ * Use of this source code is governed by an MIT-style
5
+ * license that can be found in the LICENSE file or at
6
+ * https://opensource.org/licenses/MIT.
7
+ */
8
+
9
+ package entity.zone
10
+
11
+ /* *
12
+ * It describes a zone inside the Operating block.
13
+ * Each zone is identified by an [id] and described
14
+ * by a [name] and a [description].
15
+ */
16
+ data class Zone (
17
+ val id : ZoneID ,
18
+ val name : String ,
19
+ val description : String ,
20
+ ) {
21
+ init {
22
+ require(this .name.isNotEmpty())
23
+ require(this .description.isNotEmpty())
24
+ }
25
+
26
+ override fun equals (other : Any? ): Boolean = when {
27
+ other == = this -> true
28
+ other is Zone -> this .id == other.id
29
+ else -> false
30
+ }
31
+
32
+ override fun hashCode (): Int = this .id.hashCode()
33
+ }
34
+
35
+ /* *
36
+ * It represents the Operating Block zone ID [value].
37
+ */
38
+ data class ZoneID (val value : String ) {
39
+ init {
40
+ // Constructor validation: the id must not be empty
41
+ require(this .value.isNotEmpty())
42
+ }
43
+ }
You can’t perform that action at this time.
0 commit comments