Class BasicCharacterPattern
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 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 TypeMethodDescriptionbooleanchar[]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 ininthashCode()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-KeyStrokethat 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:CharacterPatternGiven a list of characters, determine whether it exactly matches any known KeyStroke, and whether a longer sequence can possibly match.- Specified by:
matchin interfaceCharacterPattern- Parameters:
seq- of characters to check- Returns:
- see
Matching
-
equals
-
hashCode
-