We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 57a9594 commit 045ec59Copy full SHA for 045ec59
interfaces/src/main/kotlin/com/noxcrew/interfaces/grid/ChainGridPositionGenerator.kt
@@ -0,0 +1,20 @@
1
+package com.noxcrew.interfaces.grid
2
+
3
+/** A grid position generator that chains together two other generators. */
4
+public data class ChainGridPositionGenerator(
5
+ /** The first generator. */
6
+ private val first: GridPositionGenerator,
7
+ /** The second generator. */
8
+ private val second: GridPositionGenerator,
9
+) : GridPositionGenerator {
10
11
+ public companion object {
12
+ /** Adds two grid position generators together. */
13
+ public operator fun GridPositionGenerator.plus(second: GridPositionGenerator): ChainGridPositionGenerator =
14
+ ChainGridPositionGenerator(this, second)
15
+ }
16
17
+ override fun generate(): List<GridPoint> {
18
+ return first.generate() + second.generate()
19
20
+}
0 commit comments