--- a/Array.st Tue Aug 22 15:49:36 2000 +0200
+++ b/Array.st Tue Aug 22 15:57:33 2000 +0200
@@ -413,30 +413,6 @@
^ super basicAt:index put:anObject
"Modified: 19.4.1996 / 11:14:26 / cg"
-!
-
-basicSize
- "return the number of indexed elements in the receiver"
-
-%{ /* NOCONTEXT */
- REGISTER OBJ slf = self;
-
- RETURN ( __MKSMALLINT(__arraySize(slf) - __intVal(__ClassInstPtr(__qClass(slf))->c_ninstvars) ));
-%}
-!
-
-size
- "return the number of indexed elements in the receiver.
- Reimplemented here to avoid the additional size->basicSize send
- (which we can do here, since when arriving here, #size is obviously not
- redefined in a subclass).
- This method is the same as basicSize."
-
-%{ /* NOCONTEXT */
- REGISTER OBJ slf = self;
-
- RETURN ( __MKSMALLINT(__arraySize(slf) - __intVal(__ClassInstPtr(__qClass(slf))->c_ninstvars) ));
-%}
! !
!Array methodsFor:'converting'!
@@ -1672,6 +1648,16 @@
!Array methodsFor:'queries'!
+basicSize
+ "return the number of indexed elements in the receiver"
+
+%{ /* NOCONTEXT */
+ REGISTER OBJ slf = self;
+
+ RETURN ( __MKSMALLINT(__arraySize(slf) - __intVal(__ClassInstPtr(__qClass(slf))->c_ninstvars) ));
+%}
+!
+
refersToLiteral:aLiteral
"return true if the receiver or recursively any array element in the
receiver referes to aLiteral (i.e. a deep search)"
@@ -1691,6 +1677,20 @@
"
"Modified: / 18.8.2000 / 21:18:14 / cg"
+!
+
+size
+ "return the number of indexed elements in the receiver.
+ Reimplemented here to avoid the additional size->basicSize send
+ (which we can do here, since when arriving here, #size is obviously not
+ redefined in a subclass).
+ This method is the same as basicSize."
+
+%{ /* NOCONTEXT */
+ REGISTER OBJ slf = self;
+
+ RETURN ( __MKSMALLINT(__arraySize(slf) - __intVal(__ClassInstPtr(__qClass(slf))->c_ninstvars) ));
+%}
! !
!Array methodsFor:'searching'!
@@ -2415,5 +2415,5 @@
!Array class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.127 2000-08-22 13:46:47 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Array.st,v 1.128 2000-08-22 13:55:49 cg Exp $'
! !
--- a/ArrayedCollection.st Tue Aug 22 15:49:36 2000 +0200
+++ b/ArrayedCollection.st Tue Aug 22 15:57:33 2000 +0200
@@ -326,6 +326,15 @@
"Modified: 28.1.1997 / 00:39:59 / cg"
! !
+!ArrayedCollection methodsFor:'queries'!
+
+size
+ "redefined to re-enable size->basicSize forwarding
+ (it is caught in SequencableCollection)"
+
+ ^ self basicSize
+! !
+
!ArrayedCollection methodsFor:'resizing'!
grow:newSize
@@ -406,17 +415,10 @@
#(1 2 3) includesKey:4
#(1 2 3) includesKey:3
"
-!
-
-size
- "redefined to re-enable size->basicSize forwarding
- (it is caught in SequencableCollection)"
-
- ^ self basicSize
! !
!ArrayedCollection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ArrayedCollection.st,v 1.46 2000-08-04 16:57:09 tm Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ArrayedCollection.st,v 1.47 2000-08-22 13:55:56 cg Exp $'
! !
--- a/Bag.st Tue Aug 22 15:49:36 2000 +0200
+++ b/Bag.st Tue Aug 22 15:57:33 2000 +0200
@@ -292,6 +292,18 @@
contents := IdentityDictionary new:size
! !
+!Bag methodsFor:'queries'!
+
+size
+ "return the number of bag elements"
+
+ |count|
+
+ count := 0.
+ contents do:[:element | count := count + element].
+ ^ count
+! !
+
!Bag methodsFor:'testing'!
includes:anObject
@@ -304,20 +316,10 @@
"return how many times anObject is in the receiver"
^ contents at:anObject ifAbsent:0
-!
-
-size
- "return the number of bag elements"
-
- |count|
-
- count := 0.
- contents do:[:element | count := count + element].
- ^ count
! !
!Bag class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.25 2000-04-14 19:32:50 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Bag.st,v 1.26 2000-08-22 13:56:00 cg Exp $'
! !
--- a/Collection.st Tue Aug 22 15:49:36 2000 +0200
+++ b/Collection.st Tue Aug 22 15:57:33 2000 +0200
@@ -1954,6 +1954,19 @@
#('Array' 'arrayedCollection' 'ARRAYOfFoo') longestCommonPrefixIgnoreCase:false
#('Array' 'ArayedCollection' 'ARRAYOfFoo') longestCommonPrefixIgnoreCase:false
"
+!
+
+size
+ "return the number of elements in the receiver.
+ This is usually redefined in subclasses for more performance."
+
+ |count "{ Class: SmallInteger }" |
+
+ count := 0.
+ self do:[:element |
+ count := count + 1
+ ].
+ ^ count
! !
!Collection methodsFor:'testing'!
@@ -2093,19 +2106,6 @@
].
].
^ count
-!
-
-size
- "return the number of elements in the receiver.
- This is usually redefined in subclasses for more performance."
-
- |count "{ Class: SmallInteger }" |
-
- count := 0.
- self do:[:element |
- count := count + 1
- ].
- ^ count
! !
!Collection methodsFor:'tracing'!
@@ -2121,6 +2121,6 @@
!Collection class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.101 2000-08-17 21:54:05 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Collection.st,v 1.102 2000-08-22 13:56:10 cg Exp $'
! !
Collection initialize!
--- a/ExternalBytes.st Tue Aug 22 15:49:36 2000 +0200
+++ b/ExternalBytes.st Tue Aug 22 15:57:33 2000 +0200
@@ -804,13 +804,6 @@
"Modified: 19.4.1996 / 11:15:05 / cg"
!
-basicSize
- "we do not know how many bytes are valid"
-
- size isNil ifTrue:[^ 0].
- ^ size
-!
-
byteAt:index
"return the unsigned byte at index, anInteger.
Indices are 1-based, therefore
@@ -922,6 +915,15 @@
^ self error:'cannot change address'
! !
+!ExternalBytes methodsFor:'queries'!
+
+basicSize
+ "we do not know how many bytes are valid"
+
+ size isNil ifTrue:[^ 0].
+ ^ size
+! !
+
!ExternalBytes methodsFor:'registration'!
protectFromGC
@@ -953,6 +955,6 @@
!ExternalBytes class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/ExternalBytes.st,v 1.29 2000-06-19 11:37:06 ps Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/ExternalBytes.st,v 1.30 2000-08-22 13:56:32 cg Exp $'
! !
ExternalBytes initialize!
--- a/Float.st Tue Aug 22 15:49:36 2000 +0200
+++ b/Float.st Tue Aug 22 15:57:33 2000 +0200
@@ -1521,7 +1521,9 @@
^ self elementBoundsError
].
^ self subscriptBoundsError:index
-!
+! !
+
+!Float methodsFor:'queries'!
basicSize
"return the size in bytes of the float.
@@ -2081,6 +2083,6 @@
!Float class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.111 2000-08-21 22:44:01 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Float.st,v 1.112 2000-08-22 13:56:43 cg Exp $'
! !
Float initialize!
--- a/Interval.st Tue Aug 22 15:49:36 2000 +0200
+++ b/Interval.st Tue Aug 22 15:57:33 2000 +0200
@@ -125,21 +125,6 @@
^ stop
!
-size
- "return the number of elements in the collection"
-
- (step < 0) ifTrue:[
- (start < stop) ifTrue:[
- ^ 0
- ].
- ^ stop - start // step + 1
- ].
- (stop < start) ifTrue:[
- ^ 0
- ].
- ^ stop - start // step + 1
-!
-
start
"return the first number of the range"
@@ -331,8 +316,25 @@
^ OrderedCollection
! !
+!Interval methodsFor:'queries'!
+
+size
+ "return the number of elements in the collection"
+
+ (step < 0) ifTrue:[
+ (start < stop) ifTrue:[
+ ^ 0
+ ].
+ ^ stop - start // step + 1
+ ].
+ (stop < start) ifTrue:[
+ ^ 0
+ ].
+ ^ stop - start // step + 1
+! !
+
!Interval class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.26 2000-08-15 14:31:18 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Interval.st,v 1.27 2000-08-22 13:56:51 cg Exp $'
! !
--- a/LimitedPrecisionReal.st Tue Aug 22 15:49:36 2000 +0200
+++ b/LimitedPrecisionReal.st Tue Aug 22 15:57:33 2000 +0200
@@ -71,12 +71,6 @@
"redefined to prevent access to individual bytes in a real"
self error:'not allowed for floats/doubles'
-!
-
-size
- "redefined since reals are kludgy (ByteArry)"
-
- ^ 0
! !
!LimitedPrecisionReal methodsFor:'arithmetic'!
@@ -444,6 +438,13 @@
"Modified: / 20.1.1998 / 14:10:47 / stefan"
! !
+!LimitedPrecisionReal methodsFor:'queries'!
+
+size
+ "redefined since reals are kludgy (ByteArry)"
+
+ ^ 0
+! !
!LimitedPrecisionReal methodsFor:'testing'!
@@ -517,5 +518,5 @@
!LimitedPrecisionReal class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.35 2000-07-18 09:01:52 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/LimitedPrecisionReal.st,v 1.36 2000-08-22 13:56:55 cg Exp $'
! !
--- a/MethodDictionary.st Tue Aug 22 15:49:36 2000 +0200
+++ b/MethodDictionary.st Tue Aug 22 15:57:33 2000 +0200
@@ -10,6 +10,8 @@
hereby transferred.
"
+"{ Package: 'stx:libbasic' }"
+
Collection variableSubclass:#MethodDictionary
instanceVariableNames:''
classVariableNames:''
@@ -321,12 +323,6 @@
"Created: 7.6.1996 / 15:57:56 / stefan"
"Modified: 7.6.1996 / 16:47:02 / stefan"
"Modified: 12.2.1997 / 19:47:23 / cg"
-!
-
-size
- "return the number of elements (associations) in the receiver"
-
- ^ self basicSize // 2
! !
!MethodDictionary methodsFor:'binary storage'!
@@ -520,6 +516,12 @@
"Modified: 23.1.1997 / 13:56:13 / cg"
!
+size
+ "return the number of elements (associations) in the receiver"
+
+ ^ self basicSize // 2
+!
+
values
"return a collection containing all values of the receiver"
@@ -547,5 +549,5 @@
!MethodDictionary class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/MethodDictionary.st,v 1.21 1998-05-18 12:29:55 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/MethodDictionary.st,v 1.22 2000-08-22 13:57:14 cg Exp $'
! !
--- a/Set.st Tue Aug 22 15:49:36 2000 +0200
+++ b/Set.st Tue Aug 22 15:57:33 2000 +0200
@@ -866,6 +866,13 @@
].
! !
+!Set methodsFor:'queries'!
+
+size
+ "return the number of set elements"
+
+ ^ tally
+! !
!Set methodsFor:'set operations'!
@@ -964,12 +971,6 @@
-!
-
-size
- "return the number of set elements"
-
- ^ tally
! !
!Set::EmptySlot class methodsFor:'instance creation'!
@@ -985,6 +986,6 @@
!Set class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.64 2000-07-18 09:03:39 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.65 2000-08-22 13:57:23 cg Exp $'
! !
Set initialize!
--- a/String.st Tue Aug 22 15:49:36 2000 +0200
+++ b/String.st Tue Aug 22 15:57:33 2000 +0200
@@ -540,46 +540,6 @@
super basicAt:index put:aCharacter asciiValue.
^ aCharacter
-!
-
-basicSize
- "return the number of characters in myself.
- Redefined here to exclude the 0-byte at the end."
-
-%{ /* NOCONTEXT */
- REGISTER OBJ slf, cls;
-
- slf = self;
-
- cls = __qClass(slf);
- if (cls == String) {
- RETURN ( __MKSMALLINT(__stringSize(slf)) );
- }
- RETURN ( __MKSMALLINT(__stringSize(slf)
- - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
-%}.
- ^ super basicSize - 1
-
-!
-
-size
- "return the number of characters in myself.
- Reimplemented here to avoid the additional size->basicSize send
- (which we can do here, since size is obviously not redefined in a subclass).
- This method is the same as basicSize."
-
-%{ /* NOCONTEXT */
- REGISTER OBJ cls, slf;
-
- slf = self;
- cls = __qClass(slf);
- if (cls == String) {
- RETURN ( __MKSMALLINT(__stringSize(slf)) );
- }
- RETURN ( __MKSMALLINT(__stringSize(slf)
- - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
-%}.
- ^ self basicSize
! !
!String methodsFor:'binary storage'!
@@ -2681,6 +2641,26 @@
!String methodsFor:'queries'!
+basicSize
+ "return the number of characters in myself.
+ Redefined here to exclude the 0-byte at the end."
+
+%{ /* NOCONTEXT */
+ REGISTER OBJ slf, cls;
+
+ slf = self;
+
+ cls = __qClass(slf);
+ if (cls == String) {
+ RETURN ( __MKSMALLINT(__stringSize(slf)) );
+ }
+ RETURN ( __MKSMALLINT(__stringSize(slf)
+ - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
+%}.
+ ^ super basicSize - 1
+
+!
+
bitsPerCharacter
"return the number of bits each character has.
Here, 8 is returned (storing single byte characters)."
@@ -2713,6 +2693,26 @@
'hello' knownAsSymbol
'fooBarBaz' knownAsSymbol
"
+!
+
+size
+ "return the number of characters in myself.
+ Reimplemented here to avoid the additional size->basicSize send
+ (which we can do here, since size is obviously not redefined in a subclass).
+ This method is the same as basicSize."
+
+%{ /* NOCONTEXT */
+ REGISTER OBJ cls, slf;
+
+ slf = self;
+ cls = __qClass(slf);
+ if (cls == String) {
+ RETURN ( __MKSMALLINT(__stringSize(slf)) );
+ }
+ RETURN ( __MKSMALLINT(__stringSize(slf)
+ - __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars))));
+%}.
+ ^ self basicSize
! !
!String methodsFor:'regular expression matching'!
@@ -3093,5 +3093,5 @@
!String class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.153 2000-08-22 13:49:32 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/String.st,v 1.154 2000-08-22 13:57:30 cg Exp $'
! !
--- a/UndefinedObject.st Tue Aug 22 15:49:36 2000 +0200
+++ b/UndefinedObject.st Tue Aug 22 15:57:33 2000 +0200
@@ -286,6 +286,21 @@
^ 'nil'
! !
+!UndefinedObject methodsFor:'queries'!
+
+basicSize
+ "return the number of indexed instvars
+ defined here since size in Object ommits the nil-check"
+
+ ^ 0
+!
+
+size
+ "return the number of indexed instvars
+ defined here since size in Object ommits the nil-check"
+
+ ^ 0
+! !
!UndefinedObject methodsFor:'subclass creation'!
@@ -498,13 +513,6 @@
"Modified: / 19.5.1998 / 17:42:10 / cg"
!
-basicSize
- "return the number of indexed instvars
- defined here since size in Object ommits the nil-check"
-
- ^ 0
-!
-
hash
"return an integer useful as a hash key"
@@ -572,13 +580,6 @@
- redefining it may not work as expected."
^ false
-!
-
-size
- "return the number of indexed instvars
- defined here since size in Object ommits the nil-check"
-
- ^ 0
! !
!UndefinedObject methodsFor:'tracing'!
@@ -591,10 +592,9 @@
! !
-
!UndefinedObject class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.45 2000-07-18 09:04:22 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/UndefinedObject.st,v 1.46 2000-08-22 13:57:33 cg Exp $'
! !
UndefinedObject initialize!