package de.ugoe.cs.quest.eventcore.gui;

/**
 * TODO comment
 * 
 * @version $Revision: $ $Date: $
 * @author 2011, last modified by $Author: $
 */
public class MouseButtonDown extends MouseButtonInteraction {

    /**  */
    private static final long serialVersionUID = 1L;

    /**
     * @param button
     */
    public MouseButtonDown(Button button) {
        super(button);
    }

    /*
     * (non-Javadoc)
     * 
     * @see de.harms.attef.userinteraction.Interaction#getName()
     */
    public String getName() {
        if (super.getButton() == Button.LEFT) {
            return "LeftMouseButtonDown";
        }
        else if (super.getButton() == Button.MIDDLE) {
            return "MiddleMouseButtonDown";
        }
        else if (super.getButton() == Button.RIGHT) {
            return "RightMouseButtonDown";
        }
        else {
            return "UnknownMouseButtonDown";
        }
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        if (super.getButton() == Button.LEFT) {
            return "left mouse button down";
        }
        else if (super.getButton() == Button.MIDDLE) {
            return "middle mouse button down";
        }
        else if (super.getButton() == Button.RIGHT) {
            return "right mouse button down";
        }
        else {
            return "unknown mouse button down";
        }
    }

    /*
     * (non-Javadoc)
     * 
     * @see de.harms.attef.userinteraction.Interaction#startsLogicalSequence()
     */
    public boolean startsLogicalSequence() {
        return true;
    }

    /*
     * (non-Javadoc)
     * 
     * @see de.harms.attef.userinteraction.Interaction#finishesLogicalSequence()
     */
    public boolean finishesLogicalSequence() {
        return false;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(Object obj) {
        if (obj instanceof MouseButtonDown) {
            return getButton().equals(((MouseButtonDown) obj).getButton());
        }
        return false;
    }

    /*
     * (non-Javadoc)
     * 
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        return getButton().hashCode();
    }

}
