'''
Created on 10-sep.-2014

@author: Bruno
'''
from fsaclasses import State, Transition, After, AtomValue, Float, FSAModel,Event,RunTimeEvent,Events
import fsasimulator

def buildModel():
    statea = State("a")
    stateb = State("b")
    statet = State("t")
    statec = State("c", final=True)
    
    transitionab = Transition("a2b",statea,stateb)
    transitionab.trigger = Event("a")
    
    transitionbt = Transition("b2t",stateb,statet)
    transitionbt.trigger = After(Float(2.0))
    
    transitiontc = Transition("t2c",statet,statec)

    fsamodel = FSAModel(
                        [statea,stateb,statec],
                        [transitionab,transitionbt, transitiontc]
                        )
    fsamodel.initialState = statea
    return fsamodel

if __name__ == '__main__':
    
    fsamodel = buildModel()
    events = Events([RunTimeEvent('a',3.0)])
    controller = fsasimulator.Controller(fsamodel, events, [])
    controller.start()