update

abstract fun update(newState: S): V

Updates this value to a new state.

This method creates a new instance of the value with the specified state. The implementation should ensure that the new state is valid according to the state machine's rules.

Return

A new instance of the value with the updated state

Parameters

newState

The state to transition to