Example #1
0
  public KeyEvent(String message) {
    if (message.length() != 2) {
      throw new IllegalArgumentException();
    }

    this.function = Function.fromProtocol(message.charAt(0));
    this.clickType = ClickType.fromProtocol(message.charAt(1));
  }
Example #2
0
    public static ClickType fromProtocol(char c) {
      for (ClickType clickType : ClickType.values()) {
        if (clickType.protocolValue == c) {
          return clickType;
        }
      }

      throw new IllegalArgumentException();
    }
Example #3
0
 @Override
 public int hashCode() {
   int result = function != null ? function.hashCode() : 0;
   result = 31 * result + (clickType != null ? clickType.hashCode() : 0);
   return result;
 }