MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / simplify

Method simplify

3rdparty/qcustomplot/qcustomplot.cpp:2600–2625  ·  view source on GitHub ↗

! Sorts all data ranges by range begin index in ascending order, and then joins directly adjacent or overlapping ranges. This can reduce the number of individual data ranges in the selection, and prevents possible double-counting when iterating over the data points held by the data ranges. This method is automatically called when using the addition/subtraction operators. The only case w

Source from the content-addressed store, hash-verified

2598 simplify explicitly set to false.
2599*/
2600void QCPDataSelection::simplify()
2601{
2602 // remove any empty ranges:
2603 for (int i=mDataRanges.size()-1; i>=0; --i)
2604 {
2605 if (mDataRanges.at(i).isEmpty())
2606 mDataRanges.removeAt(i);
2607 }
2608 if (mDataRanges.isEmpty())
2609 return;
2610
2611 // sort ranges by starting value, ascending:
2612 std::sort(mDataRanges.begin(), mDataRanges.end(), lessThanDataRangeBegin);
2613
2614 // join overlapping/contiguous ranges:
2615 int i = 1;
2616 while (i < mDataRanges.size())
2617 {
2618 if (mDataRanges.at(i-1).end() >= mDataRanges.at(i).begin()) // range i overlaps/joins with i-1, so expand range i-1 appropriately and remove range i from list
2619 {
2620 mDataRanges[i-1].setEnd(qMax(mDataRanges.at(i-1).end(), mDataRanges.at(i).end()));
2621 mDataRanges.removeAt(i);
2622 } else
2623 ++i;
2624 }
2625}
2626
2627/*!
2628 Makes sure this data selection conforms to the specified \a type selection type. Before the type

Callers 8

addDataRangeMethod · 0.95
intersectionMethod · 0.80
inverseMethod · 0.80
selectTestRectMethod · 0.80
getDataSegmentsMethod · 0.80
selectTestRectMethod · 0.80
selectTestMethod · 0.80
getDataSegmentsMethod · 0.80

Calls 9

rowCountFunction · 0.85
columnCountFunction · 0.85
sizeMethod · 0.45
isEmptyMethod · 0.45
atMethod · 0.45
removeAtMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected