Numworks Epsilon  1.4.1
Graphing Calculator Operating System
Poincare::Expression Class Referenceabstract

#include <expression.h>

Inheritance diagram for Poincare::Expression:
Poincare::DynamicHierarchy Poincare::StaticHierarchy< T > Poincare::StaticHierarchy< 0 > Poincare::StaticHierarchy< 1 > Poincare::StaticHierarchy< 2 > Poincare::StaticHierarchy< 3 > Poincare::Addition Poincare::Matrix Poincare::Multiplication Poincare::BoundedStaticHierarchy< 2 > Poincare::BoundedStaticHierarchy< T > Poincare::Complex< double > Poincare::Complex< T > Poincare::Decimal Poincare::Random Poincare::Rational Poincare::Symbol Poincare::Undefined Poincare::AbsoluteValue Poincare::ArcCosine Poincare::ArcSine Poincare::ArcTangent Poincare::Ceiling Poincare::ComplexArgument Poincare::Conjugate Poincare::Determinant Poincare::Factor Poincare::Factorial Poincare::Floor Poincare::FracPart Poincare::HyperbolicArcCosine Poincare::HyperbolicArcSine Poincare::HyperbolicArcTangent Poincare::HyperbolicCosine Poincare::HyperbolicSine Poincare::HyperbolicTangent Poincare::ImaginaryPart Poincare::MatrixDimension Poincare::MatrixInverse Poincare::MatrixTrace Poincare::MatrixTranspose Poincare::NaperianLogarithm Poincare::Opposite Poincare::Parenthesis Poincare::RealPart Poincare::SimplificationRoot Poincare::Sine Poincare::SquareRoot Poincare::Tangent Poincare::BinomialCoefficient Poincare::ConfidenceInterval Poincare::Derivative Poincare::Division Poincare::DivisionQuotient Poincare::DivisionRemainder Poincare::GreatCommonDivisor Poincare::LeastCommonMultiple Poincare::NthRoot Poincare::PermuteCoefficient Poincare::Power Poincare::PredictionInterval Poincare::Randint Poincare::Round Poincare::Store Poincare::Subtraction Poincare::Integral Poincare::Sequence

Public Types

enum  Type : uint8_t {
  Type::Undefined = 0, Type::Rational = 1, Type::Decimal, Type::Multiplication,
  Type::Power, Type::Addition, Type::Factorial, Type::Division,
  Type::Store, Type::Sine, Type::Cosine, Type::Tangent,
  Type::AbsoluteValue, Type::ArcCosine, Type::ArcSine, Type::ArcTangent,
  Type::BinomialCoefficient, Type::Ceiling, Type::ComplexArgument, Type::Conjugate,
  Type::Derivative, Type::Determinant, Type::DivisionQuotient, Type::DivisionRemainder,
  Type::Factor, Type::Floor, Type::FracPart, Type::GreatCommonDivisor,
  Type::HyperbolicArcCosine, Type::HyperbolicArcSine, Type::HyperbolicArcTangent, Type::HyperbolicCosine,
  Type::HyperbolicSine, Type::HyperbolicTangent, Type::ImaginaryPart, Type::Integral,
  Type::LeastCommonMultiple, Type::Logarithm, Type::MatrixTrace, Type::NaperianLogarithm,
  Type::NthRoot, Type::Opposite, Type::Parenthesis, Type::PermuteCoefficient,
  Type::Product, Type::Random, Type::Randint, Type::RealPart,
  Type::Round, Type::SquareRoot, Type::Subtraction, Type::Sum,
  Type::Symbol, Type::Complex, Type::Matrix, Type::ConfidenceInterval,
  Type::MatrixDimension, Type::MatrixInverse, Type::MatrixTranspose, Type::PredictionInterval,
  Type::SimplificationRoot
}
 
enum  ComplexFormat { ComplexFormat::Cartesian = 0, ComplexFormat::Polar = 1, ComplexFormat::Default = 2 }
 
enum  AngleUnit { AngleUnit::Degree = 0, AngleUnit::Radian = 1, AngleUnit::Default = 2 }
 
enum  Sign { Sign::Negative = -1, Sign::Unknown = 0, Sign::Positive = 1 }
 
typedef bool(* CircuitBreaker) ()
 
typedef bool(* ExpressionTest) (const Expression *e, Context &context)
 

Public Member Functions

virtual ~Expression ()=default
 
virtual Expressionclone () const =0
 
virtual Type type () const =0
 
virtual const Expression *const * operands () const =0
 
const Expressionoperand (int i) const
 
ExpressioneditableOperand (int i)
 
virtual int numberOfOperands () const =0
 
ExpressionreplaceWith (Expression *newOperand, bool deleteAfterReplace=true)
 
void replaceOperand (const Expression *oldOperand, Expression *newOperand, bool deleteOldOperand=true)
 
void detachOperand (const Expression *e)
 
void detachOperands ()
 
void swapOperands (int i, int j)
 
Expressionparent () const
 
void setParent (Expression *parent)
 
bool hasAncestor (const Expression *e) const
 
virtual Sign sign () const
 
bool recursivelyMatches (ExpressionTest test, Context &context) const
 
bool isApproximate (Context &context) const
 
virtual float characteristicXRange (Context &context, AngleUnit angleUnit=AngleUnit::Default) const
 
virtual int polynomialDegree (char symbolName) const
 
bool isIdenticalTo (const Expression *e) const
 
ExpressionLayoutcreateLayout (PrintFloat::Mode floatDisplayMode=PrintFloat::Mode::Default, ComplexFormat complexFormat=ComplexFormat::Default) const
 
virtual int writeTextInBuffer (char *buffer, int bufferSize, int numberOfSignificantDigits=PrintFloat::k_numberOfStoredSignificantDigits) const =0
 
template<typename T >
Expressionapproximate (Context &context, AngleUnit angleUnit=AngleUnit::Default) const
 
template<typename T >
T approximateToScalar (Context &context, AngleUnit angleUnit=AngleUnit::Default) const
 

Static Public Member Functions

static Expressionparse (char const *string)
 
static void ReplaceSymbolWithExpression (Expression **expressionAddress, char symbol, Expression *expression)
 
static void setCircuitBreaker (CircuitBreaker cb)
 
static bool shouldStopProcessing ()
 
static bool IsMatrix (const Expression *e, Context &context)
 
static ExpressionParseAndSimplify (const char *text, Context &context, AngleUnit angleUnit=AngleUnit::Default)
 
static void Simplify (Expression **expressionAddress, Context &context, AngleUnit angleUnit=AngleUnit::Default)
 
template<typename T >
static T approximateToScalar (const char *text, Context &context, AngleUnit angleUnit=AngleUnit::Default)
 

Protected Types

typedef float SinglePrecision
 
typedef double DoublePrecision
 

Protected Member Functions

 Expression ()
 
void detachOperandAtIndex (int i)
 

Static Protected Member Functions

template<typename T >
static T epsilon ()
 
static int SimplificationOrder (const Expression *e1, const Expression *e2, bool canBeInterrupted=false)
 

Static Protected Attributes

static constexpr int k_maxNumberOfSteps = 10000
 

Friends

class Undefined
 
class Rational
 
class Decimal
 
class Multiplication
 
class Power
 
class Addition
 
class Factorial
 
class Factor
 
class Division
 
class Store
 
class Sine
 
class Cosine
 
class Tangent
 
class AbsoluteValue
 
class ArcCosine
 
class ArcSine
 
class ArcTangent
 
class BinomialCoefficient
 
class Ceiling
 
class ComplexArgument
 
class ConfidenceInterval
 
class Conjugate
 
class Derivative
 
class Determinant
 
class DivisionQuotient
 
class DivisionRemainder
 
class Floor
 
class FracPart
 
