Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.557.mcz
==================== Summary ====================
Name: Morphic-ul.557
Author: ul
Time: 25 July 2011, 11:25:48.544 am
UUID: 1722d2af-9a53-8645-bd3b-10277d1f4e36
Ancestors: Morphic-ul.556
Added a missing whitespace.
=============== Diff against Morphic-ul.556 ===============
Item was changed:
----- Method: SequenceableCollection>>closedCubicSlopes (in category '*Morphic-NewCurves-cubic support') -----
closedCubicSlopes
"Sent to knots returns the slopes of a closed cubic spline.
From the same set of java sources as naturalCubic. This is a squeak
transliteration of the java code."
"from java code NatCubicClosed extends NatCubic
solves for the set of equations for all knots:
b1+4*b2+b3=3*(a3-a1)
where a1 is (knots atWrap: index + 1) etc.
and the b's are the slopes .
by decomposing the matrix into upper triangular and lower matrices
and then back sustitution. See Spath 'Spline Algorithms for Curves
and Surfaces' pp 19--21. The D[i] are the derivatives at the knots.
"
| v w x y z n1 D F G H |
n1 := self size.
n1 < 3
ifTrue: [self error: 'Less than 3 points makes a poor curve'].
v := Array new: n1.
w := Array new: n1.
y := Array new: n1.
D := Array new: n1.
x := self.
z := 1.0 / 4.0.
v at: 2 put: z.
w at: 2 put: z.
y at: 1 put: z * 3.0 * ((x at: 2)
- (x at: n1)).
H := 4.0.
F := 3 * ((x at: 1)
- (x at: n1 - 1)).
G := 1.
2 to: n1 - 1
do: [:k |
z := 1.0 / (4.0
- (v at: k)).
v at: k + 1 put: z.
w at: k + 1 put: z negated
* (w at: k).
y at: k put: z * (3.0 * ((x at: k + 1)
- (x at: k - 1))
- (y at: k - 1)).
H := H - (G
* (w at: k)).
F := F - (G
* (y at: k - 1)).
G := (v at: k) negated * G].
H := H - (G + 1 * ((v at: n1)
+ (w at: n1))).
y at: n1 put: F - (G + 1
* (y at: n1 - 1)).
D at: n1 put: (y at: n1)
/ H.
D at: n1 - 1 put: (y at: n1 - 1)
- ((v at: n1)
+ (w at: n1)
* (D at: n1)).
+ n1 - 2 to: 1 by: -1 do: [ :k |
- n1 -2 to: 1 by: -1 do: [ :k |
D at: k put:
(y at: k)
- ((v at: k + 1)
* (D at: k + 1)) - ((w at: k + 1)
* (D at: n1))].
^ D .!
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.556.mcz
==================== Summary ====================
Name: Morphic-ul.556
Author: ul
Time: 25 July 2011, 1:41:43.183 am
UUID: 674e0386-e032-5c40-8708-f89d2f73edd7
Ancestors: Morphic-ul.555
Various speedups for curves:
- avoid an unnecessary assert (with an unnecessary block) in Cubic>>honeIn:.
- pass a point for #polynomialEval:, instead of a Float to avoid Point-Float multiplications in Cubic>>measureFor:
- avoid interval creation in SequenceableCollection>>changeOfChangesInSlopes: and SequenceableCollection>>closedCubicSlopes
- avoid creating intermediate objects in SequenceableCollection>>cubicPointPolynomialAt:
=============== Diff against Morphic-ul.555 ===============
Item was changed:
----- Method: Cubic>>honeIn: (in category 'cubic support') -----
honeIn: enough
"Find if there is a smaller n than enough that give the same
measure for n."
+
+ enough < 2 ifTrue: [ ^enough].
- self
- assert: [enough isPowerOfTwo].
- enough < 2
- ifTrue: [^ enough].
^ self
honeIn: enough
step: enough // 2
measure: (self measureFor: enough)
withIn: self leeway!
Item was changed:
----- Method: Cubic>>measureFor: (in category 'cubic support') -----
measureFor: n
"Return a distance measure for cubic curve with n segments.
For convienence and accuracy we use the sum of the
distances. "
"first point is poly of 0."
+ | p1 measure |
+ p1 := self at: 1.
- | p1 p2 measure |
- p1 := self first.
measure := 0.
+ 1 to: n do: [ :i |
+ | x p2 |
+ x := i asFloat / n.
+ p2 := self polynomialEval: x @ x.
+ measure := measure + (p2 dist: p1).
+ p1 := p2 ].
+ ^measure!
- 1 to: n
- do: [:i |
- p2 := self polynomialEval: i / n asFloat.
- measure := measure
- + (p2 dist: p1).
- p1 := p2].
- ^ measure!
Item was changed:
----- Method: SequenceableCollection>>changeOfChangesInSlopes: (in category '*Morphic-NewCurves-cubic support') -----
changeOfChangesInSlopes: slopes
"A message to knots of a spline. Returns an array with the 4rd
cubic coeff."
"The last nth item is correct iff this is a closed cubic.
Presumably that is the only time we care.
We always return the same sized array as self."
| n changes |
n := self size.
n = slopes size
ifFalse: [^ self error: 'vertices and slopes differ in number'].
changes := Array new: n.
+ 1 to: n do: [ :i |
+ changes at: i put: (self at: i)
+ - (self atWrap: i + 1) * 2
+ + (slopes at: i)
+ + (slopes atWrap: i + 1) ].
- (1 to: n)
- do: [:i | changes at: i put: (self at: i)
- - (self atWrap: i + 1) * 2
- + (slopes at: i)
- + (slopes atWrap: i + 1)].
-
^ changes!
Item was changed:
----- Method: SequenceableCollection>>closedCubicSlopes (in category '*Morphic-NewCurves-cubic support') -----
closedCubicSlopes
"Sent to knots returns the slopes of a closed cubic spline.
From the same set of java sources as naturalCubic. This is a squeak
transliteration of the java code."
"from java code NatCubicClosed extends NatCubic
solves for the set of equations for all knots:
b1+4*b2+b3=3*(a3-a1)
where a1 is (knots atWrap: index + 1) etc.
and the b's are the slopes .
by decomposing the matrix into upper triangular and lower matrices
and then back sustitution. See Spath 'Spline Algorithms for Curves
and Surfaces' pp 19--21. The D[i] are the derivatives at the knots.
"
| v w x y z n1 D F G H |
n1 := self size.
n1 < 3
ifTrue: [self error: 'Less than 3 points makes a poor curve'].
v := Array new: n1.
w := Array new: n1.
y := Array new: n1.
D := Array new: n1.
x := self.
z := 1.0 / 4.0.
v at: 2 put: z.
w at: 2 put: z.
y at: 1 put: z * 3.0 * ((x at: 2)
- (x at: n1)).
H := 4.0.
F := 3 * ((x at: 1)
- (x at: n1 - 1)).
G := 1.
2 to: n1 - 1
do: [:k |
z := 1.0 / (4.0
- (v at: k)).
v at: k + 1 put: z.
w at: k + 1 put: z negated
* (w at: k).
y at: k put: z * (3.0 * ((x at: k + 1)
- (x at: k - 1))
- (y at: k - 1)).
H := H - (G
* (w at: k)).
F := F - (G
* (y at: k - 1)).
G := (v at: k) negated * G].
H := H - (G + 1 * ((v at: n1)
+ (w at: n1))).
y at: n1 put: F - (G + 1
* (y at: n1 - 1)).
D at: n1 put: (y at: n1)
/ H.
D at: n1 - 1 put: (y at: n1 - 1)
- ((v at: n1)
+ (w at: n1)
* (D at: n1)).
+ n1 -2 to: 1 by: -1 do: [ :k |
+ D at: k put:
+ (y at: k)
- (1 to: n1 - 2)
- reverseDo: [:k | D at: k put: (y at: k)
- ((v at: k + 1)
* (D at: k + 1)) - ((w at: k + 1)
* (D at: n1))].
^ D .!
Item was changed:
----- Method: SequenceableCollection>>cubicPointPolynomialAt: (in category '*Morphic-NewCurves-cubic support') -----
cubicPointPolynomialAt: vIndex
"From curve information assemble a 4-array of points representing the coefficents for curve segment between to points. Beginning point is first point in array endpoint is the pointSum of the array. Meant to be sent to newcurves idea of curve coefficents."
+
+ | result |
+ result := Cubic new: 4.
+ 1 to: 4 do: [ :i |
+ result at: i put: ((self at: i) at: vIndex) @ ((self at: 4 + i) at: vIndex) ].
+ ^result!
- ^ ((1 to: 4)
- collect: [:i | ((self at: i)
- at: vIndex)
- @ ((self at: 4 + i)
- at: vIndex)]) asCubic!
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.556.mcz
==================== Summary ====================
Name: Morphic-ul.556
Author: ul
Time: 25 July 2011, 1:41:43.183 am
UUID: 674e0386-e032-5c40-8708-f89d2f73edd7
Ancestors: Morphic-ul.555
Various speedups for curves:
- avoid an unnecessary assert (with an unnecessary block) in Cubic>>honeIn:.
- pass a point for #polynomialEval:, instead of a Float to avoid Point-Float multiplications in Cubic>>measureFor:
- avoid interval creation in SequenceableCollection>>changeOfChangesInSlopes: and SequenceableCollection>>closedCubicSlopes
- avoid creating intermediate objects in SequenceableCollection>>cubicPointPolynomialAt:
=============== Diff against Morphic-ul.555 ===============
Item was changed:
----- Method: Cubic>>honeIn: (in category 'cubic support') -----
honeIn: enough
"Find if there is a smaller n than enough that give the same
measure for n."
+
+ enough < 2 ifTrue: [ ^enough].
- self
- assert: [enough isPowerOfTwo].
- enough < 2
- ifTrue: [^ enough].
^ self
honeIn: enough
step: enough // 2
measure: (self measureFor: enough)
withIn: self leeway!
Item was changed:
----- Method: Cubic>>measureFor: (in category 'cubic support') -----
measureFor: n
"Return a distance measure for cubic curve with n segments.
For convienence and accuracy we use the sum of the
distances. "
"first point is poly of 0."
+ | p1 measure |
+ p1 := self at: 1.
- | p1 p2 measure |
- p1 := self first.
measure := 0.
+ 1 to: n do: [ :i |
+ | x p2 |
+ x := i asFloat / n.
+ p2 := self polynomialEval: x @ x.
+ measure := measure + (p2 dist: p1).
+ p1 := p2 ].
+ ^measure!
- 1 to: n
- do: [:i |
- p2 := self polynomialEval: i / n asFloat.
- measure := measure
- + (p2 dist: p1).
- p1 := p2].
- ^ measure!
Item was changed:
----- Method: SequenceableCollection>>changeOfChangesInSlopes: (in category '*Morphic-NewCurves-cubic support') -----
changeOfChangesInSlopes: slopes
"A message to knots of a spline. Returns an array with the 4rd
cubic coeff."
"The last nth item is correct iff this is a closed cubic.
Presumably that is the only time we care.
We always return the same sized array as self."
| n changes |
n := self size.
n = slopes size
ifFalse: [^ self error: 'vertices and slopes differ in number'].
changes := Array new: n.
+ 1 to: n do: [ :i |
+ changes at: i put: (self at: i)
+ - (self atWrap: i + 1) * 2
+ + (slopes at: i)
+ + (slopes atWrap: i + 1) ].
- (1 to: n)
- do: [:i | changes at: i put: (self at: i)
- - (self atWrap: i + 1) * 2
- + (slopes at: i)
- + (slopes atWrap: i + 1)].
-
^ changes!
Item was changed:
----- Method: SequenceableCollection>>closedCubicSlopes (in category '*Morphic-NewCurves-cubic support') -----
closedCubicSlopes
"Sent to knots returns the slopes of a closed cubic spline.
From the same set of java sources as naturalCubic. This is a squeak
transliteration of the java code."
"from java code NatCubicClosed extends NatCubic
solves for the set of equations for all knots:
b1+4*b2+b3=3*(a3-a1)
where a1 is (knots atWrap: index + 1) etc.
and the b's are the slopes .
by decomposing the matrix into upper triangular and lower matrices
and then back sustitution. See Spath 'Spline Algorithms for Curves
and Surfaces' pp 19--21. The D[i] are the derivatives at the knots.
"
| v w x y z n1 D F G H |
n1 := self size.
n1 < 3
ifTrue: [self error: 'Less than 3 points makes a poor curve'].
v := Array new: n1.
w := Array new: n1.
y := Array new: n1.
D := Array new: n1.
x := self.
z := 1.0 / 4.0.
v at: 2 put: z.
w at: 2 put: z.
y at: 1 put: z * 3.0 * ((x at: 2)
- (x at: n1)).
H := 4.0.
F := 3 * ((x at: 1)
- (x at: n1 - 1)).
G := 1.
2 to: n1 - 1
do: [:k |
z := 1.0 / (4.0
- (v at: k)).
v at: k + 1 put: z.
w at: k + 1 put: z negated
* (w at: k).
y at: k put: z * (3.0 * ((x at: k + 1)
- (x at: k - 1))
- (y at: k - 1)).
H := H - (G
* (w at: k)).
F := F - (G
* (y at: k - 1)).
G := (v at: k) negated * G].
H := H - (G + 1 * ((v at: n1)
+ (w at: n1))).
y at: n1 put: F - (G + 1
* (y at: n1 - 1)).
D at: n1 put: (y at: n1)
/ H.
D at: n1 - 1 put: (y at: n1 - 1)
- ((v at: n1)
+ (w at: n1)
* (D at: n1)).
+ n1 -2 to: 1 by: -1 do: [ :k |
+ D at: k put:
+ (y at: k)
- (1 to: n1 - 2)
- reverseDo: [:k | D at: k put: (y at: k)
- ((v at: k + 1)
* (D at: k + 1)) - ((w at: k + 1)
* (D at: n1))].
^ D .!
Item was changed:
----- Method: SequenceableCollection>>cubicPointPolynomialAt: (in category '*Morphic-NewCurves-cubic support') -----
cubicPointPolynomialAt: vIndex
"From curve information assemble a 4-array of points representing the coefficents for curve segment between to points. Beginning point is first point in array endpoint is the pointSum of the array. Meant to be sent to newcurves idea of curve coefficents."
+
+ | result |
+ result := Cubic new: 4.
+ 1 to: 4 do: [ :i |
+ result at: i put: ((self at: i) at: vIndex) @ ((self at: 4 + i) at: vIndex) ].
+ ^result!
- ^ ((1 to: 4)
- collect: [:i | ((self at: i)
- at: vIndex)
- @ ((self at: 4 + i)
- at: vIndex)]) asCubic!
Levente Uzonyi uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-ul.556.mcz
==================== Summary ====================
Name: Morphic-ul.556
Author: ul
Time: 25 July 2011, 1:41:43.183 am
UUID: 674e0386-e032-5c40-8708-f89d2f73edd7
Ancestors: Morphic-ul.555
Various speedups for curves:
- avoid an unnecessary assert (with an unnecessary block) in Cubic>>honeIn:.
- pass a point for #polynomialEval:, instead of a Float to avoid Point-Float multiplications in Cubic>>measureFor:
- avoid interval creation in SequenceableCollection>>changeOfChangesInSlopes: and SequenceableCollection>>closedCubicSlopes
- avoid creating intermediate objects in SequenceableCollection>>cubicPointPolynomialAt:
=============== Diff against Morphic-ul.555 ===============
Item was changed:
----- Method: Cubic>>honeIn: (in category 'cubic support') -----
honeIn: enough
"Find if there is a smaller n than enough that give the same
measure for n."
+
+ enough < 2 ifTrue: [ ^enough].
- self
- assert: [enough isPowerOfTwo].
- enough < 2
- ifTrue: [^ enough].
^ self
honeIn: enough
step: enough // 2
measure: (self measureFor: enough)
withIn: self leeway!
Item was changed:
----- Method: Cubic>>measureFor: (in category 'cubic support') -----
measureFor: n
"Return a distance measure for cubic curve with n segments.
For convienence and accuracy we use the sum of the
distances. "
"first point is poly of 0."
+ | p1 measure |
+ p1 := self at: 1.
- | p1 p2 measure |
- p1 := self first.
measure := 0.
+ 1 to: n do: [ :i |
+ | x p2 |
+ x := i asFloat / n.
+ p2 := self polynomialEval: x @ x.
+ measure := measure + (p2 dist: p1).
+ p1 := p2 ].
+ ^measure!
- 1 to: n
- do: [:i |
- p2 := self polynomialEval: i / n asFloat.
- measure := measure
- + (p2 dist: p1).
- p1 := p2].
- ^ measure!
Item was changed:
----- Method: SequenceableCollection>>changeOfChangesInSlopes: (in category '*Morphic-NewCurves-cubic support') -----
changeOfChangesInSlopes: slopes
"A message to knots of a spline. Returns an array with the 4rd
cubic coeff."
"The last nth item is correct iff this is a closed cubic.
Presumably that is the only time we care.
We always return the same sized array as self."
| n changes |
n := self size.
n = slopes size
ifFalse: [^ self error: 'vertices and slopes differ in number'].
changes := Array new: n.
+ 1 to: n do: [ :i |
+ changes at: i put: (self at: i)
+ - (self atWrap: i + 1) * 2
+ + (slopes at: i)
+ + (slopes atWrap: i + 1) ].
- (1 to: n)
- do: [:i | changes at: i put: (self at: i)
- - (self atWrap: i + 1) * 2
- + (slopes at: i)
- + (slopes atWrap: i + 1)].
-
^ changes!
Item was changed:
----- Method: SequenceableCollection>>closedCubicSlopes (in category '*Morphic-NewCurves-cubic support') -----
closedCubicSlopes
"Sent to knots returns the slopes of a closed cubic spline.
From the same set of java sources as naturalCubic. This is a squeak
transliteration of the java code."
"from java code NatCubicClosed extends NatCubic
solves for the set of equations for all knots:
b1+4*b2+b3=3*(a3-a1)
where a1 is (knots atWrap: index + 1) etc.
and the b's are the slopes .
by decomposing the matrix into upper triangular and lower matrices
and then back sustitution. See Spath 'Spline Algorithms for Curves
and Surfaces' pp 19--21. The D[i] are the derivatives at the knots.
"
| v w x y z n1 D F G H |
n1 := self size.
n1 < 3
ifTrue: [self error: 'Less than 3 points makes a poor curve'].
v := Array new: n1.
w := Array new: n1.
y := Array new: n1.
D := Array new: n1.
x := self.
z := 1.0 / 4.0.
v at: 2 put: z.
w at: 2 put: z.
y at: 1 put: z * 3.0 * ((x at: 2)
- (x at: n1)).
H := 4.0.
F := 3 * ((x at: 1)
- (x at: n1 - 1)).
G := 1.
2 to: n1 - 1
do: [:k |
z := 1.0 / (4.0
- (v at: k)).
v at: k + 1 put: z.
w at: k + 1 put: z negated
* (w at: k).
y at: k put: z * (3.0 * ((x at: k + 1)
- (x at: k - 1))
- (y at: k - 1)).
H := H - (G
* (w at: k)).
F := F - (G
* (y at: k - 1)).
G := (v at: k) negated * G].
H := H - (G + 1 * ((v at: n1)
+ (w at: n1))).
y at: n1 put: F - (G + 1
* (y at: n1 - 1)).
D at: n1 put: (y at: n1)
/ H.
D at: n1 - 1 put: (y at: n1 - 1)
- ((v at: n1)
+ (w at: n1)
* (D at: n1)).
+ n1 -2 to: 1 by: -1 do: [ :k |
+ D at: k put:
+ (y at: k)
- (1 to: n1 - 2)
- reverseDo: [:k | D at: k put: (y at: k)
- ((v at: k + 1)
* (D at: k + 1)) - ((w at: k + 1)
* (D at: n1))].
^ D .!
Item was changed:
----- Method: SequenceableCollection>>cubicPointPolynomialAt: (in category '*Morphic-NewCurves-cubic support') -----
cubicPointPolynomialAt: vIndex
"From curve information assemble a 4-array of points representing the coefficents for curve segment between to points. Beginning point is first point in array endpoint is the pointSum of the array. Meant to be sent to newcurves idea of curve coefficents."
+
+ | result |
+ result := Cubic new: 4.
+ 1 to: 4 do: [ :i |
+ result at: i put: ((self at: i) at: vIndex) @ ((self at: 4 + i) at: vIndex) ].
+ ^result!
- ^ ((1 to: 4)
- collect: [:i | ((self at: i)
- at: vIndex)
- @ ((self at: 4 + i)
- at: vIndex)]) asCubic!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.451.mcz
==================== Summary ====================
Name: Collections-ul.451
Author: ul
Time: 25 July 2011, 2:09:16.563 am
UUID: 88a1eed5-6fe6-c044-9c45-f52203eb3b29
Ancestors: Collections-ul.450
- removed WideString class>>allMethodsWithEncodingTag:, because it sent an unimplemented method #string:hasEncodingTag:
- rewritten WideString class>>allMultiStringMethods and WideString class>>allNonAsciiMethods to use #allMethodsSelect: instead of reinventing the wheel. Not sure if we really need these methods here.
=============== Diff against Collections-ul.450 ===============
Item was removed:
- ----- Method: WideString class>>allMethodsWithEncodingTag: (in category 'enumeration') -----
- allMethodsWithEncodingTag: encodingTag
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
-
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- (self string: (class sourceCodeAt: s) asString hasEncoding: encodingTag) ifTrue: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Item was changed:
----- Method: WideString class>>allMultiStringMethods (in category 'enumeration') -----
allMultiStringMethods
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
+ ^CurrentReadOnlySourceFiles cacheDuring: [
+ self systemNavigation allMethodsSelect: [ :method |
+ method getSource asString isOctetString not ] ]!
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- ((class sourceCodeAt: s) asString isOctetString) ifFalse: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Item was changed:
----- Method: WideString class>>allNonAsciiMethods (in category 'enumeration') -----
+ allNonAsciiMethods
- allNonAsciiMethods
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
+ ^CurrentReadOnlySourceFiles cacheDuring: [
+ self systemNavigation allMethodsSelect: [ :method |
+ method getSource asString isAsciiString not ] ]!
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- ((class sourceCodeAt: s) asString isAsciiString) ifFalse: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.451.mcz
==================== Summary ====================
Name: Collections-ul.451
Author: ul
Time: 25 July 2011, 2:09:16.563 am
UUID: 88a1eed5-6fe6-c044-9c45-f52203eb3b29
Ancestors: Collections-ul.450
- removed WideString class>>allMethodsWithEncodingTag:, because it sent an unimplemented method #string:hasEncodingTag:
- rewritten WideString class>>allMultiStringMethods and WideString class>>allNonAsciiMethods to use #allMethodsSelect: instead of reinventing the wheel. Not sure if we really need these methods here.
=============== Diff against Collections-ul.450 ===============
Item was removed:
- ----- Method: WideString class>>allMethodsWithEncodingTag: (in category 'enumeration') -----
- allMethodsWithEncodingTag: encodingTag
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
-
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- (self string: (class sourceCodeAt: s) asString hasEncoding: encodingTag) ifTrue: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Item was changed:
----- Method: WideString class>>allMultiStringMethods (in category 'enumeration') -----
allMultiStringMethods
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
+ ^CurrentReadOnlySourceFiles cacheDuring: [
+ self systemNavigation allMethodsSelect: [ :method |
+ method getSource asString isOctetString not ] ]!
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- ((class sourceCodeAt: s) asString isOctetString) ifFalse: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Item was changed:
----- Method: WideString class>>allNonAsciiMethods (in category 'enumeration') -----
+ allNonAsciiMethods
- allNonAsciiMethods
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
+ ^CurrentReadOnlySourceFiles cacheDuring: [
+ self systemNavigation allMethodsSelect: [ :method |
+ method getSource asString isAsciiString not ] ]!
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- ((class sourceCodeAt: s) asString isAsciiString) ifFalse: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.451.mcz
==================== Summary ====================
Name: Collections-ul.451
Author: ul
Time: 25 July 2011, 2:09:16.563 am
UUID: 88a1eed5-6fe6-c044-9c45-f52203eb3b29
Ancestors: Collections-ul.450
- removed WideString class>>allMethodsWithEncodingTag:, because it sent an unimplemented method #string:hasEncodingTag:
- rewritten WideString class>>allMultiStringMethods and WideString class>>allNonAsciiMethods to use #allMethodsSelect: instead of reinventing the wheel. Not sure if we really need these methods here.
=============== Diff against Collections-ul.450 ===============
Item was removed:
- ----- Method: WideString class>>allMethodsWithEncodingTag: (in category 'enumeration') -----
- allMethodsWithEncodingTag: encodingTag
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
-
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- (self string: (class sourceCodeAt: s) asString hasEncoding: encodingTag) ifTrue: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Item was changed:
----- Method: WideString class>>allMultiStringMethods (in category 'enumeration') -----
allMultiStringMethods
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
+ ^CurrentReadOnlySourceFiles cacheDuring: [
+ self systemNavigation allMethodsSelect: [ :method |
+ method getSource asString isOctetString not ] ]!
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- ((class sourceCodeAt: s) asString isOctetString) ifFalse: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Item was changed:
----- Method: WideString class>>allNonAsciiMethods (in category 'enumeration') -----
+ allNonAsciiMethods
- allNonAsciiMethods
- "Answer a SortedCollection of all the methods that implement the message
- aSelector."
+ ^CurrentReadOnlySourceFiles cacheDuring: [
+ self systemNavigation allMethodsSelect: [ :method |
+ method getSource asString isAsciiString not ] ]!
- | list adder num i |
- list := Set new.
- adder := [ :mrClass :mrSel |
- list add: (
- MethodReference new
- setStandardClass: mrClass
- methodSymbol: mrSel
- )
- ].
-
- num := CompiledMethod allInstances size.
- i := 0.
- 'processing...' displayProgressFrom: 0 to: num during: [:bar |
- SystemNavigation new allBehaviorsDo: [ :class |
- class selectorsDo: [:s |
- bar value: (i := i + 1).
- ((class sourceCodeAt: s) asString isAsciiString) ifFalse: [
- adder value: class value: s.
- ]
- ]
- ]
- ].
-
- ^ list.
- !
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.450.mcz
==================== Summary ====================
Name: Collections-ul.450
Author: ul
Time: 25 July 2011, 1:37:20.234 am
UUID: 2d09bd44-bfdf-1840-87cb-81ced69f9948
Ancestors: Collections-nice.449
Avoid a multiplication, use low level methods in
SequenceableCollection >> #polynomialEval: for better performance.
=============== Diff against Collections-nice.449 ===============
Item was changed:
----- Method: SequenceableCollection>>polynomialEval: (in category 'enumerating') -----
polynomialEval: thisX
- | sum valToPower |
"Treat myself as the coeficients of a polynomial in X. Evaluate it with thisX. First element is the constant and last is the coeficient for the highest power."
" #(1 2 3) polynomialEval: 2 " "is 3*X^2 + 2*X + 1 with X = 2"
+ | size sum valToPower |
+ sum := self at: 1.
+ (size := self size) = 1 ifTrue: [ ^sum ].
- sum := self first.
valToPower := thisX.
+ 2 to: size - 1 do: [ :ind |
- 2 to: self size do: [:ind |
sum := sum + ((self at: ind) * valToPower).
+ valToPower := valToPower * thisX ].
+ ^sum + ((self at: size) * valToPower)!
- valToPower := valToPower * thisX].
- ^ sum!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.450.mcz
==================== Summary ====================
Name: Collections-ul.450
Author: ul
Time: 25 July 2011, 1:37:20.234 am
UUID: 2d09bd44-bfdf-1840-87cb-81ced69f9948
Ancestors: Collections-nice.449
Avoid a multiplication, use low level methods in
SequenceableCollection >> #polynomialEval: for better performance.
=============== Diff against Collections-nice.449 ===============
Item was changed:
----- Method: SequenceableCollection>>polynomialEval: (in category 'enumerating') -----
polynomialEval: thisX
- | sum valToPower |
"Treat myself as the coeficients of a polynomial in X. Evaluate it with thisX. First element is the constant and last is the coeficient for the highest power."
" #(1 2 3) polynomialEval: 2 " "is 3*X^2 + 2*X + 1 with X = 2"
+ | size sum valToPower |
+ sum := self at: 1.
+ (size := self size) = 1 ifTrue: [ ^sum ].
- sum := self first.
valToPower := thisX.
+ 2 to: size - 1 do: [ :ind |
- 2 to: self size do: [:ind |
sum := sum + ((self at: ind) * valToPower).
+ valToPower := valToPower * thisX ].
+ ^sum + ((self at: size) * valToPower)!
- valToPower := valToPower * thisX].
- ^ sum!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.450.mcz
==================== Summary ====================
Name: Collections-ul.450
Author: ul
Time: 25 July 2011, 1:37:20.234 am
UUID: 2d09bd44-bfdf-1840-87cb-81ced69f9948
Ancestors: Collections-nice.449
Avoid a multiplication, use low level methods in
SequenceableCollection >> #polynomialEval: for better performance.
=============== Diff against Collections-nice.449 ===============
Item was changed:
----- Method: SequenceableCollection>>polynomialEval: (in category 'enumerating') -----
polynomialEval: thisX
- | sum valToPower |
"Treat myself as the coeficients of a polynomial in X. Evaluate it with thisX. First element is the constant and last is the coeficient for the highest power."
" #(1 2 3) polynomialEval: 2 " "is 3*X^2 + 2*X + 1 with X = 2"
+ | size sum valToPower |
+ sum := self at: 1.
+ (size := self size) = 1 ifTrue: [ ^sum ].
- sum := self first.
valToPower := thisX.
+ 2 to: size - 1 do: [ :ind |
- 2 to: self size do: [:ind |
sum := sum + ((self at: ind) * valToPower).
+ valToPower := valToPower * thisX ].
+ ^sum + ((self at: size) * valToPower)!
- valToPower := valToPower * thisX].
- ^ sum!