23 lines
603 B
Kotlin
23 lines
603 B
Kotlin
|
package net.shadowfacts.asmr.program.blocks
|
||
|
|
||
|
import net.shadowfacts.asmr.program.ProgramBlock
|
||
|
import net.shadowfacts.asmr.program.ProgramBlockInput
|
||
|
import net.shadowfacts.asmr.program.ProgramBlockOutput
|
||
|
import net.shadowfacts.asmr.program.ProgramType
|
||
|
|
||
|
/**
|
||
|
* @author shadowfacts
|
||
|
*/
|
||
|
class ConstantBlock<Type: Any>(
|
||
|
val type: ProgramType<Type>,
|
||
|
val value: Type
|
||
|
): ProgramBlock {
|
||
|
|
||
|
val output = ProgramBlockOutput(type).apply {
|
||
|
value = this@ConstantBlock.value
|
||
|
}
|
||
|
|
||
|
override val inputs: Array<ProgramBlockInput<*>> = arrayOf()
|
||
|
override val outputs: Array<ProgramBlockOutput<*>> = arrayOf(output)
|
||
|
|
||
|
}
|