Automata automata = new Automata(); Automaton automaton1 = automata.add("a1"); Automaton automaton2 = automata.add("a2"); [...] |
Event e1_1 = automaton1.addEvent("e1"); Event e2_1 = automaton1.addEvent("e2"); Event e1_2 = automaton2.addEvent("e1"); // same e1, but for automaton2 this time |
State s0 = automaton1.addState("0"); State s1 = automaton1.addState("1"); ... Transition t01 = automaton1.addTransition(s0,s1,e2_1); |
s0.setInitial(true); s0.setWeight(.5); s1.setMarked(true); e1_1.setControllable(false); e2_1.setWeight(2.0); |
Automata as = AutomataIO.loadXML("automata.xml"); AutomataIO.saveXML(as, "test.xml"); |
automaton1.showDot("automaton1"); |
Automaton a = ... for (Enumeration e = a.getNodes().elements() ; e.hasMoreElements() ;) { State s = (State) e.nextElement(); [...] } for (Enumeration it = a.getEdges().elements() ; it.hasMoreElements() ;) { Transition t = (Transition) it.nextElement(); State from = (State) t.n1; // from Edge State to = (State) t.n2; // from Edge Event event = t.event; [...] } |
Automaton a = ... for(Event e = a.getAlphabet().head(); e != null; e = e.next) { [...] } |
Automata a = .... EventManager em = a.getEventManager(); for(Event e = em.head(); e != null; e = e.next) { [...] } |
public void printLocals(Automata all, Automata current) { EventManager em = all.getEventManager(); for(Event e = em.head(); e != null; e = e.next) e.extra1 = 0; for (Enumeration it = all.elements() ; it.hasMoreElements() ;) { Automaton at = (Automaton) it.nextElement(); for(Event e = at.getAlphabet().head(); e != null; e = e.next) e.parent.extra1 ++; } for(Event e = current.getAlphabet().head(); e != null; e = e.next) { if(e.parent.extra1 == 1) System.out.println("Local event: " + e); } } |
State s = ... // outgoing arcs for( Transition t = (Transition) s.firstOut; t != null; t = (Transition) t.next) { [...] } // incoming arcs for( Transition t = (Transition) s.firstIn; t != null; t = (Transition) t.prev) { [...] } |