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

com.cookingfox.lapasse.api.state.observer.StateObserver Maven / Gradle / Ivy

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

import com.cookingfox.lapasse.api.state.State;

/**
 * Observes the state object.
 *
 * @param  The concrete type of the state object.
 */
public interface StateObserver {

    /**
     * Add listener for when the state changed.
     *
     * @param listener The listener to notify when the state changes.
     */
    void addStateChangedListener(OnStateChanged listener);

    /**
     * Returns the current state.
     *
     * @return The current state.
     */
    S getCurrentState();

    /**
     * Remove previously added state changed listener.
     *
     * @param listener The listener to remove.
     */
    void removeStateChangedListener(OnStateChanged listener);

}