Class SimpleKeyboard

  • All Implemented Interfaces:
    Keyboard

    public class SimpleKeyboard
    extends Object
    implements Keyboard
    Simplest implementation for EN keyboard.
    Author:
    baranowb
    • Constructor Detail

      • SimpleKeyboard

        public SimpleKeyboard()
      • SimpleKeyboard

        public SimpleKeyboard​(InputStream is)
    • Method Detail

      • siblings

        public boolean siblings​(String word,
                                int index)
        Description copied from interface: Keyboard
        Detects if char next to index is its sibling.
        Specified by:
        siblings in interface Keyboard
        Parameters:
        word - - string against which checks are performed.
        index - - index of character to be tested.
        Returns:
        true if characters are siblings.
      • siblings

        public boolean siblings​(String word,
                                int index,
                                int isSiblingIndex)
        Description copied from interface: Keyboard
        Just as Keyboard.siblings(String, int), but it accepts index of second char that is a subject to test. This allows to detect patterns of keystrokes.
        Specified by:
        siblings in interface Keyboard
        Parameters:
        word - - string against which checks are performed.
        index - - index of character to be tested.
        isSiblingIndex - - index of second character to be tested.
        Returns:
        true if characters are siblings.
      • sequence

        public int sequence​(String word,
                            int start)
        Description copied from interface: Keyboard
        Detects sequence of keys in word. If Keyboard.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;
         
        Specified by:
        sequence in interface Keyboard
        Parameters:
        word - - word in which keyboard is to search for keys sequence.
        start - - start index of search.
        Returns:
        - number of characters in sequence