[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: accessing counter
From: |
Pietro Terna |
Subject: |
Re: accessing counter |
Date: |
Sun, 27 Jun 1999 11:11:58 +0200 |
Hi Marcus,
my question is a little bit different.
I report newly my code:
in 'anObject.h'
...
int count;
in 'anObject.m'
...
- createEnd
{
count = 0;
...
- doSomething
{
count = count % stepNumberInACycle;
if (count == 0) { a lot of things}
count++;
...
if (count == 1) { another lot of things}
...
in 'ModelSwarm.m'
...
[modelActions createActionTo: anObject message: M(doSomething)];
...
My question is: can we use an existing internal Swarm counter to known
(from 'anObject' which is executing 'doSomething') how many whole cycles
have been previously executed by the schedule (and, may be, in which sub
step are we, if n>1 in setRepeatInterval: n)? Obviously, avoiding to count
them, as I do with my 'count++' line.
Pietro
At 15.07 26/06/99 -0700, you wrote:
>>>>>> "PT" == Pietro Terna <address@hidden> writes:
>
>PT> I'm wondering if I can replace my 'count' variable with an
>PT> internal Swarm variable.
>
>You don't need to use an instance variable, if that's what you mean.
>For example, you can write "int tempCounter = (count + 1) % modulus;"
>as the first line of the method.
>
>It won't be any faster, especially, but perhaps it will make the code
>a bit more clear.
>
> ==================================
> Swarm-Support is for discussion of the technical details of the day
> to day usage of Swarm. For list administration needs (esp.
> [un]subscribing), please send a message to <address@hidden>
> with "help" in the body of the message.
>
>
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.