USGS

Isis 3.0 Object Programmers' Reference

Home

Isis::CubeInfixToPostfix Class Reference
[Math]

Converter for math equations. More...

#include <CubeInfixToPostfix.h>

Inheritance diagram for Isis::CubeInfixToPostfix:
Inheritance graph
[legend]
Collaboration diagram for Isis::CubeInfixToPostfix:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CubeInfixToPostfix ()
 Constructs a CubeInfixToPostfix converter.
QString convert (const QString &infix)
 This method converts infix to postfix.
QString tokenizeEquation (const QString &equation)
 This method will add spaces between all operators and numbers, making it possible to get each element of the equation one by one.

Protected Member Functions

bool isKnownSymbol (QString representation)
 This method will return true if it believes the argument represents a valid function or operator.
InfixOperatorfindOperator (QString representation)
 This method will return a pointer to the operator represented by 'representation.

Protected Attributes

QList< InfixOperator * > p_operators

Private Member Functions

void initialize ()
 This method is used to create functions that are specific to cubes.

Detailed Description

Converter for math equations.

This class converts infix equations to postfix

Author:
2007-08-21 Steven Lambright

For internal use only.

History:
2010-02-23 Steven Lambright Updated to use InfixOperator class method instead of direct access to member
History:
2012-02-02 Jeff Anderson - Added the Initialize method and camera variables (phase, incidence, etc) for a cube
History:
2012-02-09 Jeff Anderson - Modified to conform to ISIS programming standards

Definition at line 52 of file CubeInfixToPostfix.h.


Constructor & Destructor Documentation

Isis::CubeInfixToPostfix::CubeInfixToPostfix (  ) 

Constructs a CubeInfixToPostfix converter.

Author:
janderson (2/2/2012)

Definition at line 34 of file CubeInfixToPostfix.cpp.

References initialize().


Member Function Documentation

QString Isis::InfixToPostfix::convert ( const QString &  infix  )  [inherited]

This method converts infix to postfix.

It uses an enhanced verion of the algorithm found on page 159 of "Data Structures & Algorithms in Java" Second Edition by Robert Lafore. First, we prep the equation with TokenizeEquation and then parse through it using the known-good algorithm.

Parameters:
infix The infix equation
Returns:
IString The postfix equation

Definition at line 154 of file InfixToPostfix.cpp.

References _FILEINFO_, Isis::InfixToPostfix::addOperator(), Isis::InfixToPostfix::cleanSpaces(), Isis::InfixToPostfix::closeParenthesis(), Isis::InfixToPostfix::findOperator(), Isis::InfixToPostfix::isFunction(), Isis::InfixToPostfix::isKnownSymbol(), Isis::IString::Remove(), Isis::toDouble(), Isis::IString::Token(), Isis::InfixToPostfix::tokenizeEquation(), Isis::IString::ToQt(), and Isis::IException::User.

InfixOperator * Isis::CubeInfixToPostfix::findOperator ( QString  representation  )  [protected, virtual]

This method will return a pointer to the operator represented by 'representation.

' Because in this model a function is an operator, this will return a pointer to functions as well (in a base class pointer).

Parameters:
representation The symbolic representation of the operator, such as '+'
Returns:
InfixOperator* A pointer to the operator object that contains known information about the operator

Reimplemented from Isis::InfixToPostfix.

Definition at line 99 of file CubeInfixToPostfix.cpp.

References _FILEINFO_, Isis::InfixToPostfix::isFunction(), and Isis::IException::User.

void Isis::CubeInfixToPostfix::initialize (  )  [private]

This method is used to create functions that are specific to cubes.

Moved the cubemin and cubemax functions out of the InfixToPostfix initialization method into this method

Author:
janderson (2/2/2012)

Reimplemented from Isis::InfixToPostfix.

Definition at line 45 of file CubeInfixToPostfix.cpp.

Referenced by CubeInfixToPostfix().

bool Isis::CubeInfixToPostfix::isKnownSymbol ( QString  representation  )  [protected, virtual]

This method will return true if it believes the argument represents a valid function or operator.

Parameters:
representation The symbolic representation of the operator, such as 'sin'
Returns:
bool True if it looks valid, false if it's not known

Reimplemented from Isis::InfixToPostfix.

Definition at line 79 of file CubeInfixToPostfix.cpp.

References Isis::InfixToPostfix::isFunction().

QString Isis::InfixToPostfix::tokenizeEquation ( const QString &  equation  )  [inherited]

This method will add spaces between all operators and numbers, making it possible to get each element of the equation one by one.

It will also parse out the function calls, adding parenthesis where needed so the user doesn't have to. The result is an equation ready for parsing (but NOT fully parenthesized, just enough to make sure our algorithm makes no mistakes).

Parameters:
equation An unformatted infix equation
Returns:
IString A tokenized equation with additional parentheses

Definition at line 384 of file InfixToPostfix.cpp.

References Isis::InfixToPostfix::cleanSpaces(), Isis::IString::DownCase(), Isis::InfixToPostfix::formatFunctionCalls(), and Isis::IString::ToQt().

Referenced by Isis::InfixToPostfix::convert().


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