Skip to content

Instantly share code, notes, and snippets.

@ikovalyov
Last active March 31, 2020 22:36
Show Gist options
  • Save ikovalyov/ce093672bf99f93dc17718e5c533c4be to your computer and use it in GitHub Desktop.
Save ikovalyov/ce093672bf99f93dc17718e5c533c4be to your computer and use it in GitHub Desktop.
sealed class State(val previousState: State?) {
class RequestReceived(val request: Int): State(null)
class RequestValidated(val validationResult: Boolean, previousState: RequestReceived): State(previousState)
class RequestProcessed(val response: Int, previousState: RequestValidated): State(previousState)
class ResponseValidated(val validationResult: Boolean, previousState: RequestProcessed): State(previousState)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment