|
From: Bennie T. <B.J...@st...> - 2005-04-09 07:49:05
|
Hi all,
I'm getting an error when trying to define more than one EventType in a
class. There is no problem when I only define either one of the two
EventTypes on its own. The DSOL java doc explains that the values of the
EventTypes should be unique, as I've done in my example. I have included the
exception message and code of the class.
Does anyone know what causes this problem and how to fix it?
Thanks,
Bennie
Exception in thread "main" java.lang.NullPointerException
at
nl.tudelft.simulation.event.EventProducer.checkEventType(EventProducer.java:
80)
at
nl.tudelft.simulation.event.EventProducer.<init>(EventProducer.java:95)
at
nl.tudelft.simulation.test.EventProducerExtension.<init>(EventProducerExtens
ion.java:22)
at
nl.tudelft.simulation.test.EventProducerExtension.main(EventProducerExtensio
n.java:30)
public class EventProducerExtension extends EventProducer
{
private static int counter = 1;
private EventType eventTypeA = new EventType("A");
private EventType eventTypeB = new EventType("B");
public EventProducerExtension()
{
super();
this.eventTypeA = new EventType("A" + counter);
this.eventTypeB = new EventType("B " + counter);
counter++;
}
public static void main(String[] args)
{
new EventProducerExtension();
new EventProducerExtension();
}
}
|