Module com.googlecode.lanterna
Package com.googlecode.lanterna.input
Class CharacterPattern.Matching
- java.lang.Object
-
- com.googlecode.lanterna.input.CharacterPattern.Matching
-
- Enclosing interface:
- CharacterPattern
public static class CharacterPattern.Matching extends java.lang.Object
This immutable class describes a matching result. It wraps two items, partialMatch and fullMatch.- fullMatch
-
The resulting KeyStroke if the pattern matched, otherwise null.
Example: if the tested sequence isEsc [ A
, and if the pattern recognized this asArrowUp
, then this field has a value likenew KeyStroke(KeyType.ArrowUp)
- partialMatch
-
true
, if appending appropriate characters at the end of the sequence can produce a match.
Example: if the tested sequence is "Esc [", and the Pattern would match "Esc [ A", then this field would be set totrue
.
-
-
Field Summary
Fields Modifier and Type Field Description KeyStroke
fullMatch
static CharacterPattern.Matching
NOT_YET
Re-usable result for "not yet" half-matchesboolean
partialMatch
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
toString()
-
-
-
Field Detail
-
fullMatch
public final KeyStroke fullMatch
-
partialMatch
public final boolean partialMatch
-
NOT_YET
public static final CharacterPattern.Matching NOT_YET
Re-usable result for "not yet" half-matches
-
-
Constructor Detail
-
Matching
public Matching(KeyStroke fullMatch)
Convenience constructor for exact matches- Parameters:
fullMatch
- the KeyStroke that matched the sequence
-
Matching
public Matching(boolean partialMatch, KeyStroke fullMatch)
General constructorFor mismatches rather use
null
and for "not yet" matches use NOT_YET. Use this constructor, where a sequence may yield both fullMatch and partialMatch or for merging result Matchings of multiple patterns.- Parameters:
partialMatch
- true if further characters could lead to a matchfullMatch
- The perfectly matching KeyStroke
-
-