ReindexedCollection.st
author Claus Gittinger <cg@exept.de>
Sat, 02 May 2020 21:40:13 +0200
changeset 5476 7355a4b11cb6
parent 4713 94dfbb936913
permissions -rw-r--r--
#FEATURE by cg class: Socket class added: #newTCPclientToHost:port:domain:domainOrder:withTimeout: changed: #newTCPclientToHost:port:domain:withTimeout:
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1924
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     1
"
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     2
 COPYRIGHT (c) 2006 by eXept Software AG
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     3
              All Rights Reserved
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     4
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     5
 This software is furnished under a license and may be used
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     6
 only in accordance with the terms of that license and with the
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     8
 be provided or otherwise made available to, or used by, any
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
     9
 other person.  No title to or ownership of the software is
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    10
 hereby transferred.
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    11
"
1753
f9be6a841a22 ReindexedCollectionCVS: ----------------------------------------------------------------------
Claus Gittinger <cg@exept.de>
parents: 1618
diff changeset
    12
"{ Package: 'stx:libbasic2' }"
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
3687
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
    14
"{ NameSpace: Smalltalk }"
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
    15
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
SequenceableCollection subclass:#ReindexedCollection
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	instanceVariableNames:'sequence interval'
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	classVariableNames:''
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
	poolDictionaries:''
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
	category:'Collections-Sequenceable'
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
!ReindexedCollection class methodsFor:'documentation'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
1924
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    25
copyright
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    26
"
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    27
 COPYRIGHT (c) 2006 by eXept Software AG
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    28
              All Rights Reserved
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    29
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    30
 This software is furnished under a license and may be used
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    31
 only in accordance with the terms of that license and with the
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    32
 inclusion of the above copyright notice.   This software may not
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    33
 be provided or otherwise made available to, or used by, any
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    34
 other person.  No title to or ownership of the software is
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    35
 hereby transferred.
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    36
"
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    37
!
4f84cb037a21 copyright
Claus Gittinger <cg@exept.de>
parents: 1753
diff changeset
    38
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
documentation
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    ReindexedCollection is a wrapper around a sequenceable collection that remaps the indices 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    with in linear algorithm.  
4145
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    43
    The elements in the ReindexedCollection are the elements of the original collection 
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    44
    at 'some start' to 'some stop' (optionally 'by some step').  
1453
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
    45
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
    46
    ReindexedCollection allows for efficient use of first/rest-like algorithms (i.e. aka Lisp)
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
    47
    applied to Sequenceable collections, as they avoid element-copying.
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
    48
4145
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    49
    For example,
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    50
        coll1 := #(1 2 3 4 5 6 7 8 9 10).
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    51
        coll2 := coll1 from:8.
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    52
    gives us a collection in coll2, which 'contains' 3 elements, 8, 9, 10
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    53
    with indices 1,2,3. 
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    54
    I.e. a slice from the other array.
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    55
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    56
    The reindexed collection is 'read-only'. I.e. it does not allow for elements to be changed.
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    57
    
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    See class side examples.
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    [Instance Variables:]
4145
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    61
        sequence        <SequenceableCollection>    the sequence that will be reindexed.
dac736be1523 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3861
diff changeset
    62
        interval        <Interval>                  the object that describes indicies of interest in the sequence.
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
1191
f527b4561175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
    64
    [Origin:]
f527b4561175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
    65
        Part of the Engineering Math Goodies package from Travis.
f527b4561175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
    66
    
f527b4561175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
    67
    [Author:]
f527b4561175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
    68
        Travis Griggs (tgriggs@keyww.com or tkc@bmi.net)
f527b4561175 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
    69
        Ported from Squeak by Claus Gittinger (not much of a port, though)
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
examples
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    |coll|
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
1618
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    77
    coll := #(1 2 3 4 5 6 7 8 9 10) from:8.
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    78
    Transcript show:'from 8: '; showCR:coll.     
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    79
    Transcript show:'size: '; showCR:(coll size).  
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    80
    Transcript show:'at 1: '; showCR:(coll at:1).   
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    81
    Transcript show:'first: '; showCR:(coll first).   
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    82
    Transcript show:'last: '; showCR:(coll last).   
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    83
    coll do:[:each | Transcript show:'do: '; showCR:each].
