|
Milo
0.1
Milo:EquationManipulationProgram
|
#include <milo.h>


Classes | |
| struct | Frame |
Public Types | |
| enum | Select { NONE, START, END, ALL } |
Public Member Functions | |
| void | calculateSize (UI::Graphics &gc) |
| void | out (XML::Stream &xml) |
| void | calculateOrigin (UI::Graphics &gc, int x, int y) |
| void | setUpDraw (UI::Graphics &gc) |
| void | draw (UI::Graphics &gc) const |
| void | setSelect (Select s) |
| Select | getSelect () const |
| void | setDrawParenthesis (bool fDrawPar) |
| bool | getDrawParenthesis () const |
| const Frame & | getFrame () const |
| Node * | first () |
| Node * | last () |
| Node * | getNextLeft () |
| Node * | getNextRight () |
| void | setParent (Node *parent) |
| Node * | getParent () const |
| int | getDepth () const |
| int | getNth () const |
| void | addNth (int n) |
| void | multNth (int n) |
| void | setNth (int n) |
| void | negative () |
| bool | getSign () const |
| Complex | getValue () const |
| std::shared_ptr< Node > | getSharedPtr () |
Constructors and Virtual Destructor | |
| Node (Node *parent=nullptr, bool fNeg=false, Select s=NONE) | |
| Node (EqnXMLParser &in, Node *parent) | |
| virtual | ~Node () |
| Abstract base class needs virtual desctructor. | |
Virtual Public Member Functions | |
| virtual std::string | toString () const =0 |
| virtual bool | isLeaf () const |
| virtual bool | isFactor () const |
| virtual Node * | findNode (int x, int y) |
| virtual Node * | findNode (const Box &b) |
| virtual int | numFactors () const |
| virtual void | normalize () |
| virtual bool | simplify () |
| virtual bool | less (NodePtr b) const |
| virtual const std::string & | getName () const =0 |
| virtual std::type_index | getType () const =0 |
Static Public Member Functions | |
| static bool | createNodeByName (std::string name, Equation &eqn) |
Static Public Attributes | |
| static const std::vector< std::string > | select_tags = { "NONE", "START", "END", "ALL" } |
Private Member Functions | |
| int | getDepth (int depth) const |
Virtual Private Member Functions | |
| virtual Node * | downLeft () |
| virtual Node * | downRight () |
| virtual Node * | getLeftSibling (Node *) |
| virtual Node * | getRightSibling (Node *) |
| virtual Frame | calcSize (UI::Graphics &gc)=0 |
| virtual void | calcOrig (UI::Graphics &gc, int x, int y)=0 |
| virtual void | drawNode (UI::Graphics &gc) const =0 |
| virtual Complex | getNodeValue () const =0 |
| virtual void | xml_out (XML::Stream &xml) const =0 |
Private Attributes | |
| Node * | m_parent |
| Parent node of this node. Can be null if root. | |
| bool | m_sign |
| True if positve. | |
| Select | m_select |
| Select state of this node. | |
| Frame | m_frame |
| Frame of this node includes enclosing rect and vertical offset. | |
| Box | m_parenthesis |
| Rectangle that contains paranthesis of this node. | |
| int | m_nth = 1 |
| Integer power of ths node. | |
| bool | m_fDrawParenthesis = false |
| If true, draw paranthesis around this node. | |
Abstract base class for symbolic classes that make up an equation. Any class that will be part of the equation tree structor derives from this class.
| enum Node::Select |
Possible selection states for a node:
NONE - not selected
START - node starts selection
END - node ends selection
ALL- just this node selected
| Node::Node | ( | EqnXMLParser & | in, |
| Node * | parent | ||
| ) |
|
inline |
Add integer n to power value of this node.
| n | Integet power to be added. |
|
privatepure virtual |
Calculate origin of the nodes in the subtree relative to point x,y.
| gc | Graphics context. |
| x | Horizontal origin. |
| y | Vertical origin. |
Implemented in Input, Differential, Function, Expression, Number, Term, Variable, Constant, Power, and Divide.
|
privatepure virtual |
| void Node::calculateOrigin | ( | UI::Graphics & | gc, |
| int | x, | ||
| int | y | ||
| ) |
Calculate origin of each node in subtree. The size of each node in subtree needs to be precalculated.
| gc | Graphics context to calculate origin. |
| x | Horizontal origin of root node in subtree. |
| y | Vertical origin of root node in subtree. |
| void Node::calculateSize | ( | UI::Graphics & | gc | ) |
Calculate size of node subtree in given graphics context.
| gc | Graphics context used to calculate size. |
|
static |
Create node by its name in the given equation
| name | Name of node to be created. |
| eqn | Equation that has current input to take node |
|
inlineprivatevirtual |
Get left most node of this node's subtree. Default function returns NULL assuming it is leaf node.
Reimplemented in Differential, Function, Expression, Term, and Binary.
|
inlineprivatevirtual |
Get right most node of this node's subtree. Default function returns NULL assuming it is leaf node.
Reimplemented in Differential, Function, Expression, Term, and Binary.
| void Node::draw | ( | UI::Graphics & | gc | ) | const |
Draw equation subtree whose root is this node.
| gc | Graphics context class object. |
|
privatepure virtual |
Draw subtree in this graphics context.
| gc | Graphics context. |
Implemented in Input, Differential, Function, Expression, Number, Term, Variable, Constant, Power, and Divide.
|
virtual |
Virtual recursive function to return deepest node at point (x,y). Leaf nodes will return true or false depending on whether (x,y) is inside their box. Non-leaf nodes will query their children.
| x | horizontal coordinate. |
| y | vertical coordinate. |
Reimplemented in Differential, Function, Expression, Term, and Binary.
Virtual recursive function to return first node from a top to bottom search whose frame is inside Box b.
| b | Bounding box. |
Reimplemented in Differential, Function, Expression, Term, and Binary.
| Node * Node::first | ( | ) |
Get left most node of this node's subtree.
|
inline |
Get depth from root of this node. 0 is root.
|
inlineprivate |
Recursively calculate the depth of this node.
| depth | Current calculated depth. |
|
inline |
Get draw parenthesis flag of this node.
Get left sibiling of node argument. Default function returns NULL assuming this is a leaf node.
Reimplemented in Expression, Term, and Binary.
|
pure virtual |
Get final class name of node class object.
Implemented in Input, Differential, Function, Expression, Number, Variable, Term, Constant, Power, and Divide.
| Node * Node::getNextLeft | ( | ) |
Get next left node, going up if necessary.
| Node * Node::getNextRight | ( | ) |
Get next right node, going up if necessary.
|
privatepure virtual |
Get value of this node's subtree.
Implemented in Input, Differential, Function, Expression, Number, Term, Variable, Constant, Power, and Divide.
|
inline |
Get value of integer power of this node.
|
inline |
Get parent of this node.
Get right sibiling of node argument. Default function returns NULL assuming this is a leaf node.
Reimplemented in Expression, Term, and Binary.
|
inline |
Get selection state of this node.
|
inline |
|
inline |
Get sign of this node.
|
pure virtual |
Get final class type of node class object.
Implemented in Input, Differential, Function, Expression, Number, Variable, Term, Constant, Power, and Divide.
| Complex Node::getValue | ( | ) | const |
Calculate value of this node and it subtree.
|
inlinevirtual |
|
inlinevirtual |
Virtual function to query whether this is a leaf node or subtree. Default function returns true. Override to return false.
Reimplemented in Differential, Function, Expression, Term, and Binary.
| Node * Node::last | ( | ) |
Get right most node of this node's subtree.
|
inlinevirtual |
|
inline |
Multiply integer n to power value of this node.
| n | Integer power to be multiplied. |
|
inline |
Negate this node.
|
inlinevirtual |
Put node's subtree to a standard algebraic form.
Reimplemented in Differential, Function, Expression, Term, Power, and Divide.
|
inlinevirtual |
Virtual function that queries node of number of factor in its subtree. Default function returns 1 which is correct for leaf node. Non-leaf node queries its children.
Reimplemented in Input, Differential, Function, Expression, Term, and Binary.
| void Node::out | ( | XML::Stream & | xml | ) |
|
inline |
Set draw parenthesis flag of this node.
| fDrawPar | If true, draw a parenthesises around node. |
|
inline |
Set integer power value of this node.
| n | Integer power to be set. |
|
inline |
Set parent of this node.
|
inline |
Set selection state of this node.
| s | New selection state of node. |
| void Node::setUpDraw | ( | UI::Graphics & | gc | ) |
Calculate the size and origin of the subtree of this node.
| gc | Graphics context class object. |
|
inlinevirtual |
Simplify node's subtree algebraiclly.
Reimplemented in Differential, Expression, Number, Term, Power, and Divide.
|
pure virtual |
Recursive virtual function to represent this subtree as string.
Implemented in Input, Differential, Function, Expression, Number, Variable, Term, Constant, and Binary.
|
privatepure virtual |
|
static |
List of strings corresponding to enum Select. Use enum State as index into select_tags to get its strings.
1.8.11