improved codegen

introduced abstract types and interfaces for parametrizable events and
patterns