swarm-support
[Top][All Lists]
Advanced

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

Re: Problem with translation from ObjectiveC to Java


From: Marcus G. Daniels
Subject: Re: Problem with translation from ObjectiveC to Java
Date: 19 May 2001 12:12:17 -0600
User-agent: Gnus/5.070084 (Pterodactyl Gnus v0.84) Emacs/20.7

>>>>> "BJ" == Babjak Jozef <address@hidden> writes:

BJ> Mistake is maybe in some constructors 

Yeah, that's the main problem.  The first thing you need to do is update
all your constructors so that they follow a relevant superclass constructor.
In the case of FoodSpace, that's the Discrete2dImpl (Zone aZone, int x, int y),
and the constructor would look like this:

   FoodSpace (Zone aZone, int x, int y) {
     super (aZone, x, y);
     
     [etc]
   }

The other places where similar changes are needed are for the
instantiation of Grid2dImpl (need a Zone and size arguments),
ActionGroupImpl (need a Zone argument), ScheduleImpl (you can combine
the constructor and setRepeatInterval argument as "new ScheduleImpl
(getZone (), 1)"), foodDisplay's Value2dDisplayImpl, and bugDisplay's
Object2dDisplayImpl (you had the appropriate constructor commented
out).

With the exception of Selector, all Swarm classes take a Zone argument
as the first argument in the constructor; it's always wrong to 
say "new Thingey ()" unless you are doing an explicit phase switch
manuever (an obscure thing) and will be calling the native createBegin and
createEnd methods explicitly.

Other problems in your code:

* The drawSelfOn method in Bug.java needs to return an Object
  (e.g. this).  I know that seems strange, but it is a result of the
  way the underlying Objective C is coded.

* You've got tons of variables tagged as static for no reason I can see.
  "static" means that _any_ instance of that class will share those
   variable _values_.  If if you only intend to have one instance of 
   a class, this will defeat probes.  In fact, probes will want
   them to be public, too.  (It's a way to reveal some values in ProbeDisplays
   but not others.)

* You do have to call doTkEvents in order for the GUI to update.

* In ModelSwarm.java, you've got a createObjects method that should
  be buildObjects.


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