added getLastArrayKey to AbstractGenerator and refactored ClassGenerator and FileGenerator to use getLastArrayKey