63a351ca7d76 comments
Claus Gittinger <cg@exept.de>
parents: 1453
diff changeset
    84
    coll reverseDo:[:each | Transcript show:'reverseDo: '; showCR:each].
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
    |coll|
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
    coll := (1 to:10) asOrderedCollection from:3 to:8.
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    coll.     
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
    coll size.  
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
    coll at:1.   
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    coll do:[:each | Transcript showCR:each].
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    |coll|
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    coll := (1 to:10) asOrderedCollection to:4.
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    coll.     
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    coll size.  
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    coll at:1.   
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    coll last.   
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    coll do:[:each | Transcript showCR:each].
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
! !
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
!ReindexedCollection class methodsFor:'instance creation'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
on: aSequence from: start 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    "Create a reindexedCollection on aSequence from start to the end of aSequence"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    ^ self
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
        on: aSequence
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
        from: start
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
        to: aSequence size
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   116
        by: 1
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
on: aSequence from: start by: step 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
    "Create a reindexedCollection on aSequence start to the end of aSequence 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
     if step is positive, else  
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
     from start to the beginning of the sequence if step is negative."
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    ^ self
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
        on: aSequence
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
        from: start
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
        to: (step > 0
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
                ifTrue: [aSequence size]
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
                ifFalse: [1])
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
        by: step
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
on: aSequence from: start to: stop 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    "Create a reindexedCollection on aSequence from start to stop by 1 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
     (or -1 if start is greater than stop)"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    ^ self
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
        on: aSequence
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
        from: start
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
        to: stop
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
        by: (start <= stop
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
                ifTrue: [1]
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
                ifFalse: [-1])
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   145
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
on: aSequence from: start to: stop by: step 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
    "Create a reindexedCollection on aSequence from start to stop by step"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
    ^ self new
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
            initialize: aSequence
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
            from: start
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
            to: stop
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
            by: step
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
on: aSequence to: stop 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    "Create a reindexedCollection on aSequence from 1 to stop by 1"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    ^ self
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
        on: aSequence
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
        from: 1
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
        to: stop
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
        by: 1
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
on: aSequence to: stop by: step 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   167
    "Create a reindexedCollection on aSequence from 1 to stop (if step is 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
     positive) or the end to stop (if  
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
     step is negative). Note: if step is not 1 or -1, there is a chance that the 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
     index specified by stop may  
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   171
     not be in the interval."
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   172
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   173
    ^ self
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   174
        on: aSequence
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   175
        from: (step > 0
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   176
                ifTrue: [1]
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   177
                ifFalse: [aSequence size])
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   178
        to: stop
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   179
        by: step
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   180
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   181
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   182
on: aSequence with: anInterval 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   183
    "Create a reindexedCollection on aSequence"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   184
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   185
    ^ self new initialize: aSequence with: anInterval
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   186
! !
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   187
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   188
!ReindexedCollection methodsFor:'accessing'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   189
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   190
at: index 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   191
    "Answer the value of an indexable field in the sequence instance variable. "
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   192
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   193
    ^ sequence at: (interval at: index)
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   194
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   195
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   196
at: index put: value 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   197
    "Store the argument value in the indexable field of the sequence 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   198
     instance variable indicated by index.  
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   199
     Answer the value that was stored."
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   200
4342
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   201
    self shouldNotImplement. "/ I am readOnly
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   202
    ^ sequence at: (interval at: index) put: value
4342
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   203
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   204
    "Modified: / 22-02-2017 / 10:46:21 / cg"
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   205
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   206
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   207
size
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   208
    "Answer how many elements the receiver contains."
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   209
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   210
    ^ interval size
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   211
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   212
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   213
slide
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   214
    "slide by 1"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   215
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   216
    self slide: 1
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   219
slide: anIncrement 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    "given an increment, adjust the reindex map by sliding it that far"
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
    interval := interval + anIncrement
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
! !
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
!ReindexedCollection methodsFor:'adding & removing'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
add: anObject 
2931
0c2ab359a232 comment/format in: #add:
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
   228
    "report an error; reindexedCollections cannot add elements"
0c2ab359a232 comment/format in: #add:
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
   229
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   230
    self shouldNotImplement
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   231
! !
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   232
1453
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   233
!ReindexedCollection methodsFor:'converting-reindexed'!
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   234
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   235
from:startIndex
3783
fcc30a3af3df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3687
diff changeset
   236
    "return a new collection representing the receiver's elements starting at startIndex."
1453
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   237
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   238
    interval step == 1 ifTrue:[
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   239
        ^ ReindexedCollection 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   240
            on:sequence 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   241
            from:(interval start + startIndex - 1) 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   242
            to:(interval stop)
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   243
            by:(interval step)
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   244
    ].
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   245
    "could be more intelligent here..."
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   246
    ^ super from:startIndex
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   247
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   248
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   249
     |coll cdr cddr cdddr|
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   250
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   251
     coll := #(1 2 3 4 5 6 7 8 9 10).
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   252
     cdr := coll from:2.            
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   253
     cddr := cdr from:2.        
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   254
     cdddr := cddr from:2.
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   255
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   256
!
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   257
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   258
from:startIndex to:stopIndex
3783
fcc30a3af3df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3687
diff changeset
   259
    "return a new collection representing the receiver's elements 
1453
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   260
     starting at startIndex upTo and including endIndex."
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   261
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   262
    interval step == 1 ifTrue:[
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   263
        ^ ReindexedCollection 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   264
            on:sequence 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   265
            from:(interval start + startIndex - 1) 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   266
            to:((interval start + stopIndex - 1) min:interval stop)
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   267
            by:1
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   268
    ].
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   269
    "could be more intelligent here..."
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   270
    ^ super from:startIndex to:stopIndex
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   271
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   272
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   273
     |coll cdrButLast cddrButLast2 cdddrButLast3|
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   274
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   275
     coll := #(1 2 3 4 5 6 7 8 9 10).
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   276
     cdrButLast := coll from:2 to:9.             
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   277
     cddrButLast2 := cdrButLast from:2 to:7.          
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   278
     cdddrButLast3 := cddrButLast2 from:2 to:5.     
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   279
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   280
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   281
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   282
     |coll cdrButLast cddrButLast2 cdddrButLast3|
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   283
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   284
     coll := 1 to:100.
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   285
     cdrButLast := coll from:2 to:99.             
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   286
     cddrButLast2 := cdrButLast from:2 to:97.          
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   287
     cdddrButLast3 := cddrButLast2 from:2 to:95.     
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   288
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   289
!
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   290
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   291
to:stopIndex
3783
fcc30a3af3df #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 3687
diff changeset
   292
    "return a new collection representing the receiver's elements upTo and including endIndex."
1453
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   293
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   294
    interval step == 1 ifTrue:[
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   295
        ^ ReindexedCollection 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   296
            on:sequence 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   297
            from:(interval start) 
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   298
            to:((interval start + stopIndex - 1) min:interval stop)
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   299
            by:1
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   300
    ].
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   301
    "could be more intelligent here..."
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   302
    ^ super to:stopIndex
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   303
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   304
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   305
     |coll butLast butLast2 butLast3|
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   306
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   307
     coll := #(1 2 3 4 5 6 7 8 9 10).
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   308
     butLast := coll to:9.              
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   309
     butLast2 := butLast to:8.          
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   310
     butLast3 := butLast2 to:7.     
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   311
    "
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   312
! !
ecdb7d5e8c13 reindexing & comments
Claus Gittinger <cg@exept.de>
parents: 1191
diff changeset
   313
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   314
!ReindexedCollection methodsFor:'initialization'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   315
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   316
initialize: aSequence from: start to: stop by: step 
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   317
    sequence := aSequence.
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   318
    interval := Interval from: start to: stop by: step
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   319
!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   320
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   321
initialize: aSequence with: anInterval 
4342
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   322
    sequence := aSequence.
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   323
    interval := anInterval
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   324
f7a0d195e291 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 4145
diff changeset
   325
    "Modified (format): / 22-02-2017 / 10:46:38 / cg"
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   326
! !
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   327
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   328
!ReindexedCollection methodsFor:'queries'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   329
4713
94dfbb936913 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
   330
characterSize
94dfbb936913 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
   331
    ^ sequence characterSize
94dfbb936913 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
   332
94dfbb936913 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
   333
    "Created: / 26-08-2018 / 21:16:39 / Claus Gittinger"
94dfbb936913 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
   334
!
94dfbb936913 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 4342
diff changeset
   335
3020
a88b56ea6629 added isFixedSize query
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   336
isFixedSize
a88b56ea6629 added isFixedSize query
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   337
    "return true if the receiver cannot grow"
a88b56ea6629 added isFixedSize query
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   338
a88b56ea6629 added isFixedSize query
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   339
    ^ sequence isFixedSize
a88b56ea6629 added isFixedSize query
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   340
!
a88b56ea6629 added isFixedSize query
Claus Gittinger <cg@exept.de>
parents: 2931
diff changeset
   341
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   342
species
3861
694e93011ca8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   343
    "Answer the preferred class for reconstructing the receiver, 
694e93011ca8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 3783
diff changeset
   344
     that is, the sequence."
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   345
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   346
    ^ sequence species
3687
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   347
!
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   348
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   349
speciesForAdding
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   350
    "Answer the preferred class for reconstructing the receiver incrementally"
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   351
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   352
    ^ sequence speciesForAdding
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   353
! !
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   354
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   355
!ReindexedCollection class methodsFor:'documentation'!
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   356
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   357
version
3687
Claus Gittinger <cg@exept.de>
parents: 3020
diff changeset
   358
    ^ '$Header$'
1190
82af4e7d6723 initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   359
! !
2931
0c2ab359a232 comment/format in: #add:
Claus Gittinger <cg@exept.de>
parents: 1924
diff changeset
   360