An EventGenerator is a source of Events.
An EventGenerator is registered with an
EventDispatcher which repeatedly polls
all registered EventGenerators for new Events. Events are then placed on an
event queue for processing by the EventProcessor. The EventGenerator is responsible for returning
a list of Events that have occurred since the previous poll.
Users are expected to either create their own subclasses that override the
get_events method. Alternatively,
users can pass a block as part of the constructor. The block will be
executed upon each invocation of get_events by the EventDispatcher.
Returns an array of events that have occurred since the last time the EventGenerator was polled. If no events have
occurred, it returns an empty array. This method should be overridden by a
concrete implementation. If a block was supplied to the constructor, it
will be executed upon invocation of this method to return an array of
Events.