rzel / mini-java

Automatically exported from code.google.com/p/mini-java
0 stars 0 forks source link

Refactor DFABuilder type hierarchy #14

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Add DFABuilder as a base interface;
NFA should be a sub-interface of DFACreator with a different
addTransition() method;
DFA.Builder should implement DFABuilder interface;
NFAImpl should extends DFA.Builder, and in the same time, implements NFA
interface.

Original issue reported on code.google.com by lemontree.cool on 6 Sep 2008 at 2:43

GoogleCodeExporter commented 9 years ago
I think it's better to use composition instead of inheritance here. NFAImpl can 
own a
DFA.Builder, and then delegates the AddTransition() messages to that 
DFA.Builder (So
constraints can be reserved). Meanwhile, NFAImpl maintains a collection of 
epsilon
transitions. And finally, NFAImpl uses another DFA.Builder to generate the 
final DFA.

Original comment by lemontree.cool on 6 Sep 2008 at 2:48

GoogleCodeExporter commented 9 years ago

Original comment by lemontree.cool on 11 Sep 2008 at 3:14