-
Notifications
You must be signed in to change notification settings - Fork 14
/
Prototype.kt
31 lines (28 loc) · 932 Bytes
/
Prototype.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.vld.sdp.creational
/**
* Cell Product and Prototype interface
*/
interface CellPrototype {
val membrane: String
val ribosomes: Int
/**
* Clones a new [CellPrototype] instance from the actual prototype
*/
fun clone(): CellPrototype
}
/**
* Prokaryote Cell Product and Prototype interface implementation
*
* Data class automatically generates the `copy()` method which is used for prototypical cloning
*/
data class ProkaryoteCell(override val membrane: String, override val ribosomes: Int) : CellPrototype {
override fun clone(): CellPrototype = copy()
}
/**
* Eukaryote Cell Product and Prototype interface implementation
*
* Data class automatically generates the `copy()` method which is used for prototypical cloning
*/
data class EukaryoteCell(override val membrane: String, override val ribosomes: Int) : CellPrototype {
override fun clone(): CellPrototype = copy()
}