Implementing an automaton/creating a tuple
- From: Hendrik Maryns <hendrik_maryns@xxxxxxxxxxxxx>
- Date: Mon, 31 Oct 2005 14:16:53 +0100
Hi,
I want to implement tree automata. As a first prototype I want to implement the full-fledged theoretical approach, i.e., an automaton is a tuple consisting of a set of states S, an alphabet Sigma, a transition function delta (I only consider deterministic automata, so no transition sets), an initial state s0 and a set of accepting states F.
I have a class State and a class TransitionFunction. I thought of implementing the latter as a HashMap. But this is a function from S x S x Sigma -> S, So I would need a HashMap<Tuple<State,State,Symbol>,State>. The problem, of course, lies in this mystical Tuple class. So what I need is some sort of generic list which accepts _multiple generic arguments_! Is there some trick known for this? I don't see a straightforward way for defining my own List class. It would be no problem to constrain it to three elements, but how to guarantee the types of the elements?
I suppose I will have to write my own class FunctionInputTuple (or some name about which I'll have to think a bit longer), which stores two states and a symbol, and use this a key to the HashMap?
Anybody any better suggestions? (Also about the implementation of the automaton very welcome).
TIA, cheers, H. -- Hendrik Maryns
================== www.lieverleven.be http://aouw.org .
- Prev by Date: Re: Crazy Clock
- Next by Date: Re: alternative ways to execute a jar application
- Previous by thread: Re: Basic question
- Next by thread: How to compile a java program w/ another java programs which are w/o a main method
- Index(es):
Relevant Pages
|