D18294: Algorithms to find values and indices in vectors of data
Alexander Semke
noreply at phabricator.kde.org
Wed Jan 16 21:06:12 GMT 2019
asemke added inline comments.
INLINE COMMENTS
> XYCurve.cpp:1690
> +int XYCurve::calculateMaxSteps (unsigned int value) {
> + const char LogTable256[256] =
> + {
should we define this static?
> XYCurve.cpp:1744
> + return yColumn()->valueAt(index);
> + } else {
> + valueFound = false;
In indexForX() you have handling for datetime. Why not to add this here, too?
> XYCurve.cpp:1766
> + // bisects the index every time, so it is possible to find the value in log_2(rowCount) steps
> + bool increase = true;
> + if(properties == AbstractColumn::Properties::MonotonicDecreasing)
this three lines can be simplified to
bool increase = (properties != AbstractColumn::Properties::MonotonicDecreasing);
> XYCurve.cpp:1773
> +
> + unsigned int max_steps = calculateMaxSteps(static_cast<unsigned int>(rowCount));
> +
maxSteps, camel case...
> XYCurve.h:72
> + int indexForX(double x) const;
> + int indexForX(double x, QVector<double>& column, AbstractColumn::Properties properties = AbstractColumn::Properties::No) const;
> + int indexForXinPointsVector(double x, QVector<QPointF>& column, AbstractColumn::Properties properties = AbstractColumn::Properties::No) const;
indexForX oder indexForXinColumn? Let's maybe name all these functions simply indexForX and diferentiation is done by the parameters and the documentation of these overloaded parameters. This would be similar for example to the all those map*() functions in CartesianCoordinateSystem.
REVISION DETAIL
https://phabricator.kde.org/D18294
To: Murmele, asemke
Cc: yurchor, kde-edu, Murmele, narvaez, apol
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-edu/attachments/20190116/0f3e211b/attachment-0001.html>
More information about the kde-edu
mailing list