On the other, my solution does not fit with the sdf domain behavior, so it might have been the desired behavior, it just returns an array with redundant information from indexes sequenceLen and on. But I guess the array could be trimmed using ArrayExtract.
 
Your thoughts are welcome,
Efrat
 
----- Original Message -----
Sent: Friday, April 01, 2005 5:23 PM
Subject: SequenceToArray actor

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

Reply via email to