/usr/include/analitza/operator.h is in libanalitza5-dev 4:4.14.3-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /*************************************************************************************
* Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org> *
* *
* 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 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 General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
*************************************************************************************/
#ifndef OPERATOR_H
#define OPERATOR_H
#include "object.h"
#include "analitzaexport.h"
namespace Analitza
{
/**
* \class Operator
*
* \ingroup AnalitzaModule
*
* \brief Is the operator representation in the trees.
*/
class ANALITZA_EXPORT Operator : public Object
{
public:
/** Specifies the type of an operator */
enum OperatorType {
none=0,
plus, times, minus, divide, quotient,
power, root, factorial,
_and, _or, _xor, _not,
gcd, lcm, rem, factorof,
max, min,
lt, gt, eq, neq, leq, geq, implies,
approx, abs, floor, ceiling,
sin, cos, tan,
sec, csc, cot,
sinh, cosh, tanh,
sech, csch, coth,
arcsin, arccos, arctan,
arccot,// arccoth,
arccosh, arccsc, arccsch,
arcsec, arcsech, arcsinh, arctanh,
exp, ln, log,
// conjugate, arg, real, imaginary,
sum, product, diff,
card, scalarproduct, selector, _union,
forall, exists,
map, filter,
transpose,
function, nOfOps
};
/** Constructor. Creates an operator with @p t type .*/
explicit Operator(OperatorType t) : Object(oper), m_optype(t) {}
/** Destructor */
virtual ~Operator() {}
/** Sets an operator type to the object */
void setOperator(OperatorType t) { m_optype=t; }
/** Returns the number of params expected for the operator type. */
int nparams() const { return nparams(m_optype); }
/** Returns the operator type. */
OperatorType operatorType() const { return m_optype; }
/** Returns the string expression representation of the operator. */
QString name() const;
/** Returns whether @p o is equal to this operator. */
bool operator==(const Operator& o) const { return m_optype==o.m_optype; }
/** Returns whether @p o is equal to this operator. */
bool operator==(OperatorType o) const { return m_optype==o; }
/** Returns whether @p o is different to this operator. */
bool operator!=(OperatorType o) const { return m_optype!=o; }
/** Returns whether @p o is different to this operator. */
bool operator!=(const Operator& o) const { return m_optype!=o.m_optype; }
/** Makes this operator equal to @p a. */
Operator operator=(const Operator &a) { m_optype=a.operatorType(); return *this;}
/** Returns the multiplicity operator. e.g. 5+5+5+5=5*4 -> times is the multiplicityOperator of plus. */
OperatorType multiplicityOperator() const { return multiplicityOperator(m_optype); }
/** Returns if it is a trigonometric operator. */
bool isTrigonometric() const { return isTrigonometric(m_optype); }
/** Returns whether this operator needs bounding. */
bool isBounded() const;
/** Returns whether it is a correct object. */
bool isCorrect() const { return m_type==Object::oper && m_optype!=Operator::none;}
Operator inverse() const;
/** Returns the multiplicity operator of an operator @p t. e.g. 5+5+5+5=5*4 -> times is the multiplicityOperator of plus. */
static OperatorType multiplicityOperator(const OperatorType& t);
/** Converts a @p s operator tag to the operator. */
static OperatorType toOperatorType(const QString &s);
virtual bool matches(const Object*, QMap<QString, const Object*>*) const;
virtual bool decorate(const QMap< QString, Object** >& ) { return false; }
virtual QVariant accept(AbstractExpressionVisitor*) const;
virtual Operator* copy() const;
static const char words[nOfOps][14];
private:
/** Returns if it is a trigonometric operator. */
static bool isTrigonometric(OperatorType o);
/** Returns the expected number of parameters of a type. If there can be multiple parameters, -1 is returned */
static int nparams(OperatorType o);
OperatorType m_optype;
};
}
#endif
|