swarm-support
[Top][All Lists]
Advanced

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

Re: Making a zoomraster displaying MoGrid2d. Would you have done this?


From: Ken Cline
Subject: Re: Making a zoomraster displaying MoGrid2d. Would you have done this?
Date: Wed, 23 Jun 1999 19:33:37 -0400 (EDT)

On Wed, 23 Jun 1999, Paul Johnson wrote:

> The problem is that the MoGrid2d uses a Swarm List at
> each point in the grid.  That means it is not possible to
> add a method drawSelfOn, since List can't be subclassed. I
> considered for a while making a new wrapper class around
> list, and then putting those wrappers inside the MoGrid2d. 
> I think that would have worked, but I was afraid of
> destroying the essence of MoGrid2d by building in another
> layer of abstraction.

A possible alternative would be to subclass one of the
display classes.  The argument for doing it this way is
that a gui representation, or view, of an object is not
necessarily something the object should "know" about.
(This design more closely matches how the Value2dDisplay
works as opposed to the Object2dDisplay, btw.)

> One minus of my approach is that I have to omit the
> setObjectCollection line above, which forces the
> protestDisplay to go square by square over the whole
> lattice when rendering.  I tried to think of a way to
> mungle the objectHolderGrid into a list, but I kept
> losing functionality by doing so.

Hmmm... From what you said, I don't see how you can get
around checking each grid element each time the display
updates, but you might be able to use a flag (ie dirty bit)
to save some CPUs.  However, I guessing that the best way
to add a flag would be with a wrapper on the list. (I've
never tried it, but message forwarding should making
writing a wrapper much less tedious.)

Ken.

PS: Of course, there are also arguments for having the
object responsible for drawing itself (e.g. access to
ivars, coding simplicity, etc.).

_________________________________________________________
Ken Cline                             address@hidden
SAIC                                 VOICE (410) 571-0413
Annapolis, MD                          FAX (301) 261-8427







                  ==================================
   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.



reply via email to

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