class DdlChanges implements DdlParserListener {

    public void groupEventsByDatabase(DatabaseEventConsumer consumer) {
        if (isEmpty()) {
            return;
        }
        if (databaseNames.size() <= 1) {
            consumer.consume(databaseNames.iterator().next(), events);
            return;
        }
        List<Event> dbEvents = new ArrayList<>();
        String currentDatabase = null;
        for (Event event : events) {
            String dbName = getDatabase(event);
            if (currentDatabase == null || dbName.equals(currentDatabase)) {
                currentDatabase = dbName;
                // Accumulate the statement ...
                dbEvents.add(event);
            }
            else {
                // Submit the statements ...
                consumer.consume(currentDatabase, dbEvents);
            }
        }
    }

    public  DdlChanges();
    public  DdlChanges(String terminator);

}