@@ -0,0 +1,1542 @@
+package info.izumin.android.droidux;%0A%0Aimport android.databinding.Bindable;%0A%0Aimport info.izumin.android.droidux.action.HistoryAction;%0A%0A/**%0A * Created by izumin on 11/25/15.%0A */%0Apublic abstract class UndoableStore%3CT extends UndoableState%3CT%3E%3E extends Store%3CT%3E %7B%0A    public static final String TAG = UndoableStore.class.getSimpleName();%0A%0A    private final History%3CT%3E history;%0A%0A    protected UndoableStore(Builder builder, T initialState) %7B%0A        super(builder);%0A        history = new History%3C%3E(initialState);%0A    %7D%0A%0A    @Override%0A    protected void dispatchToReducer(Action action) %7B%0A        if (HistoryAction.class.isAssignableFrom(action.getClass())) %7B%0A            HistoryAction historyAction = (HistoryAction) action;%0A            if (((HistoryAction) action).isAssignableTo(this)) %7B%0A                setStateWithoutKeepingHistory(historyAction.handle(history));%0A            %7D%0A        %7D%0A    %7D%0A%0A    protected void setStateWithoutKeepingHistory(T state) %7B%0A        super.setState(state);%0A    %7D%0A%0A    @Override%0A    protected void setState(T state) %7B%0A        history.insert(state);%0A        super.setState(state);%0A    %7D%0A%0A    @Override%0A    @Bindable%0A    public T getState() %7B%0A        return history.getPresent();%0A    %7D%0A%0A    public History%3CT%3E getHistory() %7B%0A        return history;%0A    %7D%0A%0A    @Bindable%0A    public boolean isUndoable() %7B%0A        return history.isUndoable();%0A    %7D%0A%0A    @Bindable%0A    public boolean isRedoable() %7B%0A        return history.isRedoable();%0A    %7D%0A%0A    public void setLimit(int limit) %7B%0A        history.setLimit(limit);%0A    %7D%0A%7D%0A

Add UndoableStore