swarm-support
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Collections objects


From: Beemer
Subject: Collections objects
Date: Wed, 18 Sep 1996 17:47:57 -0600

I'm working on rewriting some swarm code, which was done really
kludgily because I didn't know about Collections objects.  It uses
lots of pointers and things, and, not surprisingly, breaks when I try
to compile it.  So I'm working on a new version.

My question is this:  can someone explain (or point to some good
documentation) to me about List and Array objects?  I've read the
interface references, but there are a couple things I'm still unclear
on.

Do Collections of objects actually contain the objects themselves, or
just references to (pointers to?) the objects?  Collections has an
Index object, which everything else inherits, that will let you
iterate through the objects.  How do the Index objects for the various
subclasses work?  I got lost trying to work it out...

Basically, what I need to do is this:  I have a bunch of Chimp
objects.  I want to keep track of them in some ordered fashion for
reference.  I also want to have access to them via two rankings: one
is an ordered ranking based on a changing variable, the other is a
randomized ranking based on the ordered ranking.

It seems that an Array would be appropriate for actually holding the
objects and keeping track of them, and that then I'd like two Lists
for the ranked ordering and the randomized ordering.  Is this right?

The other thing is that I'd like to use quicksort() to make the
ranking each time; but that requires an array of pointers.  Any tips
and suggestions on integrating that into what I'm doing?  I don't
think it's real hard, but if there are any real pitfalls to going back
and forth between pointers and reference objects, I'd appreciate it...

Thanks, 
        --Seth Mcginnis


reply via email to

[Prev in Thread] Current Thread [Next in Thread]