[squeak-dev] The Trunk: Kernel-nice.451.mcz
commits at source.squeak.org
commits at source.squeak.org
Thu May 6 19:15:36 UTC 2010
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.451.mcz
==================== Summary ====================
Name: Kernel-nice.451
Author: nice
Time: 6 May 2010, 9:15:03.298 pm
UUID: 55b7ba84-6fa3-9e49-89a6-c42ce2ae82fc
Ancestors: Kernel-ar.450
1) Add a class comment for Categorizer (both for testing MC and because class comments are a good thing).
2) Let a chance for NumberParser subclasses to parse a leading plus before an integer.
3) Skip backward in case of invalid radix, just to have the message inlined where due in code panes.
=============== Diff against Kernel-ar.450 ===============
Item was changed:
----- Method: NumberParser>>nextIntegerBase: (in category 'parsing-public') -----
nextIntegerBase: aRadix
"Form an integer with following digits.
Fail if no digit found"
| isNeg value |
+ isNeg := self peekSignIsMinus.
- isNeg := sourceStream peekFor: $-.
value := self nextUnsignedIntegerBase: aRadix.
^isNeg
ifTrue: [value negated]
ifFalse: [value]!
Item was changed:
----- Method: SqNumberParser>>nextNumber (in category 'parsing-public') -----
nextNumber
"main method for reading a number.
This one can read Float Integer and ScaledDecimal"
| numberOfTrailingZeroInIntegerPart |
base := 10.
neg := self peekSignIsMinus.
integerPart := self nextUnsignedIntegerOrNilBase: base.
integerPart ifNil: [
"This is not a regular number beginning with a digit
It is time to check for exceptional condition NaN and Infinity"
^self readNamedFloatOrFail].
numberOfTrailingZeroInIntegerPart := nDigits - lastNonZero.
(sourceStream peekFor: $r)
ifTrue: ["<base>r<integer>"
(base := integerPart) < 2
+ ifTrue: [
+ sourceStream skip: -1.
+ ^ self expected: 'an integer greater than 1 as valid radix'].
- ifTrue: [^ self expected: 'an integer greater than 1 as valid radix'].
self peekSignIsMinus
ifTrue: [neg := neg not].
integerPart := self nextUnsignedIntegerBase: base.
numberOfTrailingZeroInIntegerPart := nDigits - lastNonZero].
^ (sourceStream peekFor: $.)
ifTrue: [self readNumberWithFractionPartNumberOfTrailingZeroInIntegerPart: numberOfTrailingZeroInIntegerPart]
ifFalse: [self makeIntegerOrScaledInteger]!
Item was changed:
Object subclass: #Categorizer
instanceVariableNames: 'categoryArray categoryStops elementArray'
classVariableNames: 'Default NullCategory'
poolDictionaries: ''
category: 'Kernel-Classes'!
+
+ !Categorizer commentStamp: 'nice 5/6/2010 21:10' prior: 0!
+ A Categorizer goal is to classify the elements of a collection into categories.
+ It is typically used to classify methods of class into categories (also named protocols in this case).
+
+ Instance Variables
+ categoryArray: <SequenceableCollection of: Object>
+ categoryStops: <SequenceableCollection of: Integer>
+ elementArray: <SequenceableCollection of: Object>
+
+ categoryArray
+ - holds the list of categories.
+ A category could be any Object but is generally a String or Symbol.
+ Categories should be unique (categoryArray asSet size = categoryArray size)
+
+ categoryStops
+ - holds the index of last element belonging to each category.
+ There should be a category stop for each category (categoryStops size = categoryArray size).
+ The categoryStops should be sorted (categoryStops sorted = categoryStops).
+ A category stop equal to its predecessor (= 0 for the first category stop) denotes an empty category.
+
+ elementArray
+ - holds the elements to be classified. The elements are sorted by category.
+
+ Class variables
+ Default is the default category used to classify yet unclassified methods of a class
+ NullCategory is the category to be displayed in a Browser for a class having no method.
+ !
More information about the Squeak-dev
mailing list
|