Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

collectors / class hierarchy

New Message Reply Date view Thread view Subject view Author view

Subject: collectors / class hierarchy
From: Nicolas Becu (becu@uni-hohenheim.de)
Date: Tue Feb 28 2006 - 20:45:23 CET

Dear Romain,

To follow in the same trend as Claude, you may want to use the
Cormas collector "allEntities: aClass" which is implemented at the level of
the CormasModel class (protocol "entities - access")

It will return a collection of all the instances of aClass as well as the one
from its subclasses.

Therefore if you do a
self allEntities: TurtleNat
you'll get all the instances of TurtleNatMale and of TurtleNatFemale

You can also use a "self allAgents" as a collector of all the instances of
Agent subclasses.

If this is useful, I still would like to raise a small issue concerning how
Cormas deals with subclasses.

In case of CSE subclasses, Cormas assumes the mother class is an abstract one.
However, it might not always be the case (it's not CatchScape model). The
problem comes when I need to define the symbols for the mother class, because
in the definition window of the "Observation of space" only the children
classes appear and not the mother classes. The only way I've found until now
is to write the definition of symbols for the mother class directly in the ev
file. (I think the same applies for situated objects which have a mother
class).

I thus raise the question, shouldn't we consider having mother classes which
can be either abstract or not?
Perhaps an option to click to define if it's abstract or not could be added in
the Cormas Kernel.

Kind regards to all,

Nicolas

Quoting Claude Monteil <monteil@ensat.fr>:

> A 17:30 28/02/2006 +0100, vous avez écrit :
> >thanks for your answer.
> >
> >But my question is : Why do I need to make those methods ?
> >
> >The UML structure of my models is as follows :
> >
> >LocatedAgent
> > |- TurtleNat
> > |- TurtleNatMale
> > |- TurtleNatFemale
> >
> >My problem is that I created the classes TutleNatMale and TurtleNatFemale
> >which inherit of the class TurlteNat, then CORMAS (or smalltalk) created
> >the lists "theTurlteNats", "theTurtleNatMales" and "theTurtleNatFemales".
> >But the list "theTurlteNats" remains empty while "theTurtleNatMales" and
> >"theTurtleNatFemales" are fulfilled. Why?
>
> Dear Romain,
>
> TurtleNat is an abstract class, like in the hierarchy :
>
> HumanBeeing
> |- Man
> |- Woman
>
> It does not exist human beeing which is not either a man or a woman (...as
> far as I know :-) ).
>
> Best regards,
> Claude
>
>

-- 
Nicolas Becu
Farm Management Institute
Uplands Program
Hohenheim University

Institut für Landwirtschaftliche Betriebslehre (410B) Universität Hohenheim Schloss-Osthof-Süd 70599 Stuttgart - Germany http://www.troz.uni-hohenheim.de/research/SFB564 Tel.: +49 (0)711 459 2544 Fax.: +49 (0)711 459 3709 E-Mail: becu@uni-hohenheim.de

New Message Reply Date view Thread view Subject view Author view
 

Back to home