All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cookingfox.lapasse.api.state.manager.StateManager Maven / Gradle / Ivy

There is a newer version: 0.5.6
Show newest version
package com.cookingfox.lapasse.api.state.manager;

import com.cookingfox.lapasse.api.event.Event;
import com.cookingfox.lapasse.api.lifecycle.Disposable;
import com.cookingfox.lapasse.api.state.State;
import com.cookingfox.lapasse.api.state.observer.StateObserver;

/**
 * Manages the state object.
 *
 * @param  The concrete type of the state object.
 */
public interface StateManager extends Disposable, StateObserver {

    /**
     * Validate and set a new state object. Notifies listeners if the new state is different from
     * the previous state.
     *
     * @param newState The new state object to set.
     * @param event    The event that triggered the state change.
     */
    void handleNewState(S newState, Event event);

}