-
Notifications
You must be signed in to change notification settings - Fork 93
Store RunAutomaton without tabelize and tabelize after load #36
Description
I have a probably rather niche use case, I'd like to create RunAutomatons, serialize them with store, then only once they're deserialized with load tabelize them. The reasoning being that for the automata in question (https://github.com/dan2097/opsin/tree/master/opsin-core/src/main/resources/uk/ac/cam/ch/wwmm/opsin/resources/serialisedAutomata) tabelizing significantly increases their size, and given how fast setAlphabet() is there could be even a speed penalty for deserializing this array as opposed to creating it programmatically (Java's inbuilt serialization code isn't the fastest).
As setAlphabet() isn't public I can currently achieve this either via reflection or having a class in the dk.brics.automaton package.
I can't really think of an idiomatic solution to this. I mean a simple solution would be to make setAlphabet() public, but there isn't normally a reason to call this after the RunAutomaton is constructed. A load(InputStream stream, boolean tableize) could get confusing as to how it interacts with serialized tabelized and non-tabelized automata e.g. if you set it to false would it set classmap to null on the deserialized RunAutomaton.