View Javadoc
1   package org.newdawn.slick.command;
2   
3   /**
4    * A control indicating that a mouse button must be pressed or released to cause an command.
5    * 
6    * @author joverton
7    */
8   class MouseButtonControl implements Control {
9       /** The button to be pressed. */
10      private final int button;
11      
12      /**
13       * Create a new control that indicates a mouse button to be pressed or released.
14       * 
15       * @param button The button that should be pressed to cause the command
16       */
17      public MouseButtonControl(int button) {
18          this.button = button;
19      }
20  
21      /* (non-Javadoc)
22       * @see java.lang.Object#hashCode()
23       */
24      @Override
25      public int hashCode() {
26          final int prime = 31;
27          int result = 1;
28          result = prime * result + button;
29          return result;
30      }
31  
32      /* (non-Javadoc)
33       * @see java.lang.Object#equals(java.lang.Object)
34       */
35      @Override
36      public boolean equals(Object obj) {
37          if (this == obj) {
38              return true;
39          }
40          if (obj == null) {
41              return false;
42          }
43          if (!(obj instanceof MouseButtonControl)) {
44              return false;
45          }
46          MouseButtonControl other = (MouseButtonControl) obj;
47          if (button != other.button) {
48              return false;
49          }
50          return true;
51      }
52  
53  }