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

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

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

GLASS mailing list
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!

--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Is there a less hacky way of getting indexes of an unordered collection?

GLASS mailing list
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 <[hidden email]> 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!

--



--

_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass
Reply | Threaded
Open this post in threaded view
|

Re: Is there a less hacky way of getting indexes of an unordered collection?

GLASS mailing list
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 <[hidden email]> 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 <[hidden email]> 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!

--



--
_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass


_______________________________________________
Glass mailing list
[hidden email]
http://lists.gemtalksystems.com/mailman/listinfo/glass