class GreatCommonDivisor
 
class HyperbolicArcCosine
 
class HyperbolicArcSine
 
class HyperbolicArcTangent
 
class HyperbolicCosine
 
class HyperbolicSine
 
class HyperbolicTangent
 
class ImaginaryPart
 
class Integral
 
class LeastCommonMultiple
 
class Logarithm
 
class MatrixDimension
 
class MatrixInverse
 
class MatrixTrace
 
class MatrixTranspose
 
class NaperianLogarithm
 
class NthRoot
 
class Opposite
 
class Parenthesis
 
class PermuteCoefficient
 
class PredictionInterval
 
class Product
 
class RealPart
 
class Round
 
class SquareRoot
 
class Subtraction
 
class Sum
 
class Symbol
 
class Matrix
 
class SimplificationRoot
 
class Sequence
 
class Trigonometry
 
class ApproximationEngine
 
class SimplificationEngine
 
class LayoutEngine
 
class Complex< float >
 
class Complex< double >
 

Detailed Description

Definition at line 16 of file expression.h.

Member Typedef Documentation

◆ CircuitBreaker

typedef bool(* Poincare::Expression::CircuitBreaker) ()

Definition at line 169 of file expression.h.

◆ DoublePrecision

typedef double Poincare::Expression::DoublePrecision
protected

Definition at line 246 of file expression.h.

◆ ExpressionTest

typedef bool(* Poincare::Expression::ExpressionTest) (const Expression *e, Context &context)

Definition at line 196 of file expression.h.

◆ SinglePrecision

typedef float Poincare::Expression::SinglePrecision
protected

Definition at line 245 of file expression.h.

Member Enumeration Documentation

◆ AngleUnit

Enumerator
Degree 
Radian 
Default 

Definition at line 153 of file expression.h.

◆ ComplexFormat

Enumerator
Cartesian 
Polar 
Default 

Definition at line 148 of file expression.h.

◆ Sign

Enumerator
Negative 
Unknown 
Positive 

Definition at line 190 of file expression.h.

◆ Type

Enumerator
Undefined 
Rational 
Decimal 
Multiplication 
Power 
Addition 
Factorial 
Division 
Store 
Sine 
Cosine 
Tangent 
AbsoluteValue 
ArcCosine 
ArcSine 
ArcTangent 
BinomialCoefficient 
Ceiling 
ComplexArgument 
Conjugate 
Derivative 
Determinant 
DivisionQuotient 
DivisionRemainder 
Factor 
Floor 
FracPart 
GreatCommonDivisor 
HyperbolicArcCosine 
HyperbolicArcSine 
HyperbolicArcTangent 
HyperbolicCosine 
HyperbolicSine 
HyperbolicTangent 
ImaginaryPart 
Integral 
LeastCommonMultiple 
Logarithm 
MatrixTrace 
NaperianLogarithm 
NthRoot 
Opposite 
Parenthesis 
PermuteCoefficient 
Product 
Random 
Randint 
RealPart 
Round 
SquareRoot 
Subtraction 
Sum 
Symbol 
Complex 
Matrix 
ConfidenceInterval 
MatrixDimension 
MatrixInverse 
MatrixTranspose 
PredictionInterval 
SimplificationRoot 

Definition at line 84 of file expression.h.

Constructor & Destructor Documentation

◆ ~Expression()

virtual Poincare::Expression::~Expression ( )
virtualdefault

◆ Expression()

Poincare::Expression::Expression ( )
inlineprotected

Definition at line 241 of file expression.h.

Member Function Documentation

◆ approximate()

template<typename T >
template Poincare::Expression * Poincare::Expression::approximate< float > ( Context context,
AngleUnit  angleUnit = AngleUnit::Default 
) const

Definition at line 338 of file expression.cpp.

◆ approximateToScalar() [1/2]

template<typename T >
T Poincare::Expression::approximateToScalar ( Context context,
AngleUnit  angleUnit = AngleUnit::Default 
) const

Definition at line 347 of file expression.cpp.

◆ approximateToScalar() [2/2]

template<typename T >
T Poincare::Expression::approximateToScalar ( const char *  text,
Context context,
AngleUnit  angleUnit = AngleUnit::Default 
)
static

Definition at line 363 of file expression.cpp.

◆ characteristicXRange()

float Poincare::Expression::characteristicXRange ( Context context,
AngleUnit  angleUnit = AngleUnit::Default 
) const
virtual

Reimplemented in Poincare::Symbol, and Poincare::Tangent.

Definition at line 179 of file expression.cpp.

◆ clone()

virtual Expression* Poincare::Expression::clone ( ) const
pure virtual

◆ createLayout()

ExpressionLayout * Poincare::Expression::createLayout ( PrintFloat::Mode  floatDisplayMode = PrintFloat::Mode::Default,
ComplexFormat  complexFormat = ComplexFormat::Default 
) const

Definition at line 244 of file expression.cpp.

◆ detachOperand()

void Poincare::Expression::detachOperand ( const Expression e)

Definition at line 115 of file expression.cpp.

◆ detachOperandAtIndex()

void Poincare::Expression::detachOperandAtIndex ( int  i)
protected

Definition at line 130 of file expression.cpp.

◆ detachOperands()

void Poincare::Expression::detachOperands ( )

Definition at line 124 of file expression.cpp.

◆ editableOperand()

Expression* Poincare::Expression::editableOperand ( int  i)
inline

Definition at line 176 of file expression.h.

◆ epsilon()

template<typename T >
template float Poincare::Expression::epsilon< float > ( )
staticprotected

Definition at line 370 of file expression.cpp.

◆ hasAncestor()

bool Poincare::Expression::hasAncestor ( const Expression e) const

Definition at line 148 of file expression.cpp.

◆ isApproximate()

bool Poincare::Expression::isApproximate ( Context context) const

Definition at line 173 of file expression.cpp.

◆ isIdenticalTo()

bool Poincare::Expression::isIdenticalTo ( const Expression e) const
inline

Definition at line 219 of file expression.h.

◆ IsMatrix()

bool Poincare::Expression::IsMatrix ( const Expression e,
Context context 
)
static

Definition at line 198 of file expression.cpp.

◆ numberOfOperands()

◆ operand()

const Expression * Poincare::Expression::operand ( int  i) const

Definition at line 78 of file expression.cpp.

◆ operands()

◆ parent()

Expression* Poincare::Expression::parent ( ) const
inline

Definition at line 185 of file expression.h.

◆ parse()

Expression * Poincare::Expression::parse ( char const *  string)
static

Definition at line 25 of file expression.cpp.

◆ ParseAndSimplify()

Expression * Poincare::Expression::ParseAndSimplify ( const char *  text,
Context context,
AngleUnit  angleUnit = AngleUnit::Default 
)
static

Definition at line 265 of file expression.cpp.

◆ polynomialDegree()

◆ recursivelyMatches()

bool Poincare::Expression::recursivelyMatches ( ExpressionTest  test,
Context context 
) const

Definition at line 161 of file expression.cpp.

◆ replaceOperand()

void Poincare::Expression::replaceOperand ( const Expression oldOperand,
Expression newOperand,
bool  deleteOldOperand = true 
)

Definition at line 91 of file expression.cpp.

◆ ReplaceSymbolWithExpression()

void Poincare::Expression::ReplaceSymbolWithExpression ( Expression **  expressionAddress,
char  symbol,
Expression expression 
)
static

Definition at line 43 of file expression.cpp.

◆ replaceWith()

Expression * Poincare::Expression::replaceWith ( Expression newOperand,
bool  deleteAfterReplace = true 
)

Definition at line 85 of file expression.cpp.

◆ setCircuitBreaker()

void Poincare::Expression::setCircuitBreaker ( CircuitBreaker  cb)
static

Definition at line 61 of file expression.cpp.

◆ setParent()

void Poincare::Expression::setParent ( Expression parent)
inline

Definition at line 186 of file expression.h.

◆ shouldStopProcessing()

bool Poincare::Expression::shouldStopProcessing ( )
static

Definition at line 65 of file expression.cpp.

◆ sign()

virtual Sign Poincare::Expression::sign ( ) const
inlinevirtual

◆ SimplificationOrder()

int Poincare::Expression::SimplificationOrder ( const Expression e1,
const Expression e2,
bool  canBeInterrupted = false 
)
staticprotected

Definition at line 226 of file expression.cpp.

◆ Simplify()

void Poincare::Expression::Simplify ( Expression **  expressionAddress,
Context context,
AngleUnit  angleUnit = AngleUnit::Default 
)
static

Definition at line 277 of file expression.cpp.

◆ swapOperands()

void Poincare::Expression::swapOperands ( int  i,
int  j 
)

Definition at line 139 of file expression.cpp.

◆ type()

◆ writeTextInBuffer()

virtual int Poincare::Expression::writeTextInBuffer ( char *  buffer,
int  bufferSize,
int  numberOfSignificantDigits = PrintFloat::k_numberOfStoredSignificantDigits 
) const
pure virtual

Friends And Related Function Documentation

◆ AbsoluteValue

friend class AbsoluteValue
friend

Definition at line 30 of file expression.h.

◆ Addition

friend class Addition
friend

Definition at line 22 of file expression.h.

◆ ApproximationEngine

friend class ApproximationEngine
friend

Definition at line 77 of file expression.h.

◆ ArcCosine

friend class ArcCosine
friend

Definition at line 31 of file expression.h.

◆ ArcSine

friend class ArcSine
friend

Definition at line 32 of file expression.h.

◆ ArcTangent

friend class ArcTangent
friend

Definition at line 33 of file expression.h.

◆ BinomialCoefficient

friend class BinomialCoefficient
friend

Definition at line 34 of file expression.h.

◆ Ceiling

friend class Ceiling
friend

Definition at line 35 of file expression.h.

◆ Complex< double >

friend class Complex< double >
friend

Definition at line 81 of file expression.h.

◆ Complex< float >

friend class Complex< float >
friend

Definition at line 80 of file expression.h.

◆ ComplexArgument

friend class ComplexArgument
friend

Definition at line 36 of file expression.h.

◆ ConfidenceInterval

friend class ConfidenceInterval
friend

Definition at line 37 of file expression.h.

◆ Conjugate

friend class Conjugate
friend

Definition at line 38 of file expression.h.

◆ Cosine

friend class Cosine
friend

Definition at line 28 of file expression.h.

◆ Decimal

friend class Decimal
friend

Definition at line 19 of file expression.h.

◆ Derivative

friend class Derivative
friend

Definition at line 39 of file expression.h.

◆ Determinant

friend class Determinant
friend

Definition at line 40 of file expression.h.

◆ Division

friend class Division
friend

Definition at line 25 of file expression.h.

◆ DivisionQuotient

friend class DivisionQuotient
friend

Definition at line 41 of file expression.h.

◆ DivisionRemainder

friend class DivisionRemainder
friend

Definition at line 42 of file expression.h.

◆ Factor

friend class Factor
friend

Definition at line 24 of file expression.h.

◆ Factorial

friend class Factorial
friend

Definition at line 23 of file expression.h.

◆ Floor

friend class Floor
friend

Definition at line 43 of file expression.h.

◆ FracPart

friend class FracPart
friend

Definition at line 44 of file expression.h.

◆ GreatCommonDivisor

friend class GreatCommonDivisor
friend

Definition at line 45 of file expression.h.

◆ HyperbolicArcCosine

friend class HyperbolicArcCosine
friend

Definition at line 46 of file expression.h.

◆ HyperbolicArcSine

friend class HyperbolicArcSine
friend

Definition at line 47 of file expression.h.

◆ HyperbolicArcTangent

friend class HyperbolicArcTangent
friend

Definition at line 48 of file expression.h.

◆ HyperbolicCosine

friend class HyperbolicCosine
friend

Definition at line 49 of file expression.h.

◆ HyperbolicSine

friend class HyperbolicSine
friend

Definition at line 50 of file expression.h.

◆ HyperbolicTangent

friend class HyperbolicTangent
friend

Definition at line 51 of file expression.h.

◆ ImaginaryPart

friend class ImaginaryPart
friend

Definition at line 52 of file expression.h.

◆ Integral

friend class Integral
friend

Definition at line 53 of file expression.h.

◆ LayoutEngine

friend class LayoutEngine
friend

Definition at line 79 of file expression.h.

◆ LeastCommonMultiple

friend class LeastCommonMultiple
friend

Definition at line 54 of file expression.h.

◆ Logarithm

friend class Logarithm
friend

Definition at line 55 of file expression.h.

◆ Matrix

friend class Matrix
friend

Definition at line 73 of file expression.h.

◆ MatrixDimension

friend class MatrixDimension
friend

Definition at line 56 of file expression.h.

◆ MatrixInverse

friend class MatrixInverse
friend

Definition at line 57 of file expression.h.

◆ MatrixTrace

friend class MatrixTrace
friend

Definition at line 58 of file expression.h.

◆ MatrixTranspose

friend class MatrixTranspose
friend

Definition at line 59 of file expression.h.

◆ Multiplication

friend class Multiplication
friend

Definition at line 20 of file expression.h.

◆ NaperianLogarithm

friend class NaperianLogarithm
friend

Definition at line 60 of file expression.h.

◆ NthRoot

friend class NthRoot
friend

Definition at line 61 of file expression.h.

◆ Opposite

friend class Opposite
friend

Definition at line 62 of file expression.h.

◆ Parenthesis

friend class Parenthesis
friend

Definition at line 63 of file expression.h.

◆ PermuteCoefficient

friend class PermuteCoefficient
friend

Definition at line 64 of file expression.h.

◆ Power

friend class Power
friend

Definition at line 21 of file expression.h.

◆ PredictionInterval

friend class PredictionInterval
friend

Definition at line 65 of file expression.h.

◆ Product

friend class Product
friend

Definition at line 66 of file expression.h.

◆ Rational

friend class Rational
friend

Definition at line 18 of file expression.h.

◆ RealPart

friend class RealPart
friend

Definition at line 67 of file expression.h.

◆ Round

friend class Round
friend

Definition at line 68 of file expression.h.

◆ Sequence

friend class Sequence
friend

Definition at line 75 of file expression.h.

◆ SimplificationEngine

friend class SimplificationEngine
friend

Definition at line 78 of file expression.h.

◆ SimplificationRoot

friend class SimplificationRoot
friend

Definition at line 74 of file expression.h.

◆ Sine

friend class Sine
friend

Definition at line 27 of file expression.h.

◆ SquareRoot

friend class SquareRoot
friend

Definition at line 69 of file expression.h.

◆ Store

friend class Store
friend

Definition at line 26 of file expression.h.

◆ Subtraction

friend class Subtraction
friend

Definition at line 70 of file expression.h.

◆ Sum

friend class Sum
friend

Definition at line 71 of file expression.h.

◆ Symbol

friend class Symbol
friend

Definition at line 72 of file expression.h.

◆ Tangent

friend class Tangent
friend

Definition at line 29 of file expression.h.

◆ Trigonometry

friend class Trigonometry
friend

Definition at line 76 of file expression.h.

◆ Undefined

friend class Undefined
friend

Definition at line 17 of file expression.h.

Member Data Documentation

◆ k_maxNumberOfSteps

constexpr int Poincare::Expression::k_maxNumberOfSteps = 10000
staticprotected

Definition at line 248 of file expression.h.


The documentation for this class was generated from the following files: