On Tue, Feb 12, 2013 at 1:21 AM, Dang Thi Hai Ha <[email protected]> wrote:

> Hi,
>
> My answer is written inline below:
>
> ....
>> /* Data received from mote nodeId containing NREADINGS samples from
>>        messageId * NREADINGS onwards. Tell parent if this is a new node.
>> */
>>     void update(int nodeId, int messageId, int readings[]) {
>>     if (nodeId >= nodes.length) {
>>         int newLength = nodes.length * 2;
>>
>
> This is to avoid changing the nodes.length everytime a new node arrives.
>
>
>
>>         if (nodeId >= newLength) {
>>             newLength = nodeId + 1;
>>         }
>>
> This is to treat the case when node.length = 0.
>

That seems like a rather convoluted (unclear) way of checking for 0.   Why
don't you simply check for node.length == 0?

>
>
>
>>
>>
>> now because i have this:  int newLength = nodes.length * 2; because it's
>> multiplies for two?
>> because i have this new controll
>>      if (nodeId >= newLength) {
>>             newLength = nodeId + 1;
>>         }
>>
>> if i change this code in this i think don't have a real effect, i think
>> true?
>> if (nodeId +1 >= nodes.length) {
>>         int newLength = nodes.length * 4;
>>         if (nodeId >= newLength) {
>>             newLength = nodeId + 1;
>>         }
>>
>
> Please explain your purpose for this change? What do you want?
>
> Cheers,
>
> Ha.
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



-- 
Eric B. Decker
Senior (over 50 :-) Researcher
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to