swarm-support
[Top][All Lists]
Advanced

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

syntax etc.


From: Holger Perlt
Subject: syntax etc.
Date: Fri, 12 Oct 2001 09:07:54 +0200

Hello,

I would like to ask again for the solution of my problem concerning
the Averager. There are two problems:

(I) Using the Averager (getting the numbers  from a List):
***********************************************************

Inside AFonds.m (defining AFonds) I have the build routine:

- buildObjects
{

  AvPreisList = [List create:  [self getZone]];

  AveragePreis = [Averager createBegin: [self getZone]];
  [AveragePreis setCollection: AvPreisList];//here I would assigne the
AvPreisList to the Averager
  AveragePreis = [AveragePreis createEnd];

  return self;

}


The Averager is used inside getWinAvPreis:

- (double) getWinAvPreis
{

  double ap;
  Integer *hh;
  ap = 0.0;


   if(Time < 10){
    hh = [Integer create: [self getZone]];
    [hh setNum: PreisPerAktie];
    [AvPreisList addLast: hh];
    ap = AvPreis;
  }
  else{

    [AvPreisList removeFirst];
    hh = [Integer createBegin: [self getZone]];
    [hh setNum: PreisPerAktie];
    [AvPreisList addLast: hh];

    ap = [AveragePreis getAverage]; //this call is the problem:
AvPreisList has a getNum - method
                                        // to export its numbers; how can I 
tell it this to AveragePreis???
    }


        return ap;
}

(II) Adding to the list:
************************

In the routine getWinAvPreis (above) I have recognized that probably no
element
is added with [AvPreisList addLast: hh]. Using 

ap = (double)([AvPreisList getCount]);

and showing ap via EZGraph  in the ObserverSwarm  I see only zero. I.e.,
no element has been added
to the list?!

Best regards,

Holger





-- 
PD Dr. habil. Holger Perlt
Diplomphysiker/Geschäftsführer
Reinforcement Control GmbH
Karl-Heine-Str. 99
04229 Leipzig
Germany
Phone:  ++49 (0)341 9410370
Fax:    ++49 (0)341 9410372
http://www.reinforcement.de

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