Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: two problems

New Message Reply Date view Thread view Subject view Author view

Subject: Re: two problems
From: Romain Lorrilliere (romain.lorrilliere@ese.u-psud.fr)
Date: Tue Feb 28 2006 - 17:30:43 CET

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?

Bye

Romain L.


Lorrillière Romain

Lorrillière Romain

 

UMR 8079 Laboratoire Ecologie, Systématique et Evolution

Bât. 362

Université Paris-Sud

91405 Orsay cedex

France

 

tel : 01 69 15 56 85

fax : 01 69 15 56 96

mobile : 06 81 70 90 70

 

email : romain.lorrilliere@ese.u-psud.fr

 



Cesar Rabak wrote:
Romain Lorrilliere escreveu:
  
Dear colleagues,
    
[snipped]

I cannot understand where is the polymorphism here.

  
    The second it's a problem of polymorphism.*
When I want use the polymorphism for apply a method to all instances, my
model can't to do. The super class didn't now the instances of the both
specialized class, and I must have made methods to do that:

"---------------"
/
updateTurtleNat
 
|turtlNat|
    turtleNat := OrderedCollection new.
    turtleNat := self index: self theTurtleNatFemales in: turtleNat.
    turtleNat := self index: self theTurtleNatMales in: turtleNat.

    self theTurtleNats: turtleNat./
    
On the other hand, perhaps you could use a more simple construct for
method above:

If I understand you intent, you want to put all the members of 'self
theTurtleNatFemales' and 'self theTurtleNatMales' into 'turtleNat'.

Try this and get rid of 'index:':

turtleNat addAll: self theTurtleNatFemales.
turtleNat addAll: self theTurtleNatMales.

Hope this helps.

  

New Message Reply Date view Thread view Subject view Author view
 

Back to home