Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1095.mcz
==================== Summary ====================
Name: Morphic-mt.1095
Author: mt
Time: 31 March 2016, 1:04:44.478525 pm
UUID: 277ef4bb-1fb5-40a2-b443-1d0555ebc707
Ancestors: Morphic-kfr.1094
Make it possible that new-style balloon morphs can appear also at the morph's center and not only close to the hand position. Also adds the possibility to open multiple balloon morphs at once via subsequent calls to Morph >> #showBalloon.
=============== Diff against Morphic-kfr.1094 ===============
Item was added:
+ ----- Method: BalloonMorph>>popUp (in category 'initialization') -----
+ popUp
+
+ | w worldBounds |
+
+ target ifNil: [^ self].
+ target isInWorld ifFalse: [^ self].
+
+ w := target world.
+
+ self lock.
+ self fullBounds. "force layout"
+ self setProperty: #morphicLayerNumber toValue: self morphicLayerNumber.
+ "So that if the translation below makes it overlap the receiver, it won't
+ interfere with the rootMorphsAt: logic and hence cause flashing. Without
+ this, flashing happens, believe me!!"
+ ((worldBounds := w bounds) containsRect: self bounds) ifFalse:
+ [self bounds: (self bounds translatedToBeWithin: worldBounds)].
+
+ self openInWorld.
+ w activeHand addBalloonHelp: self.
+ !
Item was changed:
----- Method: BalloonMorph>>popUpForHand: (in category 'initialization') -----
popUpForHand: aHand
"Pop up the receiver as balloon help for the given hand"
| worldBounds |
self lock.
self fullBounds. "force layout"
self setProperty: #morphicLayerNumber toValue: self morphicLayerNumber.
aHand world addMorphFront: self.
"So that if the translation below makes it overlap the receiver, it won't
interfere with the rootMorphsAt: logic and hence cause flashing. Without
this, flashing happens, believe me!!"
((worldBounds := aHand world bounds) containsRect: self bounds) ifFalse:
[self bounds: (self bounds translatedToBeWithin: worldBounds)].
+ aHand resetBalloonHelp: self.
- aHand balloonHelp: self.
!
Item was added:
+ ----- Method: HandMorph>>addBalloonHelp: (in category 'balloon help') -----
+ addBalloonHelp: aBalloonMorph
+ "Associate a new balloon morph with this hand."
+
+ aBalloonMorph ifNotNil: [:m | self balloonHelpList add: m].!
Item was removed:
- ----- Method: HandMorph>>balloonHelp (in category 'balloon help') -----
- balloonHelp
- "Return the balloon morph associated with this hand"
- ^self valueOfProperty: #balloonHelpMorph!
Item was removed:
- ----- Method: HandMorph>>balloonHelp: (in category 'balloon help') -----
- balloonHelp: aBalloonMorph
- "Return the balloon morph associated with this hand"
- | oldHelp |
- oldHelp := self balloonHelp.
- oldHelp ifNotNil:[oldHelp delete].
- aBalloonMorph
- ifNil:[self removeProperty: #balloonHelpMorph]
- ifNotNil:[self setProperty: #balloonHelpMorph toValue: aBalloonMorph]!
Item was added:
+ ----- Method: HandMorph>>balloonHelpList (in category 'balloon help') -----
+ balloonHelpList
+ "Return all balloon morphs associated with this hand"
+
+ ^ self
+ valueOfProperty: #balloonHelpMorphs
+ ifAbsentPut: [OrderedCollection new]!
Item was changed:
----- Method: HandMorph>>deleteBalloonTarget: (in category 'balloon help') -----
deleteBalloonTarget: aMorph
+ "Delete any existing balloon help."
- "Delete any existing balloon help. This is now done unconditionally, whether or not the morph supplied is the same as the current balloon target"
+ self balloonHelpList
+ do: [:ea | ea delete];
+ removeAll.!
- self balloonHelp: nil
-
- " | h |
- h := self balloonHelp ifNil: [^ self].
- h balloonOwner == aMorph ifTrue: [self balloonHelp: nil]"!
Item was added:
+ ----- Method: HandMorph>>resetBalloonHelp: (in category 'balloon help') -----
+ resetBalloonHelp: aBalloonMorph
+ "Associate a new balloon morph with this hand. Remove all other ones."
+
+ self
+ deleteBalloonTarget: nil;
+ addBalloonHelp: aBalloonMorph.!
Item was added:
+ ----- Method: Morph>>showBalloon (in category 'halos and balloon help') -----
+ showBalloon
+
+ self showBalloon: self balloonText.!
Item was changed:
----- Method: Morph>>showBalloon: (in category 'halos and balloon help') -----
showBalloon: msgString
+ "Pop up a balloon containing the given string."
+
+ self isInWorld ifFalse: [^ self].
+ (msgString isNil or: [msgString isEmpty]) ifTrue: [^ self].
+
+ (self balloonMorphClass
+ string: msgString
+ for: self balloonHelpAligner)
+ popUp.!
- "Pop up a balloon containing the given string,
- first removing any existing BalloonMorphs in the world."
- | w |
- self showBalloon: msgString hand: ((w := self world) ifNotNil:[w activeHand]).!
Item was changed:
----- Method: Morph>>showBalloon:hand: (in category 'halos and balloon help') -----
showBalloon: msgString hand: aHand
+ "Pop up a balloon containing the given string. Note that any existing BalloonMorphs will be removed from the world."
- "Pop up a balloon containing the given string,
- first removing any existing BalloonMorphs in the world."
+ | balloon |
+ self isInWorld ifFalse: [^ self].
+
+ balloon := (self balloonMorphClass
- | w balloon h |
- (w := self world) ifNil: [^ self].
- h := aHand.
- h ifNil:[
- h := w activeHand].
- balloon := self balloonMorphClass
string: msgString
+ for: self balloonHelpAligner).
+
+ balloon
+ popUpFor: self
+ hand: (aHand ifNil: [self world activeHand]).!
- for: self balloonHelpAligner.
- balloon popUpFor: self hand: h.!
Item was added:
+ ----- Method: NewBalloonMorph>>popUp (in category 'initialization') -----
+ popUp
+ "No tail. Centered in the balloon owner. Do not remove other balloon helps."
+
+ | w |
+ self balloonOwner ifNil: [^ self].
+ self balloonOwner isInWorld ifFalse: [^ self].
+
+ w := self balloonOwner world.
+
+ self hasTail: false.
+ self center: self balloonOwner center.
+ self bounds: (self bounds translatedToBeWithin: w bounds).
+
+ w activeHand addBalloonHelp: self.
+ self openInWorld.!
Item was changed:
----- Method: NewBalloonMorph>>popUpAt:forHand: (in category 'initialization') -----
popUpAt: point forHand: aHand
"Pop up the receiver as balloon help for the given hand"
#(bottomLeft topLeft bottomRight topRight) detect: [:nextOrientation |
| pointWithOffset |
self orientation: nextOrientation.
pointWithOffset := point + self tailOffset.
self move: pointWithOffset.
self bounds: (self bounds translatedToBeWithin: aHand world bounds).
(self bounds perform: self orientation) = pointWithOffset] ifNone: ["Keep last try."].
aHand world addMorphFront: self.
+ aHand resetBalloonHelp: self.!
- aHand balloonHelp: self.!
Item was changed:
+ (PackageInfo named: 'Morphic') postscript: 'Editor initialize.
+
+ SystemWindow allSubInstancesDo: [:ea |
+ ea paneMorphs do: #comeToFront.
+ ea labelArea comeToFront].
+
+ HandMorph allInstancesDo: [:hand |
+ hand removeProperty: #balloonHelpMorph].'!
- (PackageInfo named: 'Morphic') postscript: 'Editor initialize.'!
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1095.mcz
==================== Summary ====================
Name: Morphic-mt.1095
Author: mt
Time: 31 March 2016, 1:04:44.478525 pm
UUID: 277ef4bb-1fb5-40a2-b443-1d0555ebc707
Ancestors: Morphic-kfr.1094
Make it possible that new-style balloon morphs can appear also at the morph's center and not only close to the hand position. Also adds the possibility to open multiple balloon morphs at once via subsequent calls to Morph >> #showBalloon.
=============== Diff against Morphic-kfr.1094 ===============
Item was added:
+ ----- Method: BalloonMorph>>popUp (in category 'initialization') -----
+ popUp
+
+ | w worldBounds |
+
+ target ifNil: [^ self].
+ target isInWorld ifFalse: [^ self].
+
+ w := target world.
+
+ self lock.
+ self fullBounds. "force layout"
+ self setProperty: #morphicLayerNumber toValue: self morphicLayerNumber.
+ "So that if the translation below makes it overlap the receiver, it won't
+ interfere with the rootMorphsAt: logic and hence cause flashing. Without
+ this, flashing happens, believe me!!"
+ ((worldBounds := w bounds) containsRect: self bounds) ifFalse:
+ [self bounds: (self bounds translatedToBeWithin: worldBounds)].
+
+ self openInWorld.
+ w activeHand addBalloonHelp: self.
+ !
Item was changed:
----- Method: BalloonMorph>>popUpForHand: (in category 'initialization') -----
popUpForHand: aHand
"Pop up the receiver as balloon help for the given hand"
| worldBounds |
self lock.
self fullBounds. "force layout"
self setProperty: #morphicLayerNumber toValue: self morphicLayerNumber.
aHand world addMorphFront: self.
"So that if the translation below makes it overlap the receiver, it won't
interfere with the rootMorphsAt: logic and hence cause flashing. Without
this, flashing happens, believe me!!"
((worldBounds := aHand world bounds) containsRect: self bounds) ifFalse:
[self bounds: (self bounds translatedToBeWithin: worldBounds)].
+ aHand resetBalloonHelp: self.
- aHand balloonHelp: self.
!
Item was added:
+ ----- Method: HandMorph>>addBalloonHelp: (in category 'balloon help') -----
+ addBalloonHelp: aBalloonMorph
+ "Associate a new balloon morph with this hand."
+
+ aBalloonMorph ifNotNil: [:m | self balloonHelpList add: m].!
Item was removed:
- ----- Method: HandMorph>>balloonHelp (in category 'balloon help') -----
- balloonHelp
- "Return the balloon morph associated with this hand"
- ^self valueOfProperty: #balloonHelpMorph!
Item was removed:
- ----- Method: HandMorph>>balloonHelp: (in category 'balloon help') -----
- balloonHelp: aBalloonMorph
- "Return the balloon morph associated with this hand"
- | oldHelp |
- oldHelp := self balloonHelp.
- oldHelp ifNotNil:[oldHelp delete].
- aBalloonMorph
- ifNil:[self removeProperty: #balloonHelpMorph]
- ifNotNil:[self setProperty: #balloonHelpMorph toValue: aBalloonMorph]!
Item was added:
+ ----- Method: HandMorph>>balloonHelpList (in category 'balloon help') -----
+ balloonHelpList
+ "Return all balloon morphs associated with this hand"
+
+ ^ self
+ valueOfProperty: #balloonHelpMorphs
+ ifAbsentPut: [OrderedCollection new]!
Item was changed:
----- Method: HandMorph>>deleteBalloonTarget: (in category 'balloon help') -----
deleteBalloonTarget: aMorph
+ "Delete any existing balloon help."
- "Delete any existing balloon help. This is now done unconditionally, whether or not the morph supplied is the same as the current balloon target"
+ self balloonHelpList
+ do: [:ea | ea delete];
+ removeAll.!
- self balloonHelp: nil
-
- " | h |
- h := self balloonHelp ifNil: [^ self].
- h balloonOwner == aMorph ifTrue: [self balloonHelp: nil]"!
Item was added:
+ ----- Method: HandMorph>>resetBalloonHelp: (in category 'balloon help') -----
+ resetBalloonHelp: aBalloonMorph
+ "Associate a new balloon morph with this hand. Remove all other ones."
+
+ self
+ deleteBalloonTarget: nil;
+ addBalloonHelp: aBalloonMorph.!
Item was added:
+ ----- Method: Morph>>showBalloon (in category 'halos and balloon help') -----
+ showBalloon
+
+ self showBalloon: self balloonText.!
Item was changed:
----- Method: Morph>>showBalloon: (in category 'halos and balloon help') -----
showBalloon: msgString
+ "Pop up a balloon containing the given string."
+
+ self isInWorld ifFalse: [^ self].
+ (msgString isNil or: [msgString isEmpty]) ifTrue: [^ self].
+
+ (self balloonMorphClass
+ string: msgString
+ for: self balloonHelpAligner)
+ popUp.!
- "Pop up a balloon containing the given string,
- first removing any existing BalloonMorphs in the world."
- | w |
- self showBalloon: msgString hand: ((w := self world) ifNotNil:[w activeHand]).!
Item was changed:
----- Method: Morph>>showBalloon:hand: (in category 'halos and balloon help') -----
showBalloon: msgString hand: aHand
+ "Pop up a balloon containing the given string. Note that any existing BalloonMorphs will be removed from the world."
- "Pop up a balloon containing the given string,
- first removing any existing BalloonMorphs in the world."
+ | balloon |
+ self isInWorld ifFalse: [^ self].
+
+ balloon := (self balloonMorphClass
- | w balloon h |
- (w := self world) ifNil: [^ self].
- h := aHand.
- h ifNil:[
- h := w activeHand].
- balloon := self balloonMorphClass
string: msgString
+ for: self balloonHelpAligner).
+
+ balloon
+ popUpFor: self
+ hand: (aHand ifNil: [self world activeHand]).!
- for: self balloonHelpAligner.
- balloon popUpFor: self hand: h.!
Item was added:
+ ----- Method: NewBalloonMorph>>popUp (in category 'initialization') -----
+ popUp
+ "No tail. Centered in the balloon owner. Do not remove other balloon helps."
+
+ | w |
+ self balloonOwner ifNil: [^ self].
+ self balloonOwner isInWorld ifFalse: [^ self].
+
+ w := self balloonOwner world.
+
+ self hasTail: false.
+ self center: self balloonOwner center.
+ self bounds: (self bounds translatedToBeWithin: w bounds).
+
+ w activeHand addBalloonHelp: self.
+ self openInWorld.!
Item was changed:
----- Method: NewBalloonMorph>>popUpAt:forHand: (in category 'initialization') -----
popUpAt: point forHand: aHand
"Pop up the receiver as balloon help for the given hand"
#(bottomLeft topLeft bottomRight topRight) detect: [:nextOrientation |
| pointWithOffset |
self orientation: nextOrientation.
pointWithOffset := point + self tailOffset.
self move: pointWithOffset.
self bounds: (self bounds translatedToBeWithin: aHand world bounds).
(self bounds perform: self orientation) = pointWithOffset] ifNone: ["Keep last try."].
aHand world addMorphFront: self.
+ aHand resetBalloonHelp: self.!
- aHand balloonHelp: self.!
Item was changed:
+ (PackageInfo named: 'Morphic') postscript: 'Editor initialize.
+
+ SystemWindow allSubInstancesDo: [:ea |
+ ea paneMorphs do: #comeToFront.
+ ea labelArea comeToFront].
+
+ HandMorph allInstancesDo: [:hand |
+ hand removeProperty: #balloonHelpMorph].'!
- (PackageInfo named: 'Morphic') postscript: 'Editor initialize.'!
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.684.mcz
==================== Summary ====================
Name: Collections-eem.684
Author: eem
Time: 30 March 2016, 1:40:38.127809 pm
UUID: 3cd95866-5b71-4755-8659-1e0fbb6fbe4d
Ancestors: Collections-ul.683
Fix PositionableStream>>basicUpTo:. It should replicate upTo:, not next:.
=============== Diff against Collections-ul.683 ===============
Item was changed:
+ ----- Method: PositionableStream>>basicUpTo: (in category 'private basic') -----
+ basicUpTo: anObject
+ "Answer a subcollection from the current access position to the
+ occurrence (if any, but not inclusive) of anObject in the receiver. If
+ anObject is not in the collection, answer the entire rest of the receiver."
+ | newStream element |
+ newStream := WriteStream on: (self collectionSpecies new: 100).
+ [self atEnd or: [(element := self next) = anObject]]
+ whileFalse: [newStream nextPut: element].
+ ^newStream contents!
- ----- Method: PositionableStream>>basicUpTo: (in category 'accessing - multibyte support') -----
- basicUpTo: anObject
-
- ^self next: anObject
- !
Eliot Miranda uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-eem.684.mcz
==================== Summary ====================
Name: Collections-eem.684
Author: eem
Time: 30 March 2016, 1:40:38.127809 pm
UUID: 3cd95866-5b71-4755-8659-1e0fbb6fbe4d
Ancestors: Collections-ul.683
Fix PositionableStream>>basicUpTo:. It should replicate upTo:, not next:.
=============== Diff against Collections-ul.683 ===============
Item was changed:
+ ----- Method: PositionableStream>>basicUpTo: (in category 'private basic') -----
+ basicUpTo: anObject
+ "Answer a subcollection from the current access position to the
+ occurrence (if any, but not inclusive) of anObject in the receiver. If
+ anObject is not in the collection, answer the entire rest of the receiver."
+ | newStream element |
+ newStream := WriteStream on: (self collectionSpecies new: 100).
+ [self atEnd or: [(element := self next) = anObject]]
+ whileFalse: [newStream nextPut: element].
+ ^newStream contents!
- ----- Method: PositionableStream>>basicUpTo: (in category 'accessing - multibyte support') -----
- basicUpTo: anObject
-
- ^self next: anObject
- !
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1008.mcz
==================== Summary ====================
Name: Kernel-ul.1008
Author: ul
Time: 30 March 2016, 2:54:12.155092 am
UUID: dee08222-ad83-4daf-a90d-a7a4e7b5009f
Ancestors: Kernel-ul.1007
- minor performance improvements for NumberParser and Fraction.
- give some advantage to the same class integer-integer comparison, which is probably the most common case, in Integer >> #=, at the cost of adding a minor overhead to the integer-non-integer comparisons.
- removed Integer >> #hash because it's not used and the implementation become incorrect over time.
=============== Diff against Kernel-ul.1007 ===============
Item was changed:
----- Method: Fraction>>setNumerator:denominator: (in category 'private') -----
setNumerator: n denominator: d
+ d isZero ifTrue: [ ^(ZeroDivide dividend: n) signal ].
+ numerator := n asInteger.
+ (denominator := d asInteger) negative ifTrue: [ "keep sign in numerator"
+ numerator := numerator negated.
+ denominator := denominator negated ]!
- d = 0
- ifTrue: [^(ZeroDivide dividend: n) signal]
- ifFalse:
- [numerator := n asInteger.
- denominator := d asInteger abs. "keep sign in numerator"
- d < 0 ifTrue: [numerator := numerator negated]]!
Item was changed:
----- Method: Integer>>= (in category 'comparing') -----
= aNumber
+ aNumber class == self class ifTrue: [ ^(self digitCompare: aNumber) = 0 ].
+ aNumber isInteger ifTrue: [ ^false ].
- aNumber isInteger ifTrue: [
- aNumber class == self class ifFalse: [ ^false ].
- ^(self digitCompare: aNumber) = 0 ].
aNumber isNumber ifFalse: [ ^false ].
^aNumber adaptToInteger: self andCompare: #=!
Item was removed:
- ----- Method: Integer>>hash (in category 'comparing') -----
- hash
- "Hash is reimplemented because = is implemented."
-
- ^(self lastDigit bitShift: 8) + (self digitAt: 1)!
Item was added:
+ ----- Method: NumberParser>>isExponentLetter: (in category 'testing') -----
+ isExponentLetter: aCharacter
+
+ ^self exponentLetters includes: aCharacter!
Item was changed:
----- Method: NumberParser>>makeFloatFromMantissa:exponent:base: (in category 'parsing-private') -----
makeFloatFromMantissa: m exponent: k base: aRadix
"Convert infinite precision arithmetic into Floating point.
This alogrithm rely on correct IEEE rounding mode
being implemented in Integer>>asFloat and Fraction>>asFloat"
+ k = 0 ifTrue: [ ^m asFloat ].
+ k > 0 ifTrue: [ ^(m * (aRadix raisedToInteger: k)) asFloat ].
+ ^(Fraction numerator: m denominator: (aRadix raisedToInteger: k negated)) asFloat!
- ^(k positive
- ifTrue: [m * (aRadix raisedToInteger: k)]
- ifFalse: [Fraction numerator: m denominator: (aRadix raisedToInteger: k negated)]) asFloat!
Item was changed:
----- Method: NumberParser>>nextElementaryLargeIntegerBase: (in category 'parsing-large int') -----
nextElementaryLargeIntegerBase: aRadix
"Form an unsigned integer with incoming digits from sourceStream.
Return this integer, or zero if no digits found.
Stop reading if end of digits or if a LargeInteger is formed.
Count the number of digits and the position of lastNonZero digit and store them in instVar."
| value digit char |
value := 0.
nDigits := 0.
lastNonZero := 0.
+ [
+ value isLarge ifTrue: [ ^value ].
+ char := sourceStream next ifNil: [ ^value ].
+ ((digit := char digitValue) < 0 or: [digit >= aRadix]) ifTrue: [
+ sourceStream skip: -1.
+ ^value ].
+ nDigits := nDigits + 1.
+ digit = 0
+ ifFalse: [
+ lastNonZero := nDigits.
+ value := value * aRadix + digit ]
+ ifTrue: [ value := value * aRadix ] ] repeat!
- [value isLarge or: [(char := sourceStream next) == nil
- or: [digit := char digitValue.
- (0 > digit or: [digit >= aRadix])
- and: [sourceStream skip: -1.
- true]]]]
- whileFalse: [
- nDigits := nDigits + 1.
- 0 = digit
- ifFalse: [lastNonZero := nDigits].
- value := value * aRadix + digit].
- ^value!
Item was changed:
----- Method: NumberParser>>readExponent (in category 'parsing-private') -----
readExponent
"read the exponent if any (stored in instVar).
Answer true if found, answer false if none.
If exponent letter is not followed by a digit,
this is not considered as an error.
Exponent are always read in base 10."
| eneg epos |
exponent := 0.
+ (self isExponentLetter: sourceStream peek) ifFalse: [^ false].
- sourceStream atEnd ifTrue: [^ false].
- (self exponentLetters includes: sourceStream peek)
- ifFalse: [^ false].
sourceStream next.
eneg := sourceStream peekFor: $-.
epos := eneg not and: [self allowPlusSignInExponent and: [sourceStream peekFor: $+]].
exponent := self nextUnsignedIntegerOrNilBase: 10.
exponent ifNil: ["Oops, there was no digit after the exponent letter.Ungobble the letter"
exponent := 0.
sourceStream
skip: ((eneg or: [epos])
ifTrue: [-2]
ifFalse: [-1]).
^ false].
eneg ifTrue: [exponent := exponent negated].
^true!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.1008.mcz
==================== Summary ====================
Name: Kernel-ul.1008
Author: ul
Time: 30 March 2016, 2:54:12.155092 am
UUID: dee08222-ad83-4daf-a90d-a7a4e7b5009f
Ancestors: Kernel-ul.1007
- minor performance improvements for NumberParser and Fraction.
- give some advantage to the same class integer-integer comparison, which is probably the most common case, in Integer >> #=, at the cost of adding a minor overhead to the integer-non-integer comparisons.
- removed Integer >> #hash because it's not used and the implementation become incorrect over time.
=============== Diff against Kernel-ul.1007 ===============
Item was changed:
----- Method: Fraction>>setNumerator:denominator: (in category 'private') -----
setNumerator: n denominator: d
+ d isZero ifTrue: [ ^(ZeroDivide dividend: n) signal ].
+ numerator := n asInteger.
+ (denominator := d asInteger) negative ifTrue: [ "keep sign in numerator"
+ numerator := numerator negated.
+ denominator := denominator negated ]!
- d = 0
- ifTrue: [^(ZeroDivide dividend: n) signal]
- ifFalse:
- [numerator := n asInteger.
- denominator := d asInteger abs. "keep sign in numerator"
- d < 0 ifTrue: [numerator := numerator negated]]!
Item was changed:
----- Method: Integer>>= (in category 'comparing') -----
= aNumber
+ aNumber class == self class ifTrue: [ ^(self digitCompare: aNumber) = 0 ].
+ aNumber isInteger ifTrue: [ ^false ].
- aNumber isInteger ifTrue: [
- aNumber class == self class ifFalse: [ ^false ].
- ^(self digitCompare: aNumber) = 0 ].
aNumber isNumber ifFalse: [ ^false ].
^aNumber adaptToInteger: self andCompare: #=!
Item was removed:
- ----- Method: Integer>>hash (in category 'comparing') -----
- hash
- "Hash is reimplemented because = is implemented."
-
- ^(self lastDigit bitShift: 8) + (self digitAt: 1)!
Item was added:
+ ----- Method: NumberParser>>isExponentLetter: (in category 'testing') -----
+ isExponentLetter: aCharacter
+
+ ^self exponentLetters includes: aCharacter!
Item was changed:
----- Method: NumberParser>>makeFloatFromMantissa:exponent:base: (in category 'parsing-private') -----
makeFloatFromMantissa: m exponent: k base: aRadix
"Convert infinite precision arithmetic into Floating point.
This alogrithm rely on correct IEEE rounding mode
being implemented in Integer>>asFloat and Fraction>>asFloat"
+ k = 0 ifTrue: [ ^m asFloat ].
+ k > 0 ifTrue: [ ^(m * (aRadix raisedToInteger: k)) asFloat ].
+ ^(Fraction numerator: m denominator: (aRadix raisedToInteger: k negated)) asFloat!
- ^(k positive
- ifTrue: [m * (aRadix raisedToInteger: k)]
- ifFalse: [Fraction numerator: m denominator: (aRadix raisedToInteger: k negated)]) asFloat!
Item was changed:
----- Method: NumberParser>>nextElementaryLargeIntegerBase: (in category 'parsing-large int') -----
nextElementaryLargeIntegerBase: aRadix
"Form an unsigned integer with incoming digits from sourceStream.
Return this integer, or zero if no digits found.
Stop reading if end of digits or if a LargeInteger is formed.
Count the number of digits and the position of lastNonZero digit and store them in instVar."
| value digit char |
value := 0.
nDigits := 0.
lastNonZero := 0.
+ [
+ value isLarge ifTrue: [ ^value ].
+ char := sourceStream next ifNil: [ ^value ].
+ ((digit := char digitValue) < 0 or: [digit >= aRadix]) ifTrue: [
+ sourceStream skip: -1.
+ ^value ].
+ nDigits := nDigits + 1.
+ digit = 0
+ ifFalse: [
+ lastNonZero := nDigits.
+ value := value * aRadix + digit ]
+ ifTrue: [ value := value * aRadix ] ] repeat!
- [value isLarge or: [(char := sourceStream next) == nil
- or: [digit := char digitValue.
- (0 > digit or: [digit >= aRadix])
- and: [sourceStream skip: -1.
- true]]]]
- whileFalse: [
- nDigits := nDigits + 1.
- 0 = digit
- ifFalse: [lastNonZero := nDigits].
- value := value * aRadix + digit].
- ^value!
Item was changed:
----- Method: NumberParser>>readExponent (in category 'parsing-private') -----
readExponent
"read the exponent if any (stored in instVar).
Answer true if found, answer false if none.
If exponent letter is not followed by a digit,
this is not considered as an error.
Exponent are always read in base 10."
| eneg epos |
exponent := 0.
+ (self isExponentLetter: sourceStream peek) ifFalse: [^ false].
- sourceStream atEnd ifTrue: [^ false].
- (self exponentLetters includes: sourceStream peek)
- ifFalse: [^ false].
sourceStream next.
eneg := sourceStream peekFor: $-.
epos := eneg not and: [self allowPlusSignInExponent and: [sourceStream peekFor: $+]].
exponent := self nextUnsignedIntegerOrNilBase: 10.
exponent ifNil: ["Oops, there was no digit after the exponent letter.Ungobble the letter"
exponent := 0.
sourceStream
skip: ((eneg or: [epos])
ifTrue: [-2]
ifFalse: [-1]).
^ false].
eneg ifTrue: [exponent := exponent negated].
^true!
Levente Uzonyi uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ul.151.mcz
==================== Summary ====================
Name: Files-ul.151
Author: ul
Time: 30 March 2016, 2:24:00.086677 am
UUID: 5c8941ce-af98-4464-8bad-423c8bf7ddb5
Ancestors: Files-mt.150
Improvement #peekFor: performance.
=============== Diff against Files-mt.150 ===============
Item was changed:
----- Method: StandardFileStream>>peekFor: (in category 'access') -----
peekFor: item
"Answer false and do not advance if the next element is not equal to item, or if this stream is at the end. If the next element is equal to item, then advance over it and return true"
+
- | next |
"self atEnd ifTrue: [^ false]. -- SFStream will give nil"
+ (self next ifNil: [ ^false ]) = item ifTrue: [ ^true ].
- (next := self next) == nil ifTrue: [^ false].
- item = next ifTrue: [^ true].
self skip: -1.
^ false!
Levente Uzonyi uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-ul.151.mcz
==================== Summary ====================
Name: Files-ul.151
Author: ul
Time: 30 March 2016, 2:24:00.086677 am
UUID: 5c8941ce-af98-4464-8bad-423c8bf7ddb5
Ancestors: Files-mt.150
Improvement #peekFor: performance.
=============== Diff against Files-mt.150 ===============
Item was changed:
----- Method: StandardFileStream>>peekFor: (in category 'access') -----
peekFor: item
"Answer false and do not advance if the next element is not equal to item, or if this stream is at the end. If the next element is equal to item, then advance over it and return true"
+
- | next |
"self atEnd ifTrue: [^ false]. -- SFStream will give nil"
+ (self next ifNil: [ ^false ]) = item ifTrue: [ ^true ].
- (next := self next) == nil ifTrue: [^ false].
- item = next ifTrue: [^ true].
self skip: -1.
^ false!