I
- the input typepublic final class FSM2DFAParser<I> extends AbstractFSMParser<I> implements ModelDeserializer<CompactDFA<I>>
AbstractFSMParser.Part
Modifier and Type | Field and Description |
---|---|
static String |
ACCEPT_INDEX_NOT_FOUND |
static String |
ACCEPT_NOT_FOUND |
static String |
ACCEPT_VALUE_NOT_FOUND |
EXPECT_CHAR, EXPECT_IDENTIFIER, EXPECT_NUMBER, EXPECT_STRING, NO_SUCH_STATE, NON_DETERMINISM_DETECTED, targetInputs
Modifier and Type | Method and Description |
---|---|
protected void |
checkDataDefinitions(StreamTokenizer streamTokenizer)
Checks the data definition by ensuring the index in the state vector containing acceptance information is
defined.
|
protected void |
checkStateVectors(StreamTokenizer streamTokenizer)
Does nothing.
|
protected void |
checkTransitions(StreamTokenizer streamTokenizer)
Do nothing.
|
static <I> FSM2DFAParser<I> |
getParser(@Nullable Collection<? extends I> targetInputs,
Function<String,I> inputParser,
String acceptingDataVariableName,
String acceptingDataValue) |
static <I> FSM2DFAParser<I> |
getParser(Function<String,I> inputParser,
String acceptingDataVariableName,
String acceptingDataValue) |
protected void |
parseDataDefinition(StreamTokenizer streamTokenizer)
Parse a data definition.
|
protected void |
parseStateVector(StreamTokenizer streamTokenizer)
Parse a state vector.
|
protected void |
parseTransition(StreamTokenizer streamTokenizer)
Parse a transition by searching the current line for the source state, target state and the input.
|
CompactDFA<I> |
readModel(InputStream is)
Reads the contents from the given input stream and de-serializes it into a model instance.
|
getInputParser, getInputs, getPartLineNumber, getStreamTokenizer, parse
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readModel, readModel, readModel
public static final String ACCEPT_NOT_FOUND
public static final String ACCEPT_VALUE_NOT_FOUND
public static final String ACCEPT_INDEX_NOT_FOUND
protected void parseDataDefinition(StreamTokenizer streamTokenizer) throws IOException
This line is only parsed when we still have to find acceptIndex
, and acceptValue
.
parseDataDefinition
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputFSMFormatException
- when the data definition is illegal.IOException
- see StreamTokenizer.nextToken()
.protected void checkDataDefinitions(StreamTokenizer streamTokenizer)
checkDataDefinitions
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputFSMFormatException
- when the acceptance information could not be found.protected void parseStateVector(StreamTokenizer streamTokenizer) throws IOException
This method will only search for whether the state is accepting or not. The state index will be equal to the
current AbstractFSMParser.getPartLineNumber()
.
parseStateVector
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputFSMFormatException
- when the current line is an illegal state vector.IOException
- see StreamTokenizer.nextToken()
.protected void checkStateVectors(StreamTokenizer streamTokenizer)
checkStateVectors
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputprotected void parseTransition(StreamTokenizer streamTokenizer) throws IOException
parseTransition
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputFSMFormatException
- when the current line is an illegal transition.IOException
- see StreamTokenizer.nextToken()
.protected void checkTransitions(StreamTokenizer streamTokenizer)
checkTransitions
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputpublic CompactDFA<I> readModel(InputStream is) throws IOException
ModelDeserializer
readModel
in interface ModelDeserializer<CompactDFA<I>>
is
- the input stream to read data fromIOException
- if an error occurred while reading from the streampublic static <I> FSM2DFAParser<I> getParser(@Nullable Collection<? extends I> targetInputs, Function<String,I> inputParser, String acceptingDataVariableName, String acceptingDataValue)
public static <I> FSM2DFAParser<I> getParser(Function<String,I> inputParser, String acceptingDataVariableName, String acceptingDataValue)
Copyright © 2020. All rights reserved.