[Glass] Is there a less hacky way of getting indexes of an unordered collection?

James Foster via Glass glass at lists.gemtalksystems.com
Fri Jun 12 14:24:11 PDT 2015


I generally use #’equalityIndexedPaths’ and #’identityIndexedPaths’ found in the ‘Accessing Indexes’ category in UnorderedCollection.

James

> On Jun 12, 2015, at 2:12 PM, Mariano Martinez Peck via Glass <glass at lists.gemtalksystems.com> wrote:
> 
> OK...I found #getIndexInfo. Was difficult to find since it is in protocol 'Repository Conversion'.
> 
> Thanks,
> 
> On Fri, Jun 12, 2015 at 6:05 PM, Mariano Martinez Peck <marianopeck at gmail.com <mailto:marianopeck at gmail.com>> wrote:
> I had to implement such an extension method:
> 
> getCurrentIndexes
> | result iList |
> result := OrderedCollection new.
> iList := self _indexedPaths.
> iList == nil
>   ifFalse: [
>     2 to: iList size by: 2 do: [ :i |
>       (iList at: i) > 0 ifTrue: [ result add: (iList at: i - 1) ]
>     ]
>   ].
> ^ result
> 
> But it seems a bit hacky and cryptic. I am using GemStone 3.1.0.6.
> 
> Thanks!
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
> 
> 
> 
> -- 
> Mariano
> http://marianopeck.wordpress.com <http://marianopeck.wordpress.com/>
> _______________________________________________
> Glass mailing list
> Glass at lists.gemtalksystems.com
> http://lists.gemtalksystems.com/mailman/listinfo/glass

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/private/glass/attachments/20150612/1671ee49/attachment.html>


More information about the Glass mailing list