package com.m3rcuriel.controve.api;

import com.m3rcuriel.controve.retrievable.Retrievable;
import com.m3rcuriel.controve.retrievable.StateHolder;

public abstract class StateControllerBase<T extends CommandsBase, K extends RobotSetpointsBase>
    implements Retrievable {

  protected Routine<T, K> currentRoutine = null;
  protected RobotSetpointsBase setpoints;

  private void setNewRoutine(Routine<T, K> newRoutine) {
    boolean needsCancel = newRoutine != currentRoutine && currentRoutine != null;

    boolean needsReset = newRoutine != currentRoutine && newRoutine != null;
    if (needsCancel) {
      currentRoutine.cancel();
    }
    currentRoutine = newRoutine;
    if (needsReset) {
      currentRoutine.reset();
    }
  }

  public void reset() {
    setNewRoutine(null);
  }

  public abstract void update(CommandsBase commands);

  @Override
  public void getState(StateHolder states) {
    states.put("mode", currentRoutine != null ? currentRoutine.getName() : "---");
  }

  @Override
  public String getName() {
    return "state controller";
  }
}

@@ -240,35 +240,8 @@
 ase%3E
-%0A    implements Retrievable
  %7B%0A%0A
@@ -301,34 +301,17 @@
 otected 
-RobotSetpointsBase
+K
  setpoin
@@ -776,251 +776,19 @@
 ate(
-CommandsBase commands);%0A%0A  @Override%0A  public void getState(StateHolder states) %7B%0A    states.put(%22mode%22, currentRoutine != null ? currentRoutine.getName() : %22---%22);%0A  %7D%0A%0A  @Override%0A  public String getName() %7B%0A    return %22state controller%22;%0A  %7D
+T commands);
 %0A%7D%0A

Fix type errors in StateControllerBase.java