[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Traversing Schedules
From: |
Doug Donalson; |
Subject: |
Traversing Schedules |
Date: |
Wed, 26 Mar 1997 21:57:10 -0800 (PST) |
Roger, (or Glen or ...?)
I am using the auto drop shedule with concurrent groups.
For validation of my model I need to be able to verify that
the events in my schedule match what I think should be there.
Roger gave me a method for traversing the 2 level event list:
-printSchedule
{
int eventCount;
id index,groupIndex,actionAtTime;
timeval_t timeOfAction;
eventCount = 0;
index = [eventSchedule begin: [self getZone] ];
while ( (actionAtTime = [index next]) )
{
puts("Group Break");
timeOfAction = (timeval_t) [index getKey]; // key of member is time
value
if ( [actionAtTime respondsTo: M(begin:)] )
{ // test for concurrent group
puts("there is a concurrent group");
groupIndex = [actionAtTime begin: [self getZone]];
while ( (actionAtTime = [groupIndex next]) )
{
printf( "at time: %u action is: %0#8x\n",timeOfAction,actionAtTime );
eventCount++;
}
[groupIndex drop];
}
else
{
printf( "at time: %u action is: %0#8x\n",timeOfAction,actionAtTime );
eventCount++;
}
}
[index drop];
printf("#events=%d\n",eventCount);
return self;
}
As far as I can tell, there are a number of concurrent groups in
my schedule that that have more than one event in them. When I
use the above function on my event schedule it never detects this. ie It
never prints puts("there is a concurrent group");.
Is respondsTo: begin the correct test? Also, I am assuming that
I can use the same getKey message to find the time value for the
subgroup once I get the traversal correct. Will this work.
Cheers,
Doug
***************************************************************************
* Doug Donalson * Office: (805) 893-2962 *
* Ecology, Evolution, and Marine Biology * Home: (805) 961-4447 *
* UC Santa Barbara * email address@hidden
* Santa Barbara Ca. 93106 * *
***************************************************************************
* *
* The most exciting phrase to hear in science, the one that *
* hearlds new discoveries, is not "EUREKA" (I have found it) but *
* "That's funny ...?" *
* *
* Isaac Asimov *
* *
***************************************************************************
- Traversing Schedules,
Doug Donalson; <=