class WorkerState implements RoleState {

        private ClusterRole clusterRole;
        private int clock;

        public WorkerState(ClusterRole clusterRole) {
            this.clusterRole = clusterRole;
            this.clock = 0;
        }

        @Override
        public RoleState transform(StateMachineContext context) {
            RoleState.heartBeatPark(context);
            RoleState nextState = new UnknownState(this.clusterRole.epoch()).transform(context);
            if (nextState instanceof WorkerState) {
                this.merge((WorkerState) nextState);
                if (this.clock > context.config().masterDeadTimes()) {
                    return new CandidateState(this.clusterRole.epoch() + 1);
                } else {
                    return this;
                }
            } else {
                return nextState;
            }
        }

        @Override
        public Callback callback(RoleListener callback) {
            return callback::onAsRoleWorker;
        }

        public void merge(WorkerState state) {<FILL_FUNCTION_BODY>}
    }

            if (state.clusterRole.epoch() > this.clusterRole.epoch()) {
                this.clock = 0;
                this.clusterRole = state.clusterRole;
            } else if (state.clusterRole.epoch() < this.clusterRole.epoch()) {
                throw new IllegalStateException("Epoch must increase");
            } else if (state.clusterRole.epoch() == this.clusterRole.epoch() &&
                       state.clusterRole.clock() < this.clusterRole.clock()) {
                throw new IllegalStateException("Clock must increase");
            } else if (state.clusterRole.epoch() == this.clusterRole.epoch() &&
                       state.clusterRole.clock() > this.clusterRole.clock()) {
                this.clock = 0;
                this.clusterRole = state.clusterRole;
            } else {
                this.clock++;
            }
        
<no_super_class>