- It would be a good idea to use the new program page
wizard for this task.
- You must define a public class with a public, no-argument constructor. The class
name must be a legal
java identifier, and the class must be defined in a file with the same name plus a
'.java' extension. For example, the class MyEventGenerator would have to be in a
file called MyEventGenerator.java according to Java's rules for public classes.
- If you know how many events you will have, then override the method
public int getTotalNumberOfEvents()
- You must implement the abstract method
public EventData geterateEvent()
which will be called until an EndOfData exception is thrown, or until the number of
events, if specified as described above, have passed.
- You may override
public void beforeFirstEvent()
and
public void afterLastEvent()
to provide any setup or cleanup as necessary.
- You must provide a definition for the method
public String getName()
which should return a suitable name for your generator.
Return to tutorial.
Page maintained by Jonas Gifford.
Last updated 01/14/04.