java.lang.Object
com.googlecode.lanterna.input.BasicCharacterPattern
- All Implemented Interfaces:
CharacterPattern
Very simple pattern that matches the input stream against a pre-defined list of characters. For the pattern to match,
the list of characters must match exactly what's coming in on the input stream.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.googlecode.lanterna.input.CharacterPattern
CharacterPattern.Matching
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionBasicCharacterPattern
(KeyStroke result, char... pattern) Creates a new BasicCharacterPattern that matches a particular sequence of characters into aKeyStroke
-
Method Summary
Modifier and TypeMethodDescriptionboolean
char[]
Returns the characters that makes up this pattern, as an array that is a copy of the array used internallyReturns the keystroke that this pattern results inint
hashCode()
Given a list of characters, determine whether it exactly matches any known KeyStroke, and whether a longer sequence can possibly match.
-
Field Details
-
result
-
pattern
private final char[] pattern
-
-
Constructor Details
-
BasicCharacterPattern
Creates a new BasicCharacterPattern that matches a particular sequence of characters into aKeyStroke
- Parameters:
result
-KeyStroke
that this pattern will translate topattern
- Sequence of characters that translates into theKeyStroke
-
-
Method Details
-
getPattern
public char[] getPattern()Returns the characters that makes up this pattern, as an array that is a copy of the array used internally- Returns:
- Array of characters that defines this pattern
-
getResult
Returns the keystroke that this pattern results in- Returns:
- The keystoke this pattern will return if it matches
-
match
Description copied from interface:CharacterPattern
Given a list of characters, determine whether it exactly matches any known KeyStroke, and whether a longer sequence can possibly match.- Specified by:
match
in interfaceCharacterPattern
- Parameters:
seq
- of characters to check- Returns:
- see
Matching
-
equals
-
hashCode
public int hashCode()
-