I
- the input type.O
- the output type.public abstract class AbstractFSM2MealyParser<I,O> extends AbstractFSMParser<I> implements ModelDeserializer<CompactMealy<I,O>>
AbstractFSMParser.Part
EXPECT_CHAR, EXPECT_IDENTIFIER, EXPECT_NUMBER, EXPECT_STRING, NO_SUCH_STATE, NON_DETERMINISM_DETECTED, targetInputs
Modifier | Constructor and Description |
---|---|
protected |
AbstractFSM2MealyParser(@Nullable Collection<? extends I> targetInputs,
Function<String,I> inputParser,
Function<String,O> outputParser)
Constructs a new AbstractFSM2MealyParser.
|
Modifier and Type | Method and Description |
---|---|
protected void |
checkDataDefinitions(StreamTokenizer streamTokenizer)
We do not need to check data definitions.
|
protected void |
checkStateVectors(StreamTokenizer streamTokenizer)
We do not check the state vectors.
|
protected Function<String,O> |
getOutputParser()
Gets the Function that transforms strings from the FSM source to actual output.
|
protected SortedSet<Integer> |
getStates()
Gets the sorted set of states for the Mealy machine.
|
protected Map<Pair<Integer,I>,Pair<O,Integer>> |
getTransitions()
Gets the map of transitions for the Mealy machine.
|
protected void |
parseDataDefinition(StreamTokenizer streamTokenizer)
We don not care about data definitions.
|
protected CompactMealy<I,O> |
parseMealy(Reader reader)
|
protected void |
parseStateVector(StreamTokenizer streamTokenizer)
Parse a state vector by simply recording the line number in the current part.
|
CompactMealy<I,O> |
readModel(InputStream is)
Reads the contents from the given input stream and de-serializes it into a model instance.
|
checkTransitions, getInputParser, getInputs, getPartLineNumber, getStreamTokenizer, parse, parseTransition
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
readModel, readModel, readModel
protected AbstractFSM2MealyParser(@Nullable Collection<? extends I> targetInputs, Function<String,I> inputParser, Function<String,O> outputParser)
targetInputs
- An collection containing the inputs which should constitute the input alphabet of the parsed automaton.
If null
, the inputs will be automatically gathered from the read FSM file.inputParser
- the input parser (see AbstractFSMParser.inputParser
).outputParser
- the output parser (similar to inputParser
).protected Function<String,O> getOutputParser()
protected Map<Pair<Integer,I>,Pair<O,Integer>> getTransitions()
protected SortedSet<Integer> getStates()
protected void parseDataDefinition(StreamTokenizer streamTokenizer)
parseDataDefinition
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputprotected void checkDataDefinitions(StreamTokenizer streamTokenizer)
checkDataDefinitions
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputprotected void parseStateVector(StreamTokenizer streamTokenizer)
parseStateVector
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputprotected void checkStateVectors(StreamTokenizer streamTokenizer)
checkStateVectors
in class AbstractFSMParser<I>
streamTokenizer
- tokenizer containing the inputprotected CompactMealy<I,O> parseMealy(Reader reader) throws IOException
FSMFormatException
- (see AbstractFSMParser.parse(Reader)
).IOException
- (see AbstractFSMParser.parse(Reader)
).public CompactMealy<I,O> readModel(InputStream is) throws IOException
ModelDeserializer
Note: the input stream will not be closed.
readModel
in interface ModelDeserializer<CompactMealy<I,O>>
is
- the input stream to read data fromIOException
- if an error occurred while reading from the streamCopyright © 2020. All rights reserved.