Implementing an automaton/creating a tuple



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
.



Relevant Pages

  • Re: Finite & Infinite State Machines (was: Finite State Machine)
    ... and contrasted with the more general transition relation). ... > Automata, languages, grammars, etc. can be not just over alphabets X ... > say) can be called a GENERATOR. ...
    (comp.theory)
  • Finite & Infinite State Machines (was: Finite State Machine)
    ... > What are all the kinds of automata that use transition function? ... Automata, languages, grammars, etc. can be not just over alphabets X ... say) can be called a GENERATOR. ...
    (comp.theory)
  • Finite State Machine
    ... Is the best answer to the question below {finite state machine}? ... What are all the kinds of automata that use state a transition function? ... What is the generic name that is most typically applied to this set of automata? ... Recursive Transition Network ...
    (comp.theory)
  • State Transition Functions
    ... What are all the kinds of automata that use state a transition function? ... What is the generic name that is most typically applied to this set of automata? ... Recursive Transition Network ...
    (comp.theory)