Skip to content

Commit

Permalink
fix in grid5000
Browse files Browse the repository at this point in the history
  • Loading branch information
simonAllier committed Dec 18, 2013
1 parent de432c9 commit 6a8f82e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CodeCity/SourceCity-Diversify.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Object subclass: #DiversifyPackage instanceVariableNames: 'classes name' classVariableNames: '' poolDictionaries: '' category: 'SourceCity-Diversify'!!DiversifyPackage methodsFor: 'initialize-release' stamp: 'Simon 12/4/2013 11:45'!initialize classes := OrderedCollection new ! !!DiversifyPackage methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:46'!classes ^ classes! !!DiversifyPackage methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:46'!name ^ name! !!DiversifyPackage methodsFor: 'accessing' stamp: 'Simon 12/4/2013 14:54'!name: aString name := aString ! !!DiversifyPackage methodsFor: 'private' stamp: 'Simon 12/4/2013 13:21'!addClass: aDiversifyClass classes add: aDiversifyClass ! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!DiversifyPackage class instanceVariableNames: ''!!DiversifyPackage class methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 17:44'!buildWith: aCollection | package | package := self new. package name: aCollection first packageLocation. (aCollection groupedBy: [:each | each classLocation]) keysAndValuesDo: [:key :value | package addClass: (DiversifyClass new className: key; package: package; trials: value)]. ^ package ! ! Object subclass: #DiversifyTrial instanceVariableNames: 'packageLocation classLocation methodLocation type compile sosie classSize nbMethodInClass classReplaceOrAddLocalition system' classVariableNames: '' poolDictionaries: '' category: 'SourceCity-Diversify'!!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!classLocation ^ classLocation! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!classLocation: anObject classLocation := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:02'!classReplaceOrAddLocalition ^ classReplaceOrAddLocalition! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:02'!classReplaceOrAddLocalition: anObject classReplaceOrAddLocalition := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 14:11'!classSize ^ classSize! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 14:11'!classSize: anObject classSize := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!compile ^ compile! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!compile: anObject compile := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!methodLocation ^ methodLocation! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!methodLocation: anObject methodLocation := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:02'!nbMethodInClass ^ nbMethodInClass! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:02'!nbMethodInClass: anObject nbMethodInClass := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 13:06'!packageLocation ^ packageLocation! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 13:06'!packageLocation: anObject packageLocation := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!sosie ^ sosie! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!sosie: anObject sosie := anObject! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:18'!system: aSystem system := aSystem ! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!type ^ type! !!DiversifyTrial methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:45'!type: anObject type := anObject! !!DiversifyTrial methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 17:37'!dependencies ^ system findDependencies: self! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!DiversifyTrial class instanceVariableNames: ''!!DiversifyTrial class methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 17:05'!buildWith: aLine | tmp | tmp := (aLine subStrings: ';'). ^ self new type: (tmp at:1); packageLocation: (tmp at:2); classLocation: (tmp at:3); classReplaceOrAddLocalition: (tmp at:4); methodLocation: (tmp at:5);
classSize: (Integer readFrom: (tmp at:6)); nbMethodInClass: (Integer readFrom: (tmp at:7)); compile: ((tmp at:8) = ' true'); sosie: (Boolean readFrom: (tmp at:9))! !!DiversifyTrial class methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 17:17'!buildWith: aLine system: aSystem | tmp | tmp := (aLine subStrings: ';'). ^ self new system: aSystem; type: (tmp at:1); packageLocation: (tmp at:2); classLocation: (tmp at:3); classReplaceOrAddLocalition: (tmp at:4); methodLocation: (tmp at:5);
classSize: (Integer readFrom: (tmp at:6)); nbMethodInClass: (Integer readFrom: (tmp at:7)); compile: ((tmp at:8) = ' true'); sosie: (Boolean readFrom: (tmp at:9))! ! Object subclass: #DiversifyClass instanceVariableNames: 'className package trials' classVariableNames: '' poolDictionaries: '' category: 'SourceCity-Diversify'!!DiversifyClass methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:43'!className ^className! !!DiversifyClass methodsFor: 'accessing' stamp: 'Simon 12/4/2013 17:43'!className: anObject className := anObject! !!DiversifyClass methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:47'!package ^ package! !!DiversifyClass methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:47'!package: anObject package := anObject! !!DiversifyClass methodsFor: 'accessing' stamp: 'Simon 12/4/2013 13:12'!trials: anObject trials := anObject! !!DiversifyClass methodsFor: 'as yet unclassified' stamp: 'Simon 12/5/2013 10:28'!dependencies ^ (trials gather: [:each | each dependencies ]) asSet ! !!DiversifyClass methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 11:48'!initialize trial := OrderedCollection new.! !!DiversifyClass methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 14:28'!nbSosies ^( trials select: [:each | each sosie]) size! !!DiversifyClass methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 14:25'!nbTrials ^ trials size! !!DiversifyClass methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 17:54'!printString ^ className! !!DiversifyClass methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 14:21'!size ^ trials first classSize ! ! AbstractSourceCityImporterStrategy subclass: #SourceCityImporterDiversifyStrategy instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'SourceCity-Diversify'!!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 11:30'!buildingGap^ 5! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/5/2013 10:44'!buildingNameGenerator ^ [:anObject | anObject className, ', size: ',anObject size asString ,', sosie: ',anObject nbSosies asString, ', trial: ', anObject nbTrials asString ] "^ [:anObject | anObject className ]"! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 11:31'!buildingsSelector ^ [:anObject | anObject classes] ! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 15:25'!calculRatioColor: anObject ^ anObject nbSosies /anObject nbTrials! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 14:46'!cityWidth ^ [:aCity | ((aCity districts inject: 0 into: [:sum :aDistrict | sum + (aDistrict dimension x + (2 * self districtGap)) ]) /(1+ aCity districts size sqrt ) *2 asFloat roundedUp)]! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 18:00'!dependenciesSelector ^ [:anObject | anObject dependencies] ! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 15:58'!districtGap ^ 10! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 14:52'!districtNameGenerator ^ [:anObject | anObject name]! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 11:37'!districtWidth ^ [:aDistrict | ((aDistrict buildings inject: 0 into: [:max :aBuilding | max max: aBuilding dimension x]) + (2 * self buildingGap)) max: (((aDistrict buildings inject: 0 into: [:sum :aBuilding | sum + (aBuilding dimension x + (2 * self buildingGap)) ]) /(1+aDistrict buildings size sqrt)) asFloat roundedUp)] ! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 11:37'!districtsSelector ^ [:anObject | anObject]! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 11:37'!normalizedBuildingDimension ^ [:anObject | Point3D x: (self normalizedXWidth value: anObject) y: (self normalizedHeight value: anObject) z: (self normalizedZWidth value: anObject) ]! !!SourceCityImporterDiversifyStrategy methodsFor: 'strategy' stamp: 'Simon 12/4/2013 15:23'!normalizedColor |ratio| ^ [:anObject | ratio := self calculRatioColor: anObject. (ratio > 1) ifTrue: [self maxColor] ifFalse:[self calculMix: self lowColor at: (1-ratio) and: self maxColor at: (ratio)]].! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/4/2013 14:34'!calculMix: color1 at: color1Perc and: color2 at: color2Perc ^Color r: ((color1 red * color1Perc) + (color2 red * color2Perc)) g: ((color1 green * color1Perc) + (color2 green * color2Perc)) b: ((color1 blue * color1Perc) + (color2 blue * color2Perc))! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/4/2013 15:54'!heightNormalizer ^ [:height | 4 * height sqrt]! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/4/2013 15:28'!heightSelector ^ [:anObject | anObject nbTrials]! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/4/2013 15:27'!lowColor ^Color red! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/4/2013 15:51'!maxColor ^Color green! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/4/2013 15:54'!normalizedHeight ^ [:anObject | (self heightNormalizer) value: (self heightSelector value: anObject)]! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/13/2013 10:36'!normalizedXWidth" ^ [:anObject | 1 max: ((self widthNormalizer) value: (self widthSelector value: anObject)) ]" ^ [:anObject | (self widthNormalizer) value: (self xWidthSelector value: anObject) ]! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/13/2013 10:36'!normalizedZWidth ^ [:anObject | (self widthNormalizer) value: (self zWidthSelector value: anObject) ]! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/13/2013 10:36'!widthNormalizer ^ [:width | width sqrt]! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/13/2013 10:19'!xWidthSelector ^ [:anObject | (anObject size)].! !!SourceCityImporterDiversifyStrategy methodsFor: 'tools' stamp: 'Simon 12/13/2013 10:19'!zWidthSelector ^ [:anObject | (anObject size)].! ! Object subclass: #DiversifySystem instanceVariableNames: 'packages trials' classVariableNames: '' poolDictionaries: '' category: 'SourceCity-Diversify'!!DiversifySystem methodsFor: 'accessing' stamp: 'Simon 12/4/2013 11:39'!packages ^ packages! !!DiversifySystem methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 17:47'!findDependencies: aTrial | className | className := aTrial classReplaceOrAddLocalition. ^ packages gather: [:package | (package classes select: [:cl | cl className = className ]) ] ! !!DiversifySystem methodsFor: 'as yet unclassified' stamp: 'Simon 12/5/2013 11:08'!parseFile:fileName | stream line | trials := OrderedCollection new. stream := fileName asFileReference readStream. "read header" line := stream nextLine. line := stream nextLine. [line isNil not] whileTrue: [ trials add: (DiversifyTrial buildWith: line system: self). line := stream nextLine]. packages := (trials groupedBy: [:each | each packageLocation]) values collect: [:each | DiversifyPackage buildWith: each].! !"-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!DiversifySystem class instanceVariableNames: ''!!DiversifySystem class methodsFor: 'as yet unclassified' stamp: 'Simon 12/4/2013 13:59'!import: afileName ^self new parseFile:afileName ! !
Expand Down
2 changes: 1 addition & 1 deletion grid5000.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ mvn clean package

rm -rf repo/diversify-exp
sh script/git/init.sh repo
sleep $((RANDOM%500))

sleep $((RANDOM%500))

java -jar target/Diversify-statements-1.0-SNAPSHOT-jar-with-dependencies.jar git repo

Expand Down

0 comments on commit 6a8f82e

Please sign in to comment.