MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / drawPatterns

Method drawPatterns

cp-profiler/src/cpprofiler/analysis/histogram_scene.cpp:79–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79void HistogramScene::drawPatterns(PatternProp prop)
80{
81
82 auto &scene = *scene_;
83
84 addText(scene, 0, 0, "hight");
85 addText(scene, 1, 0, "count");
86 addText(scene, 2, 0, "size");
87
88 int row = 1;
89
90 for (auto &&p : patterns_)
91 {
92
93 const auto nid = p->first();
94 const int count = p->count();
95 const int height = p->height();
96 /// number of nodes in the frist subtree represeting a pattern
97 const auto size = p->size();
98
99 int val;
100 switch (prop)
101 {
102 case PatternProp::HEIGHT:
103 val = height;
104 break;
105 case PatternProp::COUNT:
106 val = count;
107 break;
108 case PatternProp::SIZE:
109 val = size;
110 break;
111 }
112
113 auto item = addRect(*this, row, val);
114
115 rects_.push_back(item);
116 rect2pattern_.insert(std::make_pair(item, p));
117
118 addText(scene, 0, row, height);
119 addText(scene, 1, row, count);
120 addText(scene, 2, row, size);
121
122 ++row;
123 }
124}
125
126void HistogramScene::setPatterns(std::vector<SubtreePattern> &&patterns)
127{

Callers 1

displayPatternsMethod · 0.80

Calls 6

addTextFunction · 0.85
addRectFunction · 0.85
firstMethod · 0.80
countMethod · 0.80
heightMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected