[kepler-dev] Re: SequenceToArray in PN
Neil E. Turner
net at eecs.berkeley.edu
Mon Dec 13 22:44:47 PST 2004
I found this in the JavaDocs for IOPort.get(int channelIndex, int
"Get an array of tokens from the specified channel. The parameter
channelIndex specifies the channel and the parameter vectorLength specifies
the number of valid tokens to get in the returned array. The length of the
returned array can be greater than the specified vector length, in which
case, only the first vectorLength elements are guaranteed to be valid."
If you "look inside" the SequenceToArray actor you will see the Java code...
go to the fire() method. You will see in the code
Token valueArray = input.get(0, length);
I put a print statement to see the length of 'valueArray'. It indeed was
longer than the PortParameter 'arrayLength'.
----- Original Message -----
From: "xiaowen" <xin2 at llnl.gov>
To: <ptolemy-hackers at eecs.berkeley.edu>
Cc: "xiaowen Xin" <xin2 at llnl.gov>; "Kepler-Dev"
<kepler-dev at ecoinformatics.org>
Sent: Monday, December 13, 2004 8:13 PM
Subject: SequenceToArray in PN
> Hi Everyone,
> Is the SequenceToArray actor meant to be used in the PN domain? I've
> attached a workflow that demonstrates behavior that I don't understand.
> A SequenceToArray actor has two ports: input and arrayLength. It
> should package up arrayLength number of input tokens into an array and
> send that out along its output port.
> In the attached workflow, I send 7, then 2 to the arrayLength port.
> However, the output consists of two array tokens both with length 7.
> Can someone please explain to me why the second output isn't an array
> of length 2?
> I'm using Ptolemy 4.0.1.
> Thanks in advance!
More information about the Kepler-dev