Thanks a lot Edward! - Efrat
On Sat, 2 Apr 2005, Edward A. Lee wrote: > > We have a similar fix in the current CVS tree (as of 12/4/04), > except that it uses arraycopy. I've attached the current version > of the actor, if you want to drop it in... > > Edward > > At 05:23 PM 4/1/2005 -0800, Efrat Frank wrote: > >Dear Ptolemy group, > > > >I think there might be a problem with the SequenceToArray actor. I noticed > >that it uses a tokenCache array, thus if ran several iterations each time > >with a different sequence length, at each iteration, the actor returns an > >array with the maximum length observed so far, and the rest of the values > >are the ones saved in the tokenCache from previous iteration. > > > >As an example: (just to make myself clearer,,) > >Assume the first sequence length is 5, the resulting array is: {0,0,0,0,0}. > >The second sequnce length is 2, the resulting array should be: {8,8}, but > >do to the to tokenCache content the result is {8,8,0,0,0} > > > >I assume this is not the desired behavior, right? > > > >One very simple solution to this would be: > > > > Token[] valueArray = new Token[length]; > > for (int i=0; i<length; i++) { > > valueArray[i] = input.get(0); > > } > > > >instead of: Token[] valueArray = input.get(0, length); > > > >Please let me know what you think, > >Thanks a lot, > >Efrat > > ------------ > Edward A. Lee > Professor, Chair of the EE Division, Associate Chair of EECS > 231 Cory Hall, UC Berkeley, Berkeley, CA 94720 > phone: 510-642-0253 or 510-642-0455, fax: 510-642-2845 > [EMAIL PROTECTED], http://ptolemy.eecs.berkeley.edu/~eal ---------------------------------------------------------------------------- Posted to the ptolemy-hackers mailing list. Please send administrative mail for this list to: [EMAIL PROTECTED]