Created
March 30, 2020 09:27
-
-
Save mig35/4ea7d70ef8fc340e82ac12f747b3417c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class SingleStrategy : ExecutionStrategy { | |
override fun shouldAddToPendingActions( | |
pendingActionCommands: RemoveOnlyList<ActionCommand<*, *>>, | |
runningActionCommands: List<ActionCommand<*, *>> | |
): Boolean = | |
!pendingActionCommands.any { it.strategy is SingleStrategy } | |
&& !runningActionCommands.any { it.strategy is SingleStrategy } | |
override fun shouldBlockOtherTask(pendingActionCommand: ActionCommand<*, *>): Boolean = | |
true | |
override fun shouldExecuteAction( | |
pendingActionCommands: RemoveOnlyList<ActionCommand<*, *>>, | |
runningActionCommands: List<ActionCommand<*, *>> | |
): Boolean = | |
runningActionCommands.isEmpty() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment