Package org.biojava.utils.regex
Class PatternFactory
java.lang.Object
org.biojava.utils.regex.PatternFactory
A class that creates Patterns for regex matching on
SymbolLists of a specific Alphabet.
- Since:
- 1.4
- Author:
- David Huen
-
Method Summary
Modifier and TypeMethodDescriptionchar
Returns the character that represents the specified Symbol in the Alphabet that this PatternFactory was defined for.Returns a Pattern object that applies the specified regex against SymbolLists in the Alphabet that this PatternFactory was defined against.Returns a Pattern object that applies the specified regex against SymbolLists in the Alphabet that this PatternFactory was defined against.static PatternFactory
makeFactory
(FiniteAlphabet alfa) Returns a factory for Patterns in the specified Alphabet.
-
Method Details
-
compile
Returns a Pattern object that applies the specified regex against SymbolLists in the Alphabet that this PatternFactory was defined against. The String returned by getName() is set to pattern. -
compile
public Pattern compile(String pattern, String label) throws RegexException, IllegalAlphabetException Returns a Pattern object that applies the specified regex against SymbolLists in the Alphabet that this PatternFactory was defined against.- Parameters:
pattern
- regex pattern expressed as a String.label
- A String label assigned to the Pattern object. Can be retrieved later with getName().- Throws:
RegexException
IllegalAlphabetException
-
charValue
Returns the character that represents the specified Symbol in the Alphabet that this PatternFactory was defined for.The character will be ASCII in Alphabets that define a Character tokenization. In Alphabets that don't a Unicode character in the private range is returned instead and this can be used to assemble the String that is the argument for the compile method.
- Throws:
IllegalSymbolException
-
makeFactory
Returns a factory for Patterns in the specified Alphabet.
-