/** * Create a {@link MobiusLoop.Controller} that allows you to start, stop, and restart MobiusLoops. * * @param loopFactory a factory for creating loops * @param defaultModel the model the controller should start from * @param modelRunner the WorkRunner to use when observing model changes * @return a new controller */ public static <M, E, F> MobiusLoop.Controller<M, E> controller( MobiusLoop.Factory<M, E, F> loopFactory, M defaultModel, WorkRunner modelRunner) { return new MobiusLoopController<>(loopFactory, defaultModel, modelRunner); }
/** * Create a {@link MobiusLoop.Controller} that allows you to start, stop, and restart MobiusLoops. * * @param loopFactory a factory for creating loops * @param defaultModel the model the controller should start from * @param modelRunner the WorkRunner to use when observing model changes * @return a new controller */ public static <M, E, F> MobiusLoop.Controller<M, E> controller( MobiusLoop.Factory<M, E, F> loopFactory, M defaultModel, WorkRunner modelRunner) { return new MobiusLoopController<>(loopFactory, defaultModel, modelRunner); }
/** * Create a {@link MobiusLoop.Controller} that allows you to start, stop, and restart MobiusLoops. * * @param loopFactory a factory for creating loops * @param defaultModel the model the controller should start from * @return a new controller */ public static <M, E, F> MobiusLoop.Controller<M, E> controller( MobiusLoop.Factory<M, E, F> loopFactory, M defaultModel) { return new MobiusLoopController<>(loopFactory, defaultModel, WorkRunners.immediate()); }
/** * Create a {@link MobiusLoop.Controller} that allows you to start, stop, and restart MobiusLoops. * * @param loopFactory a factory for creating loops * @param defaultModel the model the controller should start from * @return a new controller */ public static <M, E, F> MobiusLoop.Controller<M, E> controller( MobiusLoop.Factory<M, E, F> loopFactory, M defaultModel) { return new MobiusLoopController<>(loopFactory, defaultModel, WorkRunners.immediate()); }
private MobiusLoopController<String, String, String> createWithWorkRunner( WorkRunner mainThreadRunner) { return new MobiusLoopController<>( Mobius.<String, String, String>loop( (model, event) -> Next.next(model + event), effectHandler) .eventRunner(WorkRunners::immediate) .effectRunner(WorkRunners::immediate), "init", mainThreadRunner); }