public void runWorkflow() {
    State curState = State.Initial1;
    IntWrapper x = null;
    BooleanWrapper b = null;

    while (true) {
      switch (curState) {
        case State1:
          C2.Task2();
          curState = State.State2;
          break;
        case Initial1:
          x = C1.Task1();
          curState = State.State1;
          break;
        case State2:
          b = C3.Validate(x.intValue());
          curState = State.State3;
          break;
        case State3:
          return;
        case State4:
          return;
        default:
          return;
      }
    }
  }