[squeak-dev] The Trunk: SMBase-ul.137.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Mar 13 14:58:49 UTC 2017
Levente Uzonyi uploaded a new version of SMBase to project The Trunk:
http://source.squeak.org/trunk/SMBase-ul.137.mcz
==================== Summary ====================
Name: SMBase-ul.137
Author: ul
Time: 13 March 2017, 2:54:08.752157 pm
UUID: b44842a8-94e5-4c94-ab56-6495c9209ee4
Ancestors: SMBase-bf.136
SortedCollection Whack-a-mole
=============== Diff against SMBase-bf.136 ===============
Item was changed:
----- Method: SMCategorizableObject>>describeCategoriesOn:indent: (in category 'printing') -----
describeCategoriesOn: aStream indent: tabs
"Show a full listing of categories and their dscription on aStream, indented by the given number of tabs."
categories isEmptyOrNil
ifFalse: [aStream cr;
withAttribute: TextEmphasis bold
do: [aStream nextPutAll: 'Categories: ']; cr.
+ (self categories sorted: [:a :b | a path < b path])
- (self categories asSortedCollection: [:a :b | a path < b path])
do: [:c |
aStream tab: tabs.
c
parentsDo: [:p | aStream nextPutAll: p name;
nextPut: $/].
aStream nextPutAll: c name;
nextPutAll: ' - ';
withAttributes: {TextEmphasis italic. TextIndent tabs: tabs + 1 }
do: [aStream nextPutAll: c summary];
cr]]!
Item was changed:
----- Method: SMDependencyAnalysis>>bestInstallPath (in category 'queries') -----
bestInstallPath
"Using some heuristics we suggest the best path:
- No conflicts
- Fewest releases
- If same packages, the newest releases"
+ | paths min points |
- | paths min points sc |
paths := self installPathsWithoutConflicts.
paths size = 1 ifTrue: [^paths first].
min := paths inject: 999 into: [:mi :p | p size < mi ifTrue: [p size] ifFalse: [mi]].
paths := paths select: [:p | p size = min].
paths size = 1 ifTrue: [^paths first].
"Try to pick the one with newest releases"
points := Dictionary new.
paths do: [:p | | point |
point := 0.
p do: [:r | | package |
package := r package.
paths do: [:p2 |
p2 == p ifFalse: [
(p2 anySatisfy: [:r2 |
(r2 package == package) and: [r newerThan: r2]])
ifTrue:[point := point + 1]]]].
points at: p put: point].
points isEmpty ifTrue: [^nil].
+ ^(points associations detectMax: [ :each | each value ]) key!
- sc := points associations asSortedCollection: [:a :b | a value >= b value].
- ^ sc first key!
Item was changed:
----- Method: SMPackageRelease>>fullDescription (in category 'printing') -----
fullDescription
"Return a full textual description of the package release."
| s |
s := TextStream on: (Text new: 400).
self describe: self package name withBoldLabel: 'Package Name: ' on: s.
name isEmptyOrNil ifFalse:
[self describe: self name withBoldLabel: 'Release Name: ' on: s].
summary isEmptyOrNil ifFalse:
[self describe: self summary withBoldLabel: 'Release Summary: ' on: s].
self
describe: self version
withBoldLabel: 'Version: '
on: s.
self note isEmptyOrNil
ifFalse:
[ s withAttribute: (TextIndent tabs: 1) do: [s nextPutAll: self note withSqueakLineEndings].
s cr].
categories isEmptyOrNil
ifFalse:
[s
cr;
withAttribute: TextEmphasis bold do: [s nextPutAll: 'Categories: '];
cr.
+ (self categories sorted: [:a :b | a path < b path])
- (self categories asSortedCollection: [:a :b | a path < b path])
do: [:c |
s
tab;
withAttribute: TextEmphasis italic
do:
[c parentsDo:
[:p |
s
nextPutAll: p name;
nextPutAll: '/'].
s nextPutAll: c name];
nextPutAll: ' - ' , c summary;
cr].
s cr].
created ifNotNil: [
s
withAttribute: TextEmphasis bold do: [ s nextPutAll: 'Created: ' ];
print: self created;
cr].
updated ifNotNil: [
s
withAttribute: TextEmphasis bold do: [ s nextPutAll: 'Modified: ' ];
print: self updated;
cr].
publisher ifNotNil: [
s
withAttribute: TextEmphasis bold
do: [s nextPutAll: 'Publisher: '].
s
withAttribute: (PluggableTextAttribute
evalBlock: [self userInterface
sendMailTo: self publisher email
regardingPackageRelease: self])
do: [s nextPutAll: self publisher nameAndEmail];
cr].
url isEmptyOrNil
ifFalse:
[s
withAttribute: TextEmphasis bold do: [s nextPutAll: 'Homepage:'];
tab;
withAttribute: (TextURL new url: url) do: [s nextPutAll: url];
cr].
self downloadUrl isEmptyOrNil
ifFalse:
[s
withAttribute: TextEmphasis bold do: [s nextPutAll: 'Download:'];
tab;
withAttribute: (TextURL new url: self downloadUrl)
do: [s nextPutAll: self downloadUrl];
cr].
^s contents.
!
Item was changed:
----- Method: SMSqueakMap>>accountsByInitials (in category 'queries') -----
accountsByInitials
"Return the accounts sorted by the developer initials."
+ ^self accounts sorted: [:x :y | x initials caseInsensitiveLessOrEqual: y initials]!
- ^self accounts asSortedCollection: [:x :y | x initials caseInsensitiveLessOrEqual: y initials]!
Item was changed:
----- Method: SMSqueakMap>>accountsByName (in category 'queries') -----
accountsByName
"Return the accounts sorted by their name."
+ ^self accounts sorted: [:x :y | x name caseInsensitiveLessOrEqual: y name].!
- ^self accounts asSortedCollection: [:x :y | x name caseInsensitiveLessOrEqual: y name].!
Item was changed:
----- Method: SMSqueakMap>>packagesByName (in category 'queries') -----
packagesByName
"Return the packages sorted by their name."
+ ^self packages sorted: [:x :y | x name caseInsensitiveLessOrEqual: y name]!
- ^self packages asSortedCollection: [:x :y | x name caseInsensitiveLessOrEqual: y name]!
Item was changed:
----- Method: SMSqueakMap>>sortedCategories (in category 'accessing') -----
sortedCategories
"Lazily maintain a cache of all known category objects."
^ self categories
+ sorted: [:a :b | (a name compare: b name caseSensitive: true)
- asSortedCollection: [:a :b | (a name compare: b name caseSensitive: true)
= 1]!
More information about the Squeak-dev
mailing list
|