95f6e6b182f973012777c3127fd762a6b9e1c5d6
[rhynodge.git] / src / main / kotlin / net / pterodactylus / rhynodge / mergers / LastStateMerger.kt
1 package net.pterodactylus.rhynodge.mergers
2
3 import net.pterodactylus.rhynodge.Merger
4 import net.pterodactylus.rhynodge.State
5
6 /**
7  * [Merger] implementation that always returns the current state.
8  */
9 class LastStateMerger : Merger {
10
11         override fun mergeStates(previousState: State, currentState: State) = AlwaysTriggeringState(currentState)
12
13         class AlwaysTriggeringState(state: State) : State by state {
14                 override fun triggered() = true
15         }
16
17 }