Package dsa
Class NFA
java.lang.Object
dsa.NFA
A data type for creating a nondeterministic finite state automaton (NFA) from a regular expression and testing
whether a given string is matched by that regular expression.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Unit tests the data type.boolean
recognizes
(String text) Returnstrue
if this NFA recognizestext
, andfalse
otherwise.
-
Constructor Details
-
NFA
Constructs a nondeterministic finite state automaton (NFA) fromregexp
.- Parameters:
regexp
- the regular expression.
-
-
Method Details
-
recognizes
Returnstrue
if this NFA recognizestext
, andfalse
otherwise.- Parameters:
text
- the text.- Returns:
true
if this NFA recognizestext
, andfalse
otherwise.
-
main
Unit tests the data type.- Parameters:
args
- the command-line arguments.
-