private boolean isKey(Step step, String code, int type) { boolean match = false; if (step instanceof Event) { Event se = (Event) step; match = "KeyEvent".equals(se.getType()) && (type == EITHER || (type == PRESS && "KEY_PRESSED".equals(se.getKind())) || (type == RELEASE && "KEY_RELEASED".equals(se.getKind()))) && (code == ANY_KEY || code.equals(se.getAttribute(XMLConstants.TAG_KEYCODE))); } return match; }