mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-19 00:37:25 +01:00
[apps/regression] Add two rows to stats
Change-Id: I36e0611f20fb3e4cf659e96e52ef0fedb8346e69
This commit is contained in:
@@ -25,7 +25,7 @@ constexpr static char deviationSpanishDefinition[] = {Ion::Charset::SmallSigma,
|
||||
constexpr static char deviationGermanDefinition[] = {Ion::Charset::SmallSigma, ' ', ':', ' ', 'S', 't', 'a', 'n', 'd', 'a', 'r', 'd', 'a', 'b', 'w', 'e', 'i', 'c', 'h', 'u', 'n', 'g', 0};
|
||||
constexpr static char deviationPortugueseDefinition[] = {Ion::Charset::SmallSigma, ' ', ':', ' ', 'D', 'e','s','v','i','o',' ','p','a','d','r','a','o', 0};
|
||||
|
||||
const char * messages[224][5] {
|
||||
const char * messages[225][5] {
|
||||
{"Attention", "Warning", "Cuidado", "Achtung", "Atencao"},
|
||||
{"Valider", "Confirm", "Confirmar", "Bestatigen", "Confirmar"},
|
||||
{"Annuler", "Cancel", "Cancelar", "Abbrechen", "Cancelar"},
|
||||
@@ -239,6 +239,7 @@ const char * messages[224][5] {
|
||||
{"Regressions", "Regression", "Regresion", "Regression", "Regressao"},
|
||||
{"REGRESSIONS", "REGRESSION", "REGRESION", "REGRESSION", "REGRESSAO"},
|
||||
|
||||
{"Regression", "Regression", "Regresion", "Regression", "Regressao"},
|
||||
{"Pas assez de donnees pour une regression", "Not enough data for regerssion", "Escasez de datos para la regresion", "Nicht genug Daten fur eine Regression", "Nao ha dados suficientes para uma regressao"},
|
||||
{"reg", "reg", "reg", "reg", "reg"},
|
||||
{"Droite de regression", "Regression line", "Recta de regresion", "Regressionsgerade", "Linha de regressao"},
|
||||
|
||||
@@ -205,6 +205,7 @@ namespace I18n {
|
||||
/* Regression */
|
||||
RegressionApp,
|
||||
RegressionAppCapital,
|
||||
Regression,
|
||||
NoEnoughDataForRegression,
|
||||
Reg,
|
||||
RegressionSlope,
|
||||
|
||||
@@ -42,7 +42,7 @@ bool CalculationController::handleEvent(Ion::Events::Event event) {
|
||||
return true;
|
||||
}
|
||||
if (event == Ion::Events::Copy && selectedColumn() == 1 && selectedRow() > 0) {
|
||||
if (selectedRow() < 6) {
|
||||
if (selectedRow() <= k_totalNumberOfDoubleBufferRows) {
|
||||
EvenOddDoubleBufferTextCell * myCell = (EvenOddDoubleBufferTextCell *)selectableTableView()->selectedCell();
|
||||
if (myCell->firstTextSelected()) {
|
||||
Clipboard::sharedClipboard()->store(myCell->firstText());
|
||||
@@ -82,17 +82,17 @@ void CalculationController::tableViewDidChangeSelection(SelectableTableView * t,
|
||||
t->selectCellAtLocation(previousSelectedCellX, previousSelectedCellY);
|
||||
}
|
||||
}
|
||||
if (t->selectedColumn() == 1 && t->selectedRow() >= 0 && t->selectedRow() < 6) {
|
||||
if (t->selectedColumn() == 1 && t->selectedRow() >= 0 && t->selectedRow() <= k_totalNumberOfDoubleBufferRows) {
|
||||
EvenOddDoubleBufferTextCell * myCell = (EvenOddDoubleBufferTextCell *)t->selectedCell();
|
||||
bool firstSubCellSelected = true;
|
||||
if (previousSelectedCellX == 1 && previousSelectedCellY >= 0 && previousSelectedCellY < 6) {
|
||||
if (previousSelectedCellX == 1 && previousSelectedCellY >= 0 && previousSelectedCellY <= k_totalNumberOfDoubleBufferRows) {
|
||||
EvenOddDoubleBufferTextCell * myPreviousCell = (EvenOddDoubleBufferTextCell *)t->cellAtLocation(previousSelectedCellX, previousSelectedCellY);
|
||||
firstSubCellSelected = myPreviousCell->firstTextSelected();
|
||||
}
|
||||
myCell->selectFirstText(firstSubCellSelected);
|
||||
app()->setFirstResponder(myCell);
|
||||
} else {
|
||||
if (previousSelectedCellX == 1 && previousSelectedCellY >= 0 && previousSelectedCellY < 6) {
|
||||
if (previousSelectedCellX == 1 && previousSelectedCellY >= 0 && previousSelectedCellY <= k_totalNumberOfDoubleBufferRows) {
|
||||
EvenOddDoubleBufferTextCell * myPreviousCell = (EvenOddDoubleBufferTextCell *)t->cellAtLocation(previousSelectedCellX, previousSelectedCellY);
|
||||
if (app()->firstResponder()->commonAncestorWith(myPreviousCell) == myPreviousCell) {
|
||||
app()->setFirstResponder(t);
|
||||
@@ -135,7 +135,7 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
return;
|
||||
}
|
||||
if (i == 0) {
|
||||
if (j == 10) {
|
||||
if (j == numberOfRows()-1) {
|
||||
EvenOddExpressionCell * myCell = (EvenOddExpressionCell *)cell;
|
||||
myCell->setExpression(m_r2Layout);
|
||||
return;
|
||||
@@ -146,12 +146,12 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
return;
|
||||
}
|
||||
myCell->setAlignment(1.0f, 0.5f);
|
||||
I18n::Message titles[k_totalNumberOfRows-1] = {I18n::Message::Mean, I18n::Message::Sum, I18n::Message::SquareSum, I18n::Message::StandardDeviation, I18n::Message::Deviation, I18n::Message::NumberOfDots, I18n::Message::Covariance, I18n::Message::Sxy, I18n::Message::R, I18n::Message::Default};
|
||||
I18n::Message titles[k_totalNumberOfRows-1] = {I18n::Message::Mean, I18n::Message::Sum, I18n::Message::SquareSum, I18n::Message::StandardDeviation, I18n::Message::Deviation, I18n::Message::NumberOfDots, I18n::Message::Covariance, I18n::Message::Sxy, I18n::Message::Regression, I18n::Message::A, I18n::Message::B, I18n::Message::R, I18n::Message::Default};
|
||||
myCell->setMessage(titles[j-1]);
|
||||
return;
|
||||
}
|
||||
if (i == 1 && j > 0 && j < 6) {
|
||||
ArgCalculPointer calculationMethods[(k_totalNumberOfRows-1)/2] = {&Store::meanOfColumn, &Store::sumOfColumn,
|
||||
if (i == 1 && j > 0 && j <= k_totalNumberOfDoubleBufferRows) {
|
||||
ArgCalculPointer calculationMethods[k_totalNumberOfDoubleBufferRows] = {&Store::meanOfColumn, &Store::sumOfColumn,
|
||||
&Store::squaredValueSumOfColumn, &Store::standardDeviationOfColumn, &Store::varianceOfColumn};
|
||||
float calculation1 = (m_store->*calculationMethods[j-1])(0);
|
||||
float calculation2 = (m_store->*calculationMethods[j-1])(1);
|
||||
@@ -163,10 +163,16 @@ void CalculationController::willDisplayCellAtLocation(HighlightCell * cell, int
|
||||
myCell->setSecondText(buffer);
|
||||
return;
|
||||
}
|
||||
if (i == 1 && j > 5) {
|
||||
CalculPointer calculationMethods[(k_totalNumberOfRows-1)/2] = {&Store::numberOfPairs, &Store::covariance,
|
||||
&Store::columnProductSum, &Store::correlationCoefficient, &Store::squaredCorrelationCoefficient};
|
||||
float calculation = (m_store->*calculationMethods[j-6])();
|
||||
if (i == 1 && j == 9) {
|
||||
EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)cell;
|
||||
myCell->setText("ax+b");
|
||||
return;
|
||||
}
|
||||
if (i == 1 && j > k_totalNumberOfDoubleBufferRows) {
|
||||
assert(j != 9);
|
||||
CalculPointer calculationMethods[k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows] = {&Store::numberOfPairs, &Store::covariance,
|
||||
&Store::columnProductSum, nullptr, &Store::slope, &Store::yIntercept, &Store::correlationCoefficient, &Store::squaredCorrelationCoefficient};
|
||||
float calculation = (m_store->*calculationMethods[j-k_totalNumberOfDoubleBufferRows-1])();
|
||||
EvenOddBufferTextCell * myCell = (EvenOddBufferTextCell *)cell;
|
||||
char buffer[Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits)];
|
||||
Complex::convertFloatToText(calculation, buffer, Complex::bufferSizeForFloatsWithPrecision(Constant::LargeNumberOfSignificantDigits), Constant::LargeNumberOfSignificantDigits);
|
||||
@@ -186,6 +192,7 @@ KDCoordinate CalculationController::rowHeight(int j) {
|
||||
HighlightCell * CalculationController::reusableCell(int index, int type) {
|
||||
if (type == 0) {
|
||||
assert(index < k_maxNumberOfDisplayableRows);
|
||||
assert(m_titleCells[index] != nullptr);
|
||||
return m_titleCells[index];
|
||||
}
|
||||
if (type == 1) {
|
||||
@@ -197,10 +204,12 @@ HighlightCell * CalculationController::reusableCell(int index, int type) {
|
||||
return m_columnTitleCell;
|
||||
}
|
||||
if (type == 3) {
|
||||
assert(index < k_totalNumberOfRows/2);
|
||||
assert(index < k_totalNumberOfDoubleBufferRows);
|
||||
assert(m_doubleCalculationCells[index] != nullptr);
|
||||
return m_doubleCalculationCells[index];
|
||||
}
|
||||
assert(index < k_totalNumberOfRows/2);
|
||||
assert(index < k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows);
|
||||
assert(m_calculationCells[index] != nullptr);
|
||||
return m_calculationCells[index];
|
||||
}
|
||||
|
||||
@@ -215,13 +224,13 @@ int CalculationController::reusableCellCount(int type) {
|
||||
return 1;
|
||||
}
|
||||
if (type == 3) {
|
||||
return k_maxNumberOfDisplayableRows/2;
|
||||
return k_totalNumberOfDoubleBufferRows;
|
||||
}
|
||||
return k_maxNumberOfDisplayableRows/2;
|
||||
return k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows;
|
||||
}
|
||||
|
||||
int CalculationController::typeAtLocation(int i, int j) {
|
||||
if (i == 0 && j == 10) {
|
||||
if (i == 0 && j == k_totalNumberOfRows-1) {
|
||||
return 1;
|
||||
}
|
||||
if (i == 0) {
|
||||
@@ -230,7 +239,7 @@ int CalculationController::typeAtLocation(int i, int j) {
|
||||
if (j == 0) {
|
||||
return 2;
|
||||
}
|
||||
if (j > 0 && j < 6) {
|
||||
if (j > 0 && j <= k_totalNumberOfDoubleBufferRows) {
|
||||
return 3;
|
||||
}
|
||||
return 4;
|
||||
@@ -247,10 +256,12 @@ View * CalculationController::loadView() {
|
||||
for (int i = 0; i < k_maxNumberOfDisplayableRows; i++) {
|
||||
m_titleCells[i] = new EvenOddMessageTextCell(KDText::FontSize::Small);
|
||||
}
|
||||
for (int i = 0; i < k_maxNumberOfDisplayableRows/2; i++) {
|
||||
for (int i = 0; i < k_totalNumberOfDoubleBufferRows; i++) {
|
||||
m_doubleCalculationCells[i] = new EvenOddDoubleBufferTextCell();
|
||||
m_doubleCalculationCells[i]->setTextColor(Palette::GreyDark);
|
||||
m_doubleCalculationCells[i]->setParentResponder(tableView);
|
||||
}
|
||||
for (int i = 0; i < k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows;i++) {
|
||||
m_calculationCells[i] = new EvenOddBufferTextCell(KDText::FontSize::Small);
|
||||
m_calculationCells[i]->setTextColor(Palette::GreyDark);
|
||||
}
|
||||
@@ -262,9 +273,11 @@ void CalculationController::unloadView(View * view) {
|
||||
m_r2TitleCell = nullptr;
|
||||
delete m_columnTitleCell;
|
||||
m_columnTitleCell = nullptr;
|
||||
for (int i = 0; i < k_maxNumberOfDisplayableRows/2; i++) {
|
||||
for (int i = 0; i < k_totalNumberOfDoubleBufferRows; i++) {
|
||||
delete m_doubleCalculationCells[i];
|
||||
m_doubleCalculationCells[i] = nullptr;
|
||||
}
|
||||
for (int i = 0; i < k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows;i++) {
|
||||
delete m_calculationCells[i];
|
||||
m_calculationCells[i] = nullptr;
|
||||
}
|
||||
|
||||
@@ -39,17 +39,18 @@ private:
|
||||
Responder * tabController() const override;
|
||||
View * loadView() override;
|
||||
void unloadView(View * view) override;
|
||||
constexpr static int k_totalNumberOfRows = 11;
|
||||
constexpr static int k_totalNumberOfRows = 14;
|
||||
constexpr static int k_totalNumberOfColumns = 2;
|
||||
constexpr static int k_maxNumberOfDisplayableRows = 10;
|
||||
constexpr static int k_maxNumberOfDisplayableRows = 11;
|
||||
constexpr static int k_totalNumberOfDoubleBufferRows = 5;
|
||||
static constexpr KDCoordinate k_cellHeight = 25;
|
||||
static constexpr KDCoordinate k_cellWidth = Ion::Display::Width/2 - Metric::CommonRightMargin/2 - Metric::CommonLeftMargin/2;
|
||||
EvenOddMessageTextCell * m_titleCells[k_maxNumberOfDisplayableRows];
|
||||
EvenOddExpressionCell * m_r2TitleCell;
|
||||
Poincare::ExpressionLayout * m_r2Layout;
|
||||
EvenOddDoubleBufferTextCell * m_columnTitleCell;
|
||||
EvenOddDoubleBufferTextCell * m_doubleCalculationCells[k_maxNumberOfDisplayableRows/2];
|
||||
EvenOddBufferTextCell * m_calculationCells[k_maxNumberOfDisplayableRows/2];
|
||||
EvenOddDoubleBufferTextCell * m_doubleCalculationCells[k_totalNumberOfDoubleBufferRows];
|
||||
EvenOddBufferTextCell * m_calculationCells[k_totalNumberOfRows-k_totalNumberOfDoubleBufferRows];
|
||||
Store * m_store;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user