<s> class EventsTrigger ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self ) : <EOL> self . __events__ = [ ] <EOL> self . __eventsCallbacks__ = { } <EOL> self . __eventsCount__ = <NUM_LIT:0> <EOL> @ property <EOL> def events ( self ) : <EOL> return self . __events__ <EOL> def setEvents ( self , eventsList ) : <EOL> """<STR_LIT>""" <EOL> self . __events__ = eventsList <EOL> def addObservable ( self , eventTypeId , callbackFunction ) : <EOL> """<STR_LIT>""" <EOL> if eventTypeId not in self . events : <EOL> raise Exception ( "<STR_LIT>" ) <EOL> self . __eventsCallbacks__ [ self . __eventsCount__ ] = ( eventTypeId , callbackFunction ) <EOL> self . __eventsCount__ += <NUM_LIT:1> <EOL> return self . __eventsCount__ - <NUM_LIT:1> <EOL> def removeObservable ( self , eventId ) : <EOL> """<STR_LIT>""" <EOL> if self . __eventsCallbacks__ . has_key ( eventId ) : <EOL> self . __eventsCallbacks__ . pop ( eventId ) <EOL> def removeAllObservables ( self ) : <EOL> """<STR_LIT>""" <EOL> self . __eventsCallbacks__ . clear ( ) <EOL> def getAllObservables ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . __eventsCallbacks__ . items ( ) <EOL> def triggerEvent ( self , eventType , * params ) : <EOL> """<STR_LIT>""" <EOL> for callbackFunction in ( item [ <NUM_LIT:1> ] for item in self . __eventsCallbacks__ . itervalues ( ) if item [ <NUM_LIT:0> ] == eventType ) : <EOL> callbackFunction ( * params ) </s>
