Join patterns extension for 4..9 and N arity joins.

Issue #1318

I made some potential breaking changes:
- made classes final
- made most methods protected or package private