Refactoring of transition creation and on-demand model building

- Refactoring: moved GenericTransition to be a top-level class
- New hook mechanism: transition creation is now through a factory
rather than tempate method hook
- On-demand model building: models are only build once and only when
they are demanded
Adapted to new hook mechanism

Adapted the code generator to the new hook mechanism, to avoid having
to copy-paste the model definition from the year3 classes