equal
deleted
inserted
replaced
8 be provided or otherwise made available to, or used by, any |
8 be provided or otherwise made available to, or used by, any |
9 other person. No title to or ownership of the software is |
9 other person. No title to or ownership of the software is |
10 hereby transferred. |
10 hereby transferred. |
11 " |
11 " |
12 |
12 |
13 VariableArray subclass:#StringCollection |
13 OrderedCollection subclass:#StringCollection |
14 instanceVariableNames:'' |
14 instanceVariableNames:'' |
15 classVariableNames:'' |
15 classVariableNames:'' |
16 poolDictionaries:'' |
16 poolDictionaries:'' |
17 category:'Collections-Text' |
17 category:'Collections-Text' |
18 ! |
18 ! |
45 - there is something totally different also named Text in ST-80 ... |
45 - there is something totally different also named Text in ST-80 ... |
46 " |
46 " |
47 ! ! |
47 ! ! |
48 |
48 |
49 !StringCollection class methodsFor:'instance creation'! |
49 !StringCollection class methodsFor:'instance creation'! |
|
50 |
|
51 new:size |
|
52 "return a new string collection with size empty lines" |
|
53 |
|
54 ^ (super new:size) grow:size |
|
55 ! |
50 |
56 |
51 from:aString |
57 from:aString |
52 "return a new text object with lines taken from the argument, aString" |
58 "return a new text object with lines taken from the argument, aString" |
53 |
59 |
54 ^ (self new:1) from:aString |
60 ^ (self new:1) from:aString |
114 ]. |
120 ]. |
115 start := stop + 2 |
121 start := stop + 2 |
116 ] |
122 ] |
117 ! ! |
123 ! ! |
118 |
124 |
119 !StringCollection methodsFor:'growing'! |
|
120 |
|
121 add:aString |
|
122 "append the argument, aString to myself - |
|
123 we increase physical size by 50 to avoid lots of copying around" |
|
124 |
|
125 |oldSize "{ Class:SmallInteger }"| |
|
126 |
|
127 oldSize := tally. |
|
128 super grow:(oldSize + 50). |
|
129 tally := oldSize + 1. |
|
130 contentsArray at:tally put:aString |
|
131 ! |
|
132 |
|
133 grow:newSize |
|
134 "grow to newsize - new elements are initialized with empty strings - |
|
135 not nil" |
|
136 |
|
137 |oldSize "{ Class:SmallInteger }"| |
|
138 |
|
139 oldSize := tally. |
|
140 super grow:newSize. |
|
141 (oldSize < newSize) ifTrue:[ |
|
142 contentsArray from:(oldSize + 1) to:newSize put:'' |
|
143 ] |
|
144 ! ! |
|
145 |
|
146 !StringCollection methodsFor:'printing'! |
125 !StringCollection methodsFor:'printing'! |
147 |
126 |
148 printString |
127 printString |
149 "return the receivers printString" |
128 "return the receivers printString" |
150 |
129 |
169 ! ! |
148 ! ! |
170 |
149 |
171 !StringCollection class methodsFor:'documentation'! |
150 !StringCollection class methodsFor:'documentation'! |
172 |
151 |
173 version |
152 version |
174 ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.19 1995-11-23 17:28:32 cg Exp $' |
153 ^ '$Header: /cvs/stx/stx/libbasic/StringCollection.st,v 1.20 1995-11-24 20:55:31 cg Exp $' |
175 ! ! |
154 ! ! |