mirror of
https://github.com/aportelli/LatAnalyze.git
synced 2024-11-10 00:45:36 +00:00
consistent boolean notation
This commit is contained in:
parent
60170db570
commit
9edec3709b
@ -170,7 +170,7 @@ void AsciiFile::open(const string &name, const unsigned int mode)
|
||||
|
||||
std::string AsciiFile::load(const string &name)
|
||||
{
|
||||
if ((mode_ & Mode::read)&&(isOpen()))
|
||||
if ((mode_ & Mode::read) and (isOpen()))
|
||||
{
|
||||
if (!isParsed_)
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ void File::deleteData(void)
|
||||
|
||||
void File::checkWritability(void)
|
||||
{
|
||||
if (!((mode_ & Mode::write)||(mode_ & Mode::append))||!isOpen())
|
||||
if (!((mode_ & Mode::write) or (mode_ & Mode::append)) or !isOpen())
|
||||
{
|
||||
LATAN_ERROR(Io, "file '" + name_ + "' is not writable");
|
||||
}
|
||||
|
@ -183,7 +183,7 @@ DoubleFunction & DoubleFunction::operator op##=(const DoubleFunction &f)\
|
||||
setFunction(res, getNArg());\
|
||||
return *this;\
|
||||
}\
|
||||
DoubleFunction & DoubleFunction::operator op##=(const DoubleFunction &&f)\
|
||||
DoubleFunction & DoubleFunction::operator op##=(const DoubleFunction and f)\
|
||||
{\
|
||||
*this op##= f;\
|
||||
return *this;\
|
||||
|
@ -122,7 +122,7 @@ GslHybridRootFinder::operator()(const vector<DoubleFunction *> &func)
|
||||
break;
|
||||
}
|
||||
status = gsl_multiroot_test_residual(solver_->f, getPrecision());
|
||||
} while ((status == GSL_CONTINUE)&&(iter < getMaxIteration()));
|
||||
} while ((status == GSL_CONTINUE) and (iter < getMaxIteration()));
|
||||
if (verbosity >= Verbosity::Debug)
|
||||
{
|
||||
cout << "--- done" << endl;
|
||||
|
@ -207,14 +207,14 @@ string Hdf5File::getFirstGroupName(void)
|
||||
{
|
||||
string res;
|
||||
|
||||
if ((mode_ & Mode::read)&&(isOpen()))
|
||||
if ((mode_ & Mode::read) and (isOpen()))
|
||||
{
|
||||
auto firstGroupName = [](hid_t loc_id, const char *name, void *fname)
|
||||
{
|
||||
H5G_stat_t statbuf;
|
||||
|
||||
H5Gget_objinfo(loc_id, name, 0, &statbuf);
|
||||
if ((statbuf.type == H5G_GROUP) && (strlen((char *)fname) == 0))
|
||||
if ((statbuf.type == H5G_GROUP) and (strlen((char *)fname) == 0))
|
||||
{
|
||||
strncpy((char *)fname, name, maxGroupNameSize);
|
||||
}
|
||||
@ -268,7 +268,7 @@ void Hdf5File::load(DSample &ds, const DataSet &d)
|
||||
|
||||
string Hdf5File::load(const string &name)
|
||||
{
|
||||
if ((mode_ & Mode::read)&&(isOpen()))
|
||||
if ((mode_ & Mode::read) and (isOpen()))
|
||||
{
|
||||
string groupName;
|
||||
Group group;
|
||||
|
@ -165,7 +165,7 @@ double Histogram::operator()(const double x) const
|
||||
// percentiles & confidence interval ///////////////////////////////////////////
|
||||
double Histogram::percentile(const double p) const
|
||||
{
|
||||
if ((p < 0.0)||(p > 100.0))
|
||||
if ((p < 0.0) or (p > 100.0))
|
||||
{
|
||||
LATAN_ERROR(Range, "percentile (" + strFrom(p) + ")"
|
||||
" is outside the [0, 100] range");
|
||||
|
@ -38,7 +38,7 @@ unique_ptr<File> Io::open(const std::string &fileName, const unsigned int mode)
|
||||
{
|
||||
string ext = extension(fileName);
|
||||
|
||||
if ((ext == "dat")||(ext == "sample")||(ext == "seed"))
|
||||
if ((ext == "dat") or (ext == "sample") or (ext == "seed"))
|
||||
{
|
||||
return unique_ptr<File>(new AsciiFile(fileName, mode));
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ void SemicolonNode::compile(Program &program, RunContext &context) const
|
||||
bool isSemiColumn = isDerivedFrom<SemicolonNode>(&n[i]);
|
||||
bool isKeyword = isDerivedFrom<KeywordNode>(&n[i]);
|
||||
|
||||
if (isAssign||isSemiColumn||isKeyword)
|
||||
if (isAssign or isSemiColumn or isKeyword)
|
||||
{
|
||||
n[i].compile(program, context);
|
||||
}
|
||||
@ -513,7 +513,7 @@ void AssignNode::compile(Program &program, RunContext &context) const
|
||||
}
|
||||
|
||||
// MathOpNode compile //////////////////////////////////////////////////////////
|
||||
#define IFNODE(name, nArg) if ((n.getName() == (name))&&(n.getNArg() == nArg))
|
||||
#define IFNODE(name, nArg) if ((n.getName() == (name)) and (n.getNArg() == nArg))
|
||||
#define ELIFNODE(name, nArg) else IFNODE(name, nArg)
|
||||
#define ELSE else
|
||||
|
||||
@ -703,7 +703,7 @@ void MathInterpreter::compile(RunContext &context)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!root_||!gotReturn)
|
||||
if (!root_ or !gotReturn)
|
||||
{
|
||||
LATAN_ERROR(Syntax, "expected 'return' in program '" + codeName_
|
||||
+ "'");
|
||||
|
@ -458,7 +458,7 @@ void Plot::getProgramPath(void)
|
||||
{
|
||||
for (i=0;path[i];)
|
||||
{
|
||||
for (j=i;(path[j])&&(path[j]!=':');j++);
|
||||
for (j=i;(path[j]) and (path[j]!=':');j++);
|
||||
lg = j - i;
|
||||
strncpy(buf,path + i,(size_t)(lg));
|
||||
if (lg == 0)
|
||||
|
@ -262,7 +262,7 @@ namespace ReducOp
|
||||
inline Mat<double> tensProd(const Mat<double> &v1,
|
||||
const Mat<double> &v2)
|
||||
{
|
||||
if ((v1.cols() != 1)||(v2.cols() != 1))
|
||||
if ((v1.cols() != 1) or (v2.cols() != 1))
|
||||
{
|
||||
LATAN_ERROR(Size,
|
||||
"tensorial product is only valid with column vectors");
|
||||
|
@ -65,7 +65,7 @@ double TabFunction::operator()(const double *arg) const
|
||||
double result = 0.0, x = arg[0];
|
||||
|
||||
|
||||
if ((x < value_.begin()->first) || (x >= value_.rbegin()->first)) {
|
||||
if ((x < value_.begin()->first) or (x >= value_.rbegin()->first)) {
|
||||
LATAN_ERROR(Range, "tabulated function variable out of range "
|
||||
"(x= " + strFrom(x) + " not in ["
|
||||
+ strFrom(value_.begin()->first) + ", "
|
||||
|
@ -24,7 +24,7 @@ using namespace Latan;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
if ((argc < 2) || (argc > 3))
|
||||
if ((argc < 2) or (argc > 3))
|
||||
{
|
||||
cerr << "usage: " << argv[0] << " <file> [<copy>]" << endl;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user