MCPcopy Create free account
hub / github.com/comaps/comaps / SortBySpec

Method SortBySpec

libs/indexer/feature_data.cpp:195–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

193}
194
195void TypesHolder::SortBySpec()
196{
197 auto const & cl = classif();
198 auto const getPriority = [&cl](uint32_t type) { return cl.GetObject(type)->GetMaxOverlaysPriority(); };
199
200 auto const & checker = UselessTypesChecker::Instance();
201 auto const & subtypes = ftypes::Subtypes::Instance();
202
203 std::stable_sort(begin(), end(), [&checker, &getPriority, &subtypes](uint32_t t1, uint32_t t2)
204 {
205 std::optional<bool> const comparisonResultBasedOnTypeRelation =
206 subtypes.ComparisonResultBasedOnTypeRelation(t1, t2);
207 if (comparisonResultBasedOnTypeRelation.has_value())
208 return comparisonResultBasedOnTypeRelation.value();
209
210 int const p1 = getPriority(t1);
211 int const p2 = getPriority(t2);
212 if (p1 != p2)
213 return p1 > p2;
214
215 // Score - less is better.
216 return checker.Score(t1) < checker.Score(t2);
217 });
218}
219
220vector<string> TypesHolder::ToObjectNames() const
221{

Callers 14

ShowInfoPopupMethod · 0.80
RankerResultMethod · 0.80
FillDetailsFunction · 0.80
LoadFeatureMethod · 0.80
GetLocalizedTypeMethod · 0.80
GetLocalizedAllTypesMethod · 0.80
GetAllReadableTypesMethod · 0.80
CanMarkPlaceAsDisusedMethod · 0.80
SetTypeMethod · 0.80
MarkAsDisusedMethod · 0.80
MakeTypesHolderFunction · 0.80

Calls 8

GetObjectMethod · 0.80
has_valueMethod · 0.80
beginFunction · 0.50
endFunction · 0.50
valueMethod · 0.45
ScoreMethod · 0.45

Tested by 1

MakeTypesHolderFunction · 0.64