I could overwrite XMLOrderedList
 
replaceFrom: aStartingIndex to: anEndingIndex with: aCollection startingAt: 
aReplacementStart

        
        collection
                replaceFrom: aStartingIndex
                to: anEndingIndex
                with: aCollection
                startingAt: aReplacementStart

to make it grow? But I do not really know the impact on the XML library

>       self makeRoomFor: (anEndingIndex- self capacity).

any idea?

Stef




On Mar 3, 2013, at 9:34 AM, Stéphane Ducasse <stephane.duca...@inria.fr> wrote:

> Hi guys
> 
> in 1.2.1 
> 
>       OrderedCollection new replaceFrom: 1 to: 5 with: #(6 7 8 9 10) 
> startingAt: 1
>       gave
>               an OrderedCollection(6 7 8 9 10)
> 
> 
> while in 1.4 and 2.0 
>       OrderedCollection new  replaceFrom: 1 to: 5 with: #(6 7 8 9 10) 
> startingAt: 1 
>               raised an error
> 
> Do you have an idea how I can handle that? Because XMLObservableList and 
> XMLOrderedList implements 
> replaceFrom: to: with: startingAt:
> 
> because there is no self makeRoomFor: (stop - self capacity) invocation.
> 
> 
> in 1.4>> 
> replaceFrom: start to: stop with: replacement startingAt: repStart 
>       "This destructively replaces elements from start to stop in the 
> receiver 
>       starting at index, repStart, in the sequenceable collection, 
>       replacementCollection. Answer the receiver. No range checks are 
>       performed."
> 
>       | index repOff |
>       repOff := repStart - start.
>       index := start - 1.
>       [(index := index + 1) <= stop]
>               whileTrue: [self at: index put: (replacement at: repOff + 
> index)]
> 
> at: anInteger put: anObject 
>       "Put anObject at element index anInteger. at:put: cannot be used to
>       append, front or back, to an ordered collection; it is used by a
>       knowledgeable client to replace an element."
>       self ensureBoundsFrom: anInteger to: anInteger.
>       ^array at: anInteger + firstIndex - 1 put: anObject
> 
> 
> in 1.2.1
> 
> replaceFrom: start to: stop with: replacement startingAt: repStart
>       "An ordered collection is growable, so a call to this can make the 
> collection grow."
>       self makeRoomFor: (stop - self capacity).
>       array
>               replaceFrom: start + firstIndex - 1
>               to: stop + firstIndex - 1
>               with: replacement 
>               startingAt: repStart.
>       lastIndex := lastIndex max: stop + firstIndex - 1.


Reply via email to