[kepler-dev] Re: SequenceToArray in PN
xin2 at llnl.gov
Tue Dec 14 11:20:30 PST 2004
Ahh! You're right--good catch!
So if I made the following change to SequenceToArray, then it works:
$ cvs diff ptolemy/domains/sdf/lib/SequenceToArray.java
retrieving revision 1.47
diff -r1.47 SequenceToArray.java
< Token valueArray = input.get(0, length);
> Token valueArray = new Token[length];
> System.arraycopy(input.get(0, length), 0, valueArray,
If this looks OK, will someone from Ptolemy please commit such a change
to CVS, so that it will make it into the next release?
On 13.12.2004, at 22:44, Neil E. Turner wrote:
> 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
> the number of valid tokens to get in the returned array. The length of
> returned array can be greater than the specified vector length, in
> case, only the first vectorLength elements are guaranteed to be valid."
> If you "look inside" the SequenceToArray actor you will see the Java
> 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
> 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
>> 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!
> Posted to the ptolemy-hackers mailing list. Please send administrative
> mail for this list to:
> ptolemy-hackers-request at ptolemy.eecs.berkeley.edu
More information about the Kepler-dev