• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

Analitza

  • sources
  • kde-4.14
  • kdeedu
  • analitza
  • analitza
operator.h
Go to the documentation of this file.
1 /*************************************************************************************
2  * Copyright (C) 2007 by Aleix Pol <aleixpol@kde.org> *
3  * *
4  * This program is free software; you can redistribute it and/or *
5  * modify it under the terms of the GNU General Public License *
6  * as published by the Free Software Foundation; either version 2 *
7  * of the License, or (at your option) any later version. *
8  * *
9  * This program is distributed in the hope that it will be useful, *
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12  * GNU General Public License for more details. *
13  * *
14  * You should have received a copy of the GNU General Public License *
15  * along with this program; if not, write to the Free Software *
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *
17  *************************************************************************************/
18 
19 #ifndef OPERATOR_H
20 #define OPERATOR_H
21 
22 #include "object.h"
23 #include "analitzaexport.h"
24 
25 namespace Analitza
26 {
27 
36 class ANALITZA_EXPORT Operator : public Object
37 {
38  public:
40  enum OperatorType {
41  none=0,
42  plus, times, minus, divide, quotient,
43  power, root, factorial,
44  _and, _or, _xor, _not,
45  gcd, lcm, rem, factorof,
46  max, min,
47  lt, gt, eq, neq, leq, geq, implies,
48  approx, abs, floor, ceiling,
49  sin, cos, tan,
50  sec, csc, cot,
51  sinh, cosh, tanh,
52  sech, csch, coth,
53  arcsin, arccos, arctan,
54  arccot,// arccoth,
55  arccosh, arccsc, arccsch,
56  arcsec, arcsech, arcsinh, arctanh,
57  exp, ln, log,
58 // conjugate, arg, real, imaginary,
59  sum, product, diff,
60  card, scalarproduct, selector, _union,
61  forall, exists,
62 
63  map, filter,
64 
65  transpose,
66 
67  function, nOfOps
68  };
70  explicit Operator(OperatorType t) : Object(oper), m_optype(t) {}
71 
73  virtual ~Operator() {}
74 
76  void setOperator(OperatorType t) { m_optype=t; }
77 
79  int nparams() const { return nparams(m_optype); }
80 
82  OperatorType operatorType() const { return m_optype; }
83 
85  QString name() const;
86 
88  bool operator==(const Operator& o) const { return m_optype==o.m_optype; }
89 
91  bool operator==(OperatorType o) const { return m_optype==o; }
92 
94  bool operator!=(OperatorType o) const { return m_optype!=o; }
95 
97  bool operator!=(const Operator& o) const { return m_optype!=o.m_optype; }
98 
100  Operator operator=(const Operator &a) { m_optype=a.operatorType(); return *this;}
101 
103  OperatorType multiplicityOperator() const { return multiplicityOperator(m_optype); }
104 
106  bool isTrigonometric() const { return isTrigonometric(m_optype); }
107 
109  bool isBounded() const;
110 
112  bool isCorrect() const { return m_type==Object::oper && m_optype!=Operator::none;}
113 
114  Operator inverse() const;
115 
117  static OperatorType multiplicityOperator(const OperatorType& t);
118 
120  static OperatorType toOperatorType(const QString &s);
121 
122  virtual bool matches(const Object*, QMap<QString, const Object*>*) const;
123  virtual bool decorate(const QMap< QString, Object** >& ) { return false; }
124 
125  virtual QVariant accept(AbstractExpressionVisitor*) const;
126  virtual Operator* copy() const;
127 
128  static const char words[nOfOps][14];
129  private:
131  static bool isTrigonometric(OperatorType o);
132 
134  static int nparams(OperatorType o);
135 
136  OperatorType m_optype;
137 };
138 
139 }
140 
141 #endif
Analitza::Operator::arctanh
Definition: operator.h:56
Analitza::AbstractExpressionVisitor
Definition: abstractexpressionvisitor.h:49
Analitza::Operator::sum
Definition: operator.h:59
Analitza::Operator::root
Definition: operator.h:43
Analitza::Operator::transpose
Definition: operator.h:65
Analitza::Operator::rem
Definition: operator.h:45
Analitza::Operator::floor
Definition: operator.h:48
Analitza::Operator::forall
Definition: operator.h:61
QMap
Analitza::Operator::operator==
bool operator==(OperatorType o) const
Returns whether o is equal to this operator.
Definition: operator.h:91
Analitza::Operator::sec
Definition: operator.h:50
Analitza::Operator::Operator
Operator(OperatorType t)
Constructor.
Definition: operator.h:70
Analitza::Operator::isTrigonometric
bool isTrigonometric() const
Returns if it is a trigonometric operator.
Definition: operator.h:106
Analitza::Operator::isCorrect
bool isCorrect() const
Returns whether it is a correct object.
Definition: operator.h:112
Analitza::Operator
Is the operator representation in the trees.
Definition: operator.h:36
Analitza::Operator::~Operator
virtual ~Operator()
Destructor.
Definition: operator.h:73
Analitza::Operator::operator==
bool operator==(const Operator &o) const
Returns whether o is equal to this operator.
Definition: operator.h:88
Analitza::Operator::arccot
Definition: operator.h:54
Analitza::Operator::min
Definition: operator.h:46
Analitza::Operator::none
Definition: operator.h:41
Analitza::Operator::arctan
Definition: operator.h:53
Analitza::Operator::tan
Definition: operator.h:49
Analitza::Operator::operatorType
OperatorType operatorType() const
Returns the operator type.
Definition: operator.h:82
Analitza::Operator::setOperator
void setOperator(OperatorType t)
Sets an operator type to the object.
Definition: operator.h:76
Analitza::Operator::operator=
Operator operator=(const Operator &a)
Makes this operator equal to a.
Definition: operator.h:100
QString
Analitza::Object::oper
Describes an object as an operator.
Definition: object.h:49
Analitza::Operator::log
Definition: operator.h:57
Analitza::Operator::nparams
int nparams() const
Returns the number of params expected for the operator type.
Definition: operator.h:79
analitzaexport.h
Analitza::Operator::multiplicityOperator
OperatorType multiplicityOperator() const
Returns the multiplicity operator.
Definition: operator.h:103
Analitza::Operator::arccsch
Definition: operator.h:55
Analitza::Object
Definition: object.h:38
object.h
ANALITZA_EXPORT
#define ANALITZA_EXPORT
Definition: analitzaexport.h:31
Analitza::Operator::operator!=
bool operator!=(OperatorType o) const
Returns whether o is different to this operator.
Definition: operator.h:94
Analitza::Operator::_xor
Definition: operator.h:44
Analitza::Operator::selector
Definition: operator.h:60
Analitza::Operator::times
Definition: operator.h:42
Analitza::Operator::decorate
virtual bool decorate(const QMap< QString, Object ** > &)
Definition: operator.h:123
Analitza::Operator::OperatorType
OperatorType
Specifies the type of an operator.
Definition: operator.h:40
Analitza::Operator::tanh
Definition: operator.h:51
Analitza::Operator::operator!=
bool operator!=(const Operator &o) const
Returns whether o is different to this operator.
Definition: operator.h:97
Analitza::Operator::sech
Definition: operator.h:52
Analitza::Operator::neq
Definition: operator.h:47
QVariant
Analitza::Operator::map
Definition: operator.h:63
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:11:37 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

Analitza

Skip menu "Analitza"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal