Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: Bug (???) recursive neighbourhood

New Message Reply Date view Thread view Subject view Author view

Subject: Re: Bug (???) recursive neighbourhood
From: Pierre Bommel (bommel@cirad.fr)
Date: Fri Nov 21 2003 - 13:55:50 CET

Hello Louise,

Yes, you are right, Louise, but Stan had already warned the list for
this bug ! ;o)
The solution he proposed was :
recursiveNeighbourhood: n
        | ensemble peripherie newVoisins |
        ensemble := OrderedCollection new.
        ensemble add: self.
        peripherie := OrderedCollection new.
        peripherie add: self.
        n timesRepeat:
                        [newVoisins := OrderedCollection new.
                        peripherie do: [:p | p neighbourhood do:[:v|
(newVoisins includes: v) ifFalse: [newVoisins add: v]]].
                        newVoisins := newVoisins reject: [ :i | ensemble
includes: i ].
                        peripherie := newVoisins reject: [ :i | ensemble
includes: i ].
                        ensemble addAll: newVoisins].
        ^ensemble
I prefere this one because "asSet" and "asOrderedCollection" use some
random behaviours.
This bug will be removed from the next Cormas version.
Say hello to Stellenbosch. Best wishes,

    Pierre

"Erasmus L " a écrit :

> Hi Everyone
>
> I’m not sure whether I misunderstand the purpose of the method
> “recursiveNeighbourhood:” or whether there is (heaven forbid!) a bug
> in the new Cormas, but it returns a collection of cells that contains
> many duplicates. The problem can be resolved by sending “asSet
> asOrderedCollection” to the returned collection. Which will mess up
> their order of presentation – if that is important.
>
> Best wishes,
>
> Louise Erasmus
>
> Finding the solution to a complex problem is easy once you understand
> the problem (which is the difficult part)...
>
> Residential address:
>
> Biocomplexity Research Group
>
> Department of Zoology
>
> University of Stellenbosch
>
> Stellenbosch
>
> 7602
>
> South Africa
>
> Tel. + 27 - 21 - 808 2604
>
> Affiliation address:
>
> Conservation Planning Unit
>
> Department of Zoology and Entomology
>
> University of Pretoria
>
> Pretoria
>
> 0002
>
> South Africa
>
> Tel. +27 - 12 - 420 4048
>
> e-mail:lerasmus@zoology.up.ac.za
>
> Please use the residential address
>

--
***********************************
  Pierre Bommel
  CIRAD TA 60/15
  73, rue Jean-François Breton
  34398 Montpellier cedex 5 France
  Phone: +33 (0)4 67 59 38 53
  Fax: +33 (0)4 67 59 38 27
  http://cormas.cirad.fr
***********************************

New Message Reply Date view Thread view Subject view Author view
 

Back to home