swarm-support
[Top][All Lists]
Advanced

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

Re: Buggy Drag & Drop under WindowsNT!??! HELP!!


From: Paul Johnson
Subject: Re: Buggy Drag & Drop under WindowsNT!??! HELP!!
Date: Fri, 04 Jun 1999 16:25:57 -0500

Dominique Jacquel wrote:

> 
> One has two button(function), selectNext and selectPrevious to select existing
> agents and looks like this
> 
> - (id)selectNext {
>   if ([agentIndex getLoc] != (id)End) selectedAgent = [agentIndex next];
>   if ([agentIndex getLoc] == (id)End) [agentIndex setLoc:Start];
>   [madsObserverSwarm updateProbeWith:(id)selectedAgent];
>   return selectedAgent;
> }
I don't know the answer to your question about NT, but I do  have a
syntax question about this.  It seems to me you put in explicit type
casts more than you need or ought to.  My C book says recasting this way
is about the slowest thing you can do, so it ought to be avoided.  What
do we think on that one, list members?

In particular,
Why do you cast End as (id).  I do not think a cast is needed there, but
if you want one, I think the correct one is (Symbol)

Also, I don't know why you case selectedAgent as (id) in the fourth
line.  Wouldn't that undo whatever type/protocol information was
previously stored with that object? (that is, if it was previously
defined as "id<Heatbug> anAgent" doesn't casting it as (id) here take
off the type information?

It seems to me most of the casts in this next method are unnecesary. 
Since the casts are set in the name of the method, the identical casts
inside the method are superfluous.

> 
> - newConstraint:(int)inType A1:(id)inA1 A2:(id)inA2 Tol:(double)inTol {
>   id obj;
>   obj = [Constraint create:[self getZone]];
>   [obj setAgent1:(id)inA1];
Probably unnecessary (id) cast, unless inA1 is not an object to start
with, but then it wouldn't get past the method declaration
>   [obj setAgent2:(id)inA2];
ditto
>   [obj setConstraintType:(int)inType];
If inType is an (int), this cast is just slowing things down.  If it is
a float or something,  you do need it.
>   [obj setMargin:(double)inTol];
Why cast as double?
>   [self addConstraint:(id)obj];  <-- this just adds obj to an existing List
>   return obj;
> }
> 
 
> ps: sorry if this explannation is not cristal clear but it is 9:10pm and I've
> been working for too long today!
> 
Just for curiosity, I'd like to know what your Constraint class does. 
I'm in social science too and I wonder what you are doing with it.

-- 
Paul E. Johnson                       email: address@hidden
Dept. of Political Science            http://lark.cc.ukans.edu/~pauljohn
University of Kansas                  Office: (785) 864-9086
Lawrence, Kansas 66045                FAX: (785) 864-5700

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