mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-18 16:27:34 +01:00
[apps/*_curve_view_range] Mark accessors const
This commit is contained in:
committed by
Émilie Feral
parent
ed98d8fc93
commit
d4afcfd9fd
@@ -22,13 +22,13 @@ I18n::Message BinomialLaw::parameterDefinitionAtIndex(int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float BinomialLaw::xMin() {
|
float BinomialLaw::xMin() const {
|
||||||
float min = 0.0f;
|
float min = 0.0f;
|
||||||
float max = m_parameter1 > 0.0f ? m_parameter1 : 1.0f;
|
float max = m_parameter1 > 0.0f ? m_parameter1 : 1.0f;
|
||||||
return min - k_displayLeftMarginRatio * (max - min);
|
return min - k_displayLeftMarginRatio * (max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BinomialLaw::xMax() {
|
float BinomialLaw::xMax() const {
|
||||||
float min = 0.0f;
|
float min = 0.0f;
|
||||||
float max = m_parameter1;
|
float max = m_parameter1;
|
||||||
if (max <= min) {
|
if (max <= min) {
|
||||||
@@ -37,7 +37,7 @@ float BinomialLaw::xMax() {
|
|||||||
return max + k_displayRightMarginRatio*(max - min);
|
return max + k_displayRightMarginRatio*(max - min);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BinomialLaw::yMax() {
|
float BinomialLaw::yMax() const {
|
||||||
int maxAbscissa = m_parameter2 < 1.0f ? (m_parameter1+1)*m_parameter2 : m_parameter1;
|
int maxAbscissa = m_parameter2 < 1.0f ? (m_parameter1+1)*m_parameter2 : m_parameter1;
|
||||||
float result = evaluateAtAbscissa(maxAbscissa);
|
float result = evaluateAtAbscissa(maxAbscissa);
|
||||||
if (result <= 0.0f || std::isnan(result)) {
|
if (result <= 0.0f || std::isnan(result)) {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ public:
|
|||||||
I18n::Message title() override { return I18n::Message::BinomialLaw; }
|
I18n::Message title() override { return I18n::Message::BinomialLaw; }
|
||||||
Type type() const override { return Type::Binomial; }
|
Type type() const override { return Type::Binomial; }
|
||||||
bool isContinuous() const override { return false; }
|
bool isContinuous() const override { return false; }
|
||||||
float xMin() override;
|
float xMin() const override;
|
||||||
float xMax() override;
|
float xMax() const override;
|
||||||
float yMax() override;
|
float yMax() const override;
|
||||||
I18n::Message parameterNameAtIndex(int index) override;
|
I18n::Message parameterNameAtIndex(int index) override;
|
||||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||||
float evaluateAtAbscissa(float x) const override {
|
float evaluateAtAbscissa(float x) const override {
|
||||||
|
|||||||
@@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
namespace Probability {
|
namespace Probability {
|
||||||
|
|
||||||
float ExponentialLaw::xMin() {
|
float ExponentialLaw::xMin() const {
|
||||||
return - k_displayLeftMarginRatio * xMax();
|
return - k_displayLeftMarginRatio * xMax();
|
||||||
}
|
}
|
||||||
|
|
||||||
float ExponentialLaw::xMax() {
|
float ExponentialLaw::xMax() const {
|
||||||
assert(m_parameter1 != 0.0f);
|
assert(m_parameter1 != 0.0f);
|
||||||
float result = 5.0f/m_parameter1;
|
float result = 5.0f/m_parameter1;
|
||||||
if (result <= 0.0f) {
|
if (result <= 0.0f) {
|
||||||
@@ -17,7 +17,7 @@ float ExponentialLaw::xMax() {
|
|||||||
return result * (1.0f + k_displayRightMarginRatio);
|
return result * (1.0f + k_displayRightMarginRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ExponentialLaw::yMax() {
|
float ExponentialLaw::yMax() const {
|
||||||
float result = m_parameter1;
|
float result = m_parameter1;
|
||||||
if (result <= 0.0f || std::isnan(result)) {
|
if (result <= 0.0f || std::isnan(result)) {
|
||||||
result = 1.0f;
|
result = 1.0f;
|
||||||
|
|||||||
@@ -12,9 +12,9 @@ public:
|
|||||||
I18n::Message title() override { return I18n::Message::ExponentialLaw; }
|
I18n::Message title() override { return I18n::Message::ExponentialLaw; }
|
||||||
Type type() const override { return Type::Exponential; }
|
Type type() const override { return Type::Exponential; }
|
||||||
bool isContinuous() const override { return true; }
|
bool isContinuous() const override { return true; }
|
||||||
float xMin() override;
|
float xMin() const override;
|
||||||
float xMax() override;
|
float xMax() const override;
|
||||||
float yMax() override;
|
float yMax() const override;
|
||||||
I18n::Message parameterNameAtIndex(int index) override {
|
I18n::Message parameterNameAtIndex(int index) override {
|
||||||
assert(index == 0);
|
assert(index == 0);
|
||||||
return I18n::Message::Lambda;
|
return I18n::Message::Lambda;
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ double Law::evaluateAtDiscreteAbscissa(int k) const {
|
|||||||
return 0.0;
|
return 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Law::yMin() {
|
float Law::yMin() const {
|
||||||
return -k_displayBottomMarginRatio * yMax();
|
return -k_displayBottomMarginRatio * yMax();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ protected:
|
|||||||
constexpr static float k_displayRightMarginRatio = 0.05f;
|
constexpr static float k_displayRightMarginRatio = 0.05f;
|
||||||
private:
|
private:
|
||||||
constexpr static float k_displayBottomMarginRatio = 0.2f;
|
constexpr static float k_displayBottomMarginRatio = 0.2f;
|
||||||
float yMin() override;
|
float yMin() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
namespace Probability {
|
namespace Probability {
|
||||||
|
|
||||||
float NormalLaw::yMax() {
|
float NormalLaw::yMax() const {
|
||||||
float maxAbscissa = m_parameter1;
|
float maxAbscissa = m_parameter1;
|
||||||
float result = evaluateAtAbscissa(maxAbscissa);
|
float result = evaluateAtAbscissa(maxAbscissa);
|
||||||
if (std::isnan(result) || result <= 0.0f) {
|
if (std::isnan(result) || result <= 0.0f) {
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ public:
|
|||||||
I18n::Message title() override { return I18n::Message::NormalLaw; }
|
I18n::Message title() override { return I18n::Message::NormalLaw; }
|
||||||
Type type() const override { return Type::Normal; }
|
Type type() const override { return Type::Normal; }
|
||||||
bool isContinuous() const override { return true; }
|
bool isContinuous() const override { return true; }
|
||||||
float xMin() override { return xExtremum(true); }
|
float xMin() const override { return xExtremum(true); }
|
||||||
float xMax() override { return xExtremum(false); }
|
float xMax() const override { return xExtremum(false); }
|
||||||
float yMax() override;
|
float yMax() const override;
|
||||||
I18n::Message parameterNameAtIndex(int index) override;
|
I18n::Message parameterNameAtIndex(int index) override;
|
||||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||||
float evaluateAtAbscissa(float x) const override;
|
float evaluateAtAbscissa(float x) const override;
|
||||||
|
|||||||
@@ -5,16 +5,16 @@
|
|||||||
|
|
||||||
namespace Probability {
|
namespace Probability {
|
||||||
|
|
||||||
float PoissonLaw::xMin() {
|
float PoissonLaw::xMin() const {
|
||||||
return -k_displayLeftMarginRatio * xMax();
|
return -k_displayLeftMarginRatio * xMax();
|
||||||
}
|
}
|
||||||
|
|
||||||
float PoissonLaw::xMax() {
|
float PoissonLaw::xMax() const {
|
||||||
assert(m_parameter1 != 0);
|
assert(m_parameter1 != 0);
|
||||||
return (m_parameter1 + 5.0f * std::sqrt(m_parameter1)) * (1.0f + k_displayRightMarginRatio);
|
return (m_parameter1 + 5.0f * std::sqrt(m_parameter1)) * (1.0f + k_displayRightMarginRatio);
|
||||||
}
|
}
|
||||||
|
|
||||||
float PoissonLaw::yMax() {
|
float PoissonLaw::yMax() const {
|
||||||
int maxAbscissa = (int)m_parameter1;
|
int maxAbscissa = (int)m_parameter1;
|
||||||
assert(maxAbscissa >= 0.0f);
|
assert(maxAbscissa >= 0.0f);
|
||||||
float result = evaluateAtAbscissa(maxAbscissa);
|
float result = evaluateAtAbscissa(maxAbscissa);
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ public:
|
|||||||
I18n::Message title() override { return I18n::Message::PoissonLaw; }
|
I18n::Message title() override { return I18n::Message::PoissonLaw; }
|
||||||
Type type() const override { return Type::Poisson; }
|
Type type() const override { return Type::Poisson; }
|
||||||
bool isContinuous() const override { return false; }
|
bool isContinuous() const override { return false; }
|
||||||
float xMin() override;
|
float xMin() const override;
|
||||||
float xMax() override;
|
float xMax() const override;
|
||||||
float yMax() override;
|
float yMax() const override;
|
||||||
I18n::Message parameterNameAtIndex(int index) override {
|
I18n::Message parameterNameAtIndex(int index) override {
|
||||||
assert(index == 0);
|
assert(index == 0);
|
||||||
return I18n::Message::Lambda;
|
return I18n::Message::Lambda;
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ I18n::Message UniformLaw::parameterDefinitionAtIndex(int index) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
float UniformLaw::xMin() {
|
float UniformLaw::xMin() const {
|
||||||
assert(m_parameter2 >= m_parameter1);
|
assert(m_parameter2 >= m_parameter1);
|
||||||
if (m_parameter2 - m_parameter1 < FLT_EPSILON) {
|
if (m_parameter2 - m_parameter1 < FLT_EPSILON) {
|
||||||
return m_parameter1 - 1.0f;
|
return m_parameter1 - 1.0f;
|
||||||
@@ -32,14 +32,14 @@ float UniformLaw::xMin() {
|
|||||||
return m_parameter1 - 0.6f * (m_parameter2 - m_parameter1);
|
return m_parameter1 - 0.6f * (m_parameter2 - m_parameter1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float UniformLaw::xMax() {
|
float UniformLaw::xMax() const {
|
||||||
if (m_parameter2 - m_parameter1 < FLT_EPSILON) {
|
if (m_parameter2 - m_parameter1 < FLT_EPSILON) {
|
||||||
return m_parameter1 + 1.0f;
|
return m_parameter1 + 1.0f;
|
||||||
}
|
}
|
||||||
return m_parameter2 + 0.6f * (m_parameter2 - m_parameter1);
|
return m_parameter2 + 0.6f * (m_parameter2 - m_parameter1);
|
||||||
}
|
}
|
||||||
|
|
||||||
float UniformLaw::yMax() {
|
float UniformLaw::yMax() const {
|
||||||
float result = m_parameter2 - m_parameter1 < FLT_EPSILON ? k_diracMaximum : 1.0f/(m_parameter2-m_parameter1);
|
float result = m_parameter2 - m_parameter1 < FLT_EPSILON ? k_diracMaximum : 1.0f/(m_parameter2-m_parameter1);
|
||||||
if (result <= 0.0f || std::isnan(result) || std::isinf(result)) {
|
if (result <= 0.0f || std::isnan(result) || std::isinf(result)) {
|
||||||
result = 1.0f;
|
result = 1.0f;
|
||||||
|
|||||||
@@ -11,9 +11,9 @@ public:
|
|||||||
I18n::Message title() override { return I18n::Message::UniformLaw; }
|
I18n::Message title() override { return I18n::Message::UniformLaw; }
|
||||||
Type type() const override { return Type::Uniform; }
|
Type type() const override { return Type::Uniform; }
|
||||||
bool isContinuous() const override { return true; }
|
bool isContinuous() const override { return true; }
|
||||||
float xMin() override;
|
float xMin() const override;
|
||||||
float xMax() override;
|
float xMax() const override;
|
||||||
float yMax() override;
|
float yMax() const override;
|
||||||
I18n::Message parameterNameAtIndex(int index) override;
|
I18n::Message parameterNameAtIndex(int index) override;
|
||||||
I18n::Message parameterDefinitionAtIndex(int index) override;
|
I18n::Message parameterDefinitionAtIndex(int index) override;
|
||||||
float evaluateAtAbscissa(float x) const override;
|
float evaluateAtAbscissa(float x) const override;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ uint32_t CurveViewRange::rangeChecksum() {
|
|||||||
return Ion::crc32Word((uint32_t *)data, dataLengthInBytes/sizeof(uint32_t));
|
return Ion::crc32Word((uint32_t *)data, dataLengthInBytes/sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
float CurveViewRange::computeGridUnit(Axis axis, float range) {
|
float CurveViewRange::computeGridUnit(Axis axis, float range) const {
|
||||||
int a = 0;
|
int a = 0;
|
||||||
int b = 0;
|
int b = 0;
|
||||||
float maxNumberOfUnits = (axis == Axis::X) ? k_maxNumberOfXGridUnits : k_maxNumberOfYGridUnits;
|
float maxNumberOfUnits = (axis == Axis::X) ? k_maxNumberOfXGridUnits : k_maxNumberOfYGridUnits;
|
||||||
|
|||||||
@@ -13,13 +13,13 @@ public:
|
|||||||
};
|
};
|
||||||
virtual uint32_t rangeChecksum();
|
virtual uint32_t rangeChecksum();
|
||||||
|
|
||||||
virtual float xMin() = 0;
|
virtual float xMin() const = 0;
|
||||||
virtual float xMax() = 0;
|
virtual float xMax() const = 0;
|
||||||
virtual float yMin() = 0;
|
virtual float yMin() const = 0;
|
||||||
virtual float yMax() = 0;
|
virtual float yMax() const = 0;
|
||||||
virtual float xGridUnit() { return computeGridUnit(Axis::X, xMax() - xMin()); }
|
virtual float xGridUnit() const { return computeGridUnit(Axis::X, xMax() - xMin()); }
|
||||||
virtual float yGridUnit() { return 0.0f; }
|
virtual float yGridUnit() const { return 0.0f; }
|
||||||
float computeGridUnit(Axis axis, float range);
|
float computeGridUnit(Axis axis, float range) const;
|
||||||
constexpr static float k_maxNumberOfXGridUnits = 18.0f;
|
constexpr static float k_maxNumberOfXGridUnits = 18.0f;
|
||||||
constexpr static float k_maxNumberOfYGridUnits = 13.0f;
|
constexpr static float k_maxNumberOfYGridUnits = 13.0f;
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ static_assert(Ion::Display::WidthInTenthOfMillimeter == 576, "Use the new screen
|
|||||||
static_assert(Ion::Display::HeightInTenthOfMillimeter == 432, "Use the new screen height to compute Shared::InteractiveCurveViewRange::NormalizedYHalfRange");
|
static_assert(Ion::Display::HeightInTenthOfMillimeter == 432, "Use the new screen height to compute Shared::InteractiveCurveViewRange::NormalizedYHalfRange");
|
||||||
|
|
||||||
typedef void (InteractiveCurveViewRange::*ParameterSetterPointer)(float);
|
typedef void (InteractiveCurveViewRange::*ParameterSetterPointer)(float);
|
||||||
typedef float (InteractiveCurveViewRange::*ParameterGetterPointer)();
|
typedef float (InteractiveCurveViewRange::*ParameterGetterPointer)() const;
|
||||||
typedef void (InteractiveCurveViewRange::*RangeMethodPointer)();
|
typedef void (InteractiveCurveViewRange::*RangeMethodPointer)();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ class MemoizedCurveViewRange : public CurveViewRange {
|
|||||||
public:
|
public:
|
||||||
MemoizedCurveViewRange();
|
MemoizedCurveViewRange();
|
||||||
//CurveViewWindow
|
//CurveViewWindow
|
||||||
float xMin() override { return m_xMin; }
|
float xMin() const override { return m_xMin; }
|
||||||
float xMax() override { return m_xMax; }
|
float xMax() const override { return m_xMax; }
|
||||||
float yMin() override { return m_yMin; }
|
float yMin() const override { return m_yMin; }
|
||||||
float yMax() override { return m_yMax; }
|
float yMax() const override { return m_yMax; }
|
||||||
float xGridUnit() override { return m_xGridUnit; }
|
float xGridUnit() const override { return m_xGridUnit; }
|
||||||
float yGridUnit() override { return m_yGridUnit; }
|
float yGridUnit() const override { return m_yGridUnit; }
|
||||||
virtual void setXMin(float f);
|
virtual void setXMin(float f);
|
||||||
virtual void setXMax(float f);
|
virtual void setXMax(float f);
|
||||||
virtual void setYMin(float f);
|
virtual void setYMin(float f);
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ BoxRange::BoxRange(Store * store) :
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
float BoxRange::xMin() {
|
float BoxRange::xMin() const {
|
||||||
float min = m_store->minValueForAllSeries();
|
float min = m_store->minValueForAllSeries();
|
||||||
float max = m_store->maxValueForAllSeries();
|
float max = m_store->maxValueForAllSeries();
|
||||||
max = min >= max ? min + 1 : max;
|
max = min >= max ? min + 1 : max;
|
||||||
return min - k_displayLeftMarginRatio*(max-min);
|
return min - k_displayLeftMarginRatio*(max-min);
|
||||||
}
|
}
|
||||||
|
|
||||||
float BoxRange::xMax() {
|
float BoxRange::xMax() const {
|
||||||
float min = m_store->minValueForAllSeries();
|
float min = m_store->minValueForAllSeries();
|
||||||
float max = m_store->maxValueForAllSeries();
|
float max = m_store->maxValueForAllSeries();
|
||||||
max = min >= max ? min + 1 : max;
|
max = min >= max ? min + 1 : max;
|
||||||
|
|||||||
@@ -9,10 +9,10 @@ namespace Statistics {
|
|||||||
class BoxRange : public Shared::CurveViewRange {
|
class BoxRange : public Shared::CurveViewRange {
|
||||||
public:
|
public:
|
||||||
BoxRange(Store * store);
|
BoxRange(Store * store);
|
||||||
float xMin() override;
|
float xMin() const override;
|
||||||
float xMax() override;
|
float xMax() const override;
|
||||||
float yMin() override { return -k_displayBottomMarginRatio; }
|
float yMin() const override { return -k_displayBottomMarginRatio; }
|
||||||
float yMax() override { return 1.0f+k_displayTopMarginRatio; }
|
float yMax() const override { return 1.0f+k_displayTopMarginRatio; }
|
||||||
private:
|
private:
|
||||||
constexpr static float k_displayTopMarginRatio = 0.05f;
|
constexpr static float k_displayTopMarginRatio = 0.05f;
|
||||||
constexpr static float k_displayRightMarginRatio = 0.2f;
|
constexpr static float k_displayRightMarginRatio = 0.2f;
|
||||||
|
|||||||
Reference in New Issue
Block a user