public interface Keyboard
----- ----- ----- | G | --- | H | .... --- | K | ----- ----- ----- | ----- | V | -----V and H are siblings of G. While K is not.
Modifier and Type | Method and Description |
---|---|
int |
sequence(String word,
int index)
Detects sequence of keys in word.
|
boolean |
siblings(String word,
int index)
Detects if char next to index is its sibling.
|
boolean |
siblings(String word,
int index,
int isSiblingIndex)
Just as
siblings(String, int) , but it accepts index of second char that is a subject to test. |
boolean siblings(String word, int index)
word
- - string against which checks are performed.index
- - index of character to be tested.IllegalArgumentException
- if index is wrong or null argument is passed.boolean siblings(String word, int index, int isSiblingIndex)
siblings(String, int)
, but it accepts index of second char that is a subject to test. This allows to
detect patterns of keystrokes.word
- - string against which checks are performed.index
- - index of character to be tested.isSiblingIndex
- - index of second character to be tested.IllegalArgumentException
- if index is wrong or null argument is passed.int sequence(String word, int index)
siblings(String, int)
returns true for 'index', Than this method will
return at least '1' - indcating that after 'index' there is sequence of chars. Example:
String word = "ASDFG"; Keyboard.sequence(word,0) == word.length()-1;
word
- - word in which keyboard is to search for keys sequence.index
- - start index of search.Copyright © 2023 JBoss by Red Hat. All rights reserved.