Hi Boldoo,
I see no apparent reason why you would get a NullPointerException.
Perhaps the cause of the exception is further down the stack trace?
Do you have a complete test case?
It is a little odd that you are sending data during initialize()
though.
Can you use the regular Ptolemy Parameter facility? Ptolemy II 6.0.2
includes Publish and Subscribe actors which might help you here.
_Christopher
--------
Hi hackers,
I'm trying to make an (composite) actor that contains
a variable "nextEventNode". This variable must get its
initial value during initialization. (further some
other actors read this value also in the
initialization phase)
So I modeled the "InitRandom" (TypedAtomicActor) actor
that has above variable as public variable, and has
the "initialize()" method, in which this variable gets
its initial random value.
But when I run whole model (created in vergil), which
has my (composite) actor, it returns
"NullPointerException" exception. Below is the message
from the stack trace.
...
java.lang.NullPointerException
at myActors.InitRandom.initialize(InitRandom.java:87)
at
ptolemy.actor.Director.initialize(Director.java:609)
at
ptolemy.actor.Director.initialize(Director.java:582)
at
ptolemy.domains.de.kernel.DEDirector.initialize(DEDirector.java:766)
at
ptolemy.actor.CompositeActor.initialize(CompositeActor.java:549)
at
ptolemy.actor.Director.initialize(Director.java:609)
at
ptolemy.actor.Director.initialize(Director.java:582)
at
ptolemy.domains.de.kernel.DEDirector.initialize(DEDirector.java:766)
at
ptolemy.actor.CompositeActor.initialize(CompositeActor.java:549)
at ptolemy.actor.Manager.initialize(Manager.java:575)
at ptolemy.actor.Manager.execute(Manager.java:320)
at ptolemy.actor.Manager.run(Manager.java:1044)
at ptolemy.actor.Manager$3.run(Manager.java:1085)
...
Code in the "InitRandom" actor are below.
in the constructor section:
Variable nextEventNode = new Variable(this,
"nextEventNode");
nextEventNode.setTypeEquals(BaseType.DOUBLE);
...
public Variable nextEventNode;
in the initialize() method:
(line 85) double initValue = _random.nextDouble()*10;
(line 87) nextEventNode.setToken(new
DoubleToken(initValue));
(line 89) output.send(0, nextEventNode.getToken());
...
So any tips would be helpful for me.
Boldoo
___________________________________________________________________________
_________
Don't pick lemons.
See all the new 2007 cars at Yahoo! Autos.
http://autos.yahoo.com/new_cars.html
---------------------------------------------------------------------------
-
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: ptolemy-hackers-request@ptolemy.eecs.berkeley.edu
--------
----------------------------------------------------------------------------
Posted to the ptolemy-hackers mailing list. Please send administrative
mail for this list to: ptolemy-hackers-request@ptolemy.eecs.berkeley.edu