summaryrefslogtreecommitdiff
path: root/noncore/apps/opie-sheet/sheet.cpp
Side-by-side diff
Diffstat (limited to 'noncore/apps/opie-sheet/sheet.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/apps/opie-sheet/sheet.cpp122
1 files changed, 85 insertions, 37 deletions
diff --git a/noncore/apps/opie-sheet/sheet.cpp b/noncore/apps/opie-sheet/sheet.cpp
index 88847da..477c982 100644
--- a/noncore/apps/opie-sheet/sheet.cpp
+++ b/noncore/apps/opie-sheet/sheet.cpp
@@ -1,10 +1,29 @@
-/***************************************************************************
- * *
- * This program is free software; you can redistribute it and/or modify *
- * it under the terms of the GNU General Public License as published by *
- * the Free Software Foundation; either version 2 of the License, or *
- * (at your option) any later version. *
- * *
- ***************************************************************************/
+/*
+ =. This file is part of the Opie Project
+ .=l. Copyright (C) 2004 Opie Developer Team <opie-devel@handhelds.org>
+ .>+-=
+ _;:, .> :=|. This program is free software; you can
+.> <`_, > . <= redistribute it and/or modify it under
+:`=1 )Y*s>-.-- : the terms of the GNU General Public
+.="- .-=="i, .._ License as published by the Free Software
+ - . .-<_> .<> Foundation; either version 2 of the License,
+ ._= =} : or (at your option) any later version.
+ .%`+i> _;_.
+ .i_,=:_. -<s. This program is distributed in the hope that
+ + . -:. = it will be useful, but WITHOUT ANY WARRANTY;
+ : .. .:, . . . without even the implied warranty of
+ =_ + =;=|` MERCHANTABILITY or FITNESS FOR A
+ _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU
+..}^=.= = ; Library General Public License for more
+++= -. .` .: details.
+ : = ...= . :.=-
+ -. .:....=;==+<; You should have received a copy of the GNU
+ -_. . . )=. = Library General Public License along with
+ -- :-=` this library; see the file COPYING.LIB.
+ If not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
/*
@@ -15,5 +34,8 @@
#include "sheet.h"
+/* QT */
#include <qmessagebox.h>
+
+/* STD */
#include <math.h>
#include <stdlib.h>
@@ -49,6 +71,5 @@ Sheet::Sheet(int numRows, int numCols, QWidget *parent)
Sheet::~Sheet()
-{
-}
+{}
typeCellData *Sheet::findCellData(int row, int col)
@@ -68,5 +89,6 @@ void Sheet::slotCellSelected(int row, int col)
{
emit currentDataChanged(cellData->data);
- }else
+ }
+ else
emit currentDataChanged("");
}
@@ -229,5 +251,6 @@ double Sheet::BesselI0(double x)
y*=y;
ans=1.0+y*(3.5156229+y*(3.0899424+y*(1.2067492 +y*(0.2659732+y*(0.360768e-1+y*0.45813e-2)))));
- }else
+ }
+ else
{
y=3.75/ax;
@@ -246,5 +269,6 @@ double Sheet::BesselI1(double x)
y*=y;
ans=ax*(0.5+y*(0.87890594+y*(0.51498869+y*(0.15084934 +y*(0.2658733e-1+y*(0.301532e-2+y*0.32411e-3))))));
- } else
+ }
+ else
{
y=3.75/ax;
@@ -293,5 +317,6 @@ double Sheet::BesselK0(double x)
y=x*x/4.0;
ans=(-log(x/2.0)*BesselI0(x))+(-0.57721566+y*(0.42278420 +y*(0.23069756+y*(0.3488590e-1+y*(0.262698e-2 +y*(0.10750e-3+y*0.74e-5))))));
- } else
+ }
+ else
{
y=2.0/x;
@@ -308,5 +333,6 @@ double Sheet::BesselK1(double x)
y=x*x/4.0;
ans=(log(x/2.0)*BesselI1(x))+(1.0/x)*(1.0+y*(0.15443144 +y*(-0.67278579+y*(-0.18156897+y*(-0.1919402e-1 +y*(-0.110404e-2+y*(-0.4686e-4)))))));
- } else
+ }
+ else
{
y=2.0/x;
@@ -343,5 +369,6 @@ double Sheet::BesselJ0(double x)
ans2=57568490411.0+y*(1029532985.0+y*(9494680.718 +y*(59272.64853+y*(267.8532712+y*1.0))));
ans=ans1/ans2;
- } else
+ }
+ else
{
z=8.0/ax;
@@ -365,5 +392,6 @@ double Sheet::BesselY0(double x)
ans2=40076544269.0+y*(745249964.8+y*(7189466.438 +y*(47447.26470+y*(226.1030244+y*1.0))));
ans=(ans1/ans2)+0.636619772*BesselJ0(x)*log(x);
- } else
+ }
+ else
{
z=8.0/x;
@@ -387,5 +415,6 @@ double Sheet::BesselJ1(double x)
ans2=144725228442.0+y*(2300535178.0+y*(18583304.74 +y*(99447.43394+y*(376.9991397+y*1.0))));
ans=ans1/ans2;
- } else
+ }
+ else
{
z=8.0/ax; y=z*z; xx=ax-2.356194491;
@@ -408,5 +437,6 @@ double Sheet::BesselY1(double x)
ans2=0.2499580570e14+y*(0.4244419664e12 +y*(0.3733650367e10+y*(0.2245904002e8 +y*(0.1020426050e6+y*(0.3549632885e3+y)))));
ans=(ans1/ans2)+0.636619772*(BesselJ1(x)*log(x)-1.0/x);
- } else
+ }
+ else
{
z=8.0/x;
@@ -459,5 +489,6 @@ double Sheet::BesselJ(int n, double x)
}
ans=bj;
- } else
+ }
+ else
{
tox=2.0/ax;
@@ -519,5 +550,6 @@ double Sheet::GammaP(double a, double x)
GammaSeries(&gamser,a,x,&gln);
return gamser;
- }else
+ }
+ else
{
GammaContinuedFraction(&gammcf,a,x,&gln);
@@ -545,5 +577,6 @@ void Sheet::GammaSeries(double *gamser, double a, double x, double *gln)
*gamser=0.0;
return;
- } else
+ }
+ else
{
ap=a;
@@ -559,5 +592,6 @@ void Sheet::GammaSeries(double *gamser, double a, double x, double *gln)
return;
}
- } return;
+ }
+ return;
return;
}
@@ -663,5 +697,6 @@ double Sheet::functionSum(const QString &param1, const QString &param2)
}
return result;
- }else
+ }
+ else
{
double d1=0,d2=0;
@@ -790,5 +825,6 @@ double Sheet::functionSumSQ(const QString &param1, const QString &param2)
}
return result;
- }else
+ }
+ else
{
double d1=0,d2=0;
@@ -820,5 +856,6 @@ double Sheet::functionMin(const QString &param1, const QString &param2)
}
return min;
- }else
+ }
+ else
{
double d1=0,d2=0;
@@ -848,5 +885,6 @@ double Sheet::functionMax(const QString &param1, const QString &param2)
};
return max;
- }else
+ }
+ else
{
double d1=0,d2=0;
@@ -878,5 +916,6 @@ double Sheet::functionCount(const QString &param1, const QString &param2)
};
return divider;
- }else
+ }
+ else
{
double d1=0,d2=0;int ii=0;
@@ -993,10 +1032,12 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
{
if(text(row,col).length()==0) val1=1; else val1=0;
- }else
+ }
+ else
{
if(findRowColumn(calculateVariable(getParameter(parameters, 0)), &row,&col, FALSE))
{
if(text(row,col).length()==0) val1=1; else val1=0;
- }else
+ }
+ else
{
val1=0;
@@ -1013,5 +1054,6 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
val1=text(row,col).toDouble(&ok);
if(ok) val1=1; else val1=0;
- }else
+ }
+ else
{
if(findRowColumn(calculateVariable(getParameter(parameters, 0, TRUE, function)), &row,&col, FALSE))
@@ -1019,5 +1061,6 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
val1=text(row,col).toDouble(&ok);
if(ok) val1=1; else val1=0;
- }else
+ }
+ else
{
val1=0;
@@ -1390,5 +1433,6 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
s1=calculateVariable(getParameter(parameters, 1, TRUE, function));
return QString(s1);
- }else
+ }
+ else
{
s1=calculateVariable(getParameter(parameters, 2, TRUE, function));
@@ -1553,5 +1597,6 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
{
return QString::number(GammaQ(floor(val1)+1, val2));
- }else
+ }
+ else
{
return QString::number(exp(-val2)*pow(val2,val1)/exp(GammaLn(val1+1.0)));
@@ -1567,5 +1612,6 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
{
return QString::number(GammaP(val2/2.0,val1*val1/2.0));
- } else
+ }
+ else
{
return QString::number(
@@ -1583,5 +1629,6 @@ QString Sheet::calculateFunction(const QString &func, const QString &parameters,
{
return QString::number(GammaP(val2/2.0,val1/2.0));
- } else
+ }
+ else
{
return QString::number(
@@ -2386,5 +2433,6 @@ void Expression::GetNext()
}//while
}//else if
-};//end function
+}
+;//end function