/*
!=======================================================================
!
!  PROGRAM  PHASE-Viewer  (PHASE-Viewer 2014.01 ver.3.3.0)
!
!  Created on 2005/09/27, 14:16
!  AUTHOR(S): KOGA, Junichiro
!  File : UndoRedoEvent.java
!  
!  Contact address :  Phase System Consortium
!                     E-mail: phase_system@nims.go.jp URL https://azuma.nims.go.jp
!
!
!   Since 2002, this program set had been intensively developed as a part of the following 
!  national projects supported by the Ministry of Education, Culture, Sports, Science and
!  Technology (MEXT) of Japan; "Frontier Simulation Software for Industrial Science
!  (FSIS)" from 2002 to 2005, "Revolutionary Simulation Software (RSS21)" from 2006 to
!  2008. "Research and Development of Innovative Simulation Software (RISS)" from 2008
!  to 2013. These projects is lead by the Center for Research on Innovative Simulation 
!  Software (CISS), the Institute of Industrial Science (IIS), the University of Tokyo.
!   Since 2013, this program set has been further developed centering on PHASE System
!  Consortium. 
!   The activity of development of this program set has been supervised by Takahisa Ohno.
!
!=======================================================================
 */

package ciss.phase_viewer.inputinterface;

/**
 * Undo/Redoに関わるイベント.
 * 
 * @author
 */
public class UndoRedoEvent {
    public static int UNDO = 0;
    public static int REDO = 1;
    public static int STACK_UPDATE = 2;

    private int state = UNDO;
    private InputInterface inputInterface;
    private int undoStackCount;
    private int redoStackCount;
    private InputInterfaceEntry entry;

    /**
     * Creates a new instance of UndoRedoEvent
     * 
     * @param state
     *            このイベントの状態を指定する. UNDO, REDO, STACK_UPDATEのいずれかを指定すること.
     * @param inputInterface
     *            Undo/Redo操作に関連付けられたInputInterfaceオブジェクト
     * @param undoStackCount
     *            Undoスタックの要素数.
     * @param redoStackCount
     *            Redoスタックの要素数.
     */
    public UndoRedoEvent(int state, InputInterface inputInterface,
            int undoStackCount, int redoStackCount) {
        this.state = state;
        this.inputInterface = inputInterface;
        this.undoStackCount = undoStackCount;
        this.redoStackCount = redoStackCount;
    }

    /**
     * Creates a new instance of UndoRedoEvent
     * 
     * @param state
     *            このイベントの状態を指定する. UNDO, REDO, STACK_UPDATEのいずれかを指定すること.
     * @param inputInterface
     *            Undo/Redo操作に関連付けられたInputInterfaceオブジェクト
     * @param undoStackCount
     *            Undoスタックの要素数.
     * @param redoStackCount
     *            Redoスタックの要素数.
     * @param entry
     *            呼び出し元のInputInterfaceEntryオブジェクト.
     */
    public UndoRedoEvent(int state, InputInterface inputInterface,
            int undoStackCount, int redoStackCount, InputInterfaceEntry entry) {
        this.state = state;
        this.inputInterface = inputInterface;
        this.undoStackCount = undoStackCount;
        this.redoStackCount = redoStackCount;
        this.entry = entry;
    }

    /**
     * このイベントを発生させたInputInterfaceEntryオブジェクトへの参照を返す.
     * 
     * @return このイベントの元.
     */
    public InputInterfaceEntry getSource() {
        return this.entry;
    }

    /**
     * このイベントがUndoだったのかRedoだったのか, あるいは単にスタックを更新しただけだったのかを返す.
     * 
     * @return UNDOならundo, REDOならredo, STACK_UPDATEならスタックの更新.
     */
    public int getState() {
        return state;
    }

    /**
     * Undo/Redo操作によって変更が施されたInputInterfaceオブジェクトを返す.
     * 
     * @return 変更が施されたInputInterfaceオブジェクト
     */
    public InputInterface getInputInterface() {
        return this.inputInterface;
    }

    /**
     * Undoスタックの要素数を返す.
     * 
     * @return undoスタックの要素数.
     */
    public int getUndoStackCount() {
        return this.undoStackCount;
    }

    /**
     * Redoスタックの要素数を返す.
     * 
     * @return redoスタックの要素数.
     */
    public int getRedoStackCount() {
        return this.redoStackCount;
    }

}
