• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

moosetechnology / MooseIDE / 17938860495

23 Sep 2025 07:28AM UTC coverage: 66.75% (+0.4%) from 66.37%
17938860495

push

github

web-flow
Merge pull request #1423 from moosetechnology/a-good-cleaning

New settings implementation

2683 of 3100 new or added lines in 117 files covered. (86.55%)

105 existing lines in 29 files now uncovered.

20400 of 30562 relevant lines covered (66.75%)

1.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

66.46
/src/MooseIDE-Dependency/MiDistributionMapModel.class.st
1
"
2
I am the model of the distribution map. I am responsible for tag managment, data storage and element sorting.
3
"
4
Class {
5
        #name : 'MiDistributionMapModel',
6
        #superclass : 'MiAbstractModel',
7
        #instVars : [
8
                'entities',
9
                'baseColor',
10
                'childrenQuery',
11
                'tags'
12
        ],
13
        #category : 'MooseIDE-Dependency-DistributionMap',
14
        #package : 'MooseIDE-Dependency',
15
        #tag : 'DistributionMap'
16
}
17

18
{ #category : 'accessing' }
19
MiDistributionMapModel class >> defaultBaseColor [
2✔
20

2✔
21
        ^ Color gray
2✔
22
]
2✔
23

24
{ #category : 'as yet unclassified' }
25
MiDistributionMapModel class >> defaultDynamicTagIsDead [
×
26

×
27
        ^ MiDynamicTag new
×
28
                  color: Color black ;
×
29
                  name: 'Is dead' ;
×
30
                  query: [ :e | e isDead ] ;
×
31
                  yourself
×
32
]
×
33

34
{ #category : 'as yet unclassified' }
35
MiDistributionMapModel class >> defaultDynamicTagIsStub [
×
36

×
37
        ^ MiDynamicTag new
×
38
                  color: Color yellow ;
×
39
                  name: 'Is stub' ;
×
40
                  query: [ :e | e isStub ] ;
×
41
                  yourself
×
42
]
×
43

44
{ #category : 'as yet unclassified' }
45
MiDistributionMapModel class >> defaultDynamicTags [
×
46

×
47
        ^ { 
×
48
                  self defaultDynamicTagIsStub .
×
49
                  self defaultDynamicTagIsDead }
×
50
]
×
51

52
{ #category : 'settings' }
UNCOV
53
MiDistributionMapModel >> availableQueries [
×
UNCOV
54

×
NEW
55
        ^ self currentApplication availableQueries
×
NEW
56
                  addFirst: self currentApplication childrenQuery;
×
NEW
57
                  yourself
×
UNCOV
58
]
×
59

60
{ #category : 'accessing' }
61
MiDistributionMapModel >> childrenFor: anEntity [
2✔
62

2✔
63
        | groups dts children |
2✔
64
        children := childrenQuery runOn: anEntity asMooseGroup.
2✔
65
        dts := tags.
2✔
66
        groups := OrderedCollection new.
2✔
67
        dts size + 1 timesRepeat: [ groups add: OrderedCollection new ].
2✔
68
        children do: [ :child |
2✔
69
                (groups at: 1 + (self indexOfTagFor: child)) add: child ].
2✔
70
        ^ groups flatCollect: [ :child | child ] as: OrderedCollection
2✔
71
]
2✔
72

73
{ #category : 'utilities' }
UNCOV
74
MiDistributionMapModel >> collection: collection1 hasSameElementHas: collection2 [
×
UNCOV
75
        ^((collection1 size = collection2 size)
×
UNCOV
76
        and: [ collection1 allSatisfy: [ :each | collection2 includes: each ] ])
×
UNCOV
77
]
×
78

79
{ #category : 'querying' }
80
MiDistributionMapModel >> colorFor: anEntity [
×
81

×
NEW
82
        ^ self colorForTag: (self tagFor: anEntity)
×
83
]
×
84

85
{ #category : 'querying' }
86
MiDistributionMapModel >> colorForTag: aTag [
2✔
87

2✔
88
        ^ aTag color ifNil: [ baseColor ]
2✔
89
]
2✔
90

91
{ #category : 'settings management' }
92
MiDistributionMapModel >> currentConfiguration [
2✔
93

2✔
94
        ^ MiDistributionMapSettingsConfiguration new
2✔
95
                  baseColor: baseColor;
2✔
96
                  availableTags: self fetchTags;
2✔
97
                  tags: tags;
2✔
98
                  childrenQuery: childrenQuery;
2✔
99
                  yourself
2✔
100
]
2✔
101

102
{ #category : 'settings management' }
103
MiDistributionMapModel >> defaultConfiguration [
2✔
104

2✔
105
        ^ MiDistributionMapSettingsConfiguration new
2✔
106
                  baseColor: self class defaultBaseColor;
2✔
107
                  availableTags: self fetchTags;
2✔
108
                  tags: self fetchTags;
2✔
109
                  childrenQuery: self defaultChildrenQuery;
2✔
110
                  yourself
2✔
111
]
2✔
112

113
{ #category : 'accessing' }
114
MiDistributionMapModel >> entities [
2✔
115

2✔
116
        ^ entities
2✔
117
]
2✔
118

119
{ #category : 'accessing' }
120
MiDistributionMapModel >> entities: anObject [
2✔
121

2✔
122
        entities := anObject
2✔
123
]
2✔
124

125
{ #category : 'accessing' }
126
MiDistributionMapModel >> fetchChildrenQueries [
×
127

×
128
        ^(browser application itemsFor: FQAbstractQuery)
×
129
                  asOrderedCollection select: [ :query | query isValid ]
×
130
]
×
131

132
{ #category : 'accessing' }
133
MiDistributionMapModel >> fetchTags [
2✔
134
        "If we ask the application, then we need the tag browser opened. So we asume a browser is opened on the entities of only one model and we ask the tags in the models of a random moose entity of the browser."
2✔
135

2✔
136
        entities isEmptyOrNil ifFalse: [
2✔
137
                        ^ entities anyOne mooseModel allTags asOrderedCollection sorted:
2✔
138
                                  #name ascending ].
2✔
139

2✔
140
        ^ #(  )
2✔
141
]
2✔
142

143
{ #category : 'testing' }
144
MiDistributionMapModel >> hasSettings [
2✔
145

2✔
146
        ^ true
2✔
147
]
2✔
148

149
{ #category : 'accessing' }
150
MiDistributionMapModel >> indexOfTagFor: anEntity [
×
151

×
NEW
152
        tags doWithIndex: [ :dt :i |
×
153
                (dt isApplicableTo: anEntity) ifTrue: [ ^ i ] ].
×
NEW
154

×
155
        ^ 0
×
156
]
×
157

158
{ #category : 'initialization' }
159
MiDistributionMapModel >> initializeSettings [
2✔
160

2✔
161
        baseColor := self class defaultBaseColor.
2✔
162
        childrenQuery := self defaultChildrenQuery.
2✔
163
        tags := self fetchTags
2✔
164
]
2✔
165

166
{ #category : 'querying' }
167
MiDistributionMapModel >> numberOfchildrenWithProperty: aProp forNode: node [
2✔
168

2✔
169
        ^ (childrenQuery runOn: node asMooseGroup) count: [ :child |
2✔
170
                  aProp isApplicableTo: child ]
2✔
171
]
2✔
172

173
{ #category : 'querying' }
174
MiDistributionMapModel >> orderOuterNodes: aCollectionOfNodes [
2✔
175

2✔
176
        | engine partVectors |
2✔
177
        aCollectionOfNodes ifEmpty: [ ^ #(  ) ].
2✔
178

2✔
179
        partVectors := aCollectionOfNodes
2✔
180
                               collect: [ :node |
2✔
181
                                               AISimilarityItem
2✔
182
                                                       with: node
2✔
183
                                                       andAll: (tags collect: [ :aProp |
2✔
184
                                                                        self
2✔
185
                                                                                numberOfchildrenWithProperty: aProp
2✔
186
                                                                                forNode: node ]) ]
2✔
187
                               as: Array.
2✔
188

2✔
189
        engine := AISeriationEngine with: partVectors.
2✔
190

2✔
191
        ^ engine orderDendrogramLeaves collect: #item
2✔
192
]
2✔
193

194
{ #category : 'querying' }
195
MiDistributionMapModel >> tagFor: anEntity [
×
196

×
NEW
197
        ^ tags
×
NEW
198
                  detect: [ :dynamicTag | dynamicTag isApplicableTo: anEntity ]
×
199
                  ifNone: [ MiNullDynamicTag new ]
×
200
]
×
201

202
{ #category : 'enumerating' }
203
MiDistributionMapModel >> tagsDo: aBlock [
2✔
204
        "This method avoids breaking encapsulation"
2✔
205

2✔
206
        tags do: aBlock
2✔
207
]
2✔
208

209
{ #category : 'accessing' }
210
MiDistributionMapModel >> tooManyEntities [
2✔
211
        "some random value above which computing the DistributionMap takes too long.
2✔
212
        Not very brilliant, but solves https://github.com/moosetechnology/MooseIDE/issues/955"
2✔
213

2✔
214
        ^100
2✔
215
]
2✔
216

217
{ #category : 'settings management' }
218
MiDistributionMapModel >> updateFromConfiguration: aConfiguration [
2✔
219

2✔
220
        baseColor := aConfiguration baseColor.
2✔
221
        tags := aConfiguration tags.
2✔
222
        childrenQuery := aConfiguration childrenQuery.
2✔
223

2✔
224
        browser runVisualization
2✔
225
]
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc