Milo  0.1
Milo:EquationManipulationProgram
Static Public Member Functions | Static Public Attributes | Static Private Member Functions | List of all members
Divide Class Reference

#include <nodes.h>

Inheritance diagram for Divide:
Inheritance graph
[legend]
Collaboration diagram for Divide:
Collaboration graph
[legend]

Public Member Functions

Constructor and Virtual Destructor
 Divide (Node *one, Node *two, Node *parent, bool neg=false, Node::Select s=Node::Select::NONE)
 
 Divide (EqnXMLParser &in, Node *parent)
 
 ~Divide ()
 
Virtual Public Member Functions
const std::string & getName () const
 
std::type_index getType () const
 
void normalize ()
 
bool simplify ()
 
- Public Member Functions inherited from Binary
ExpressionPtr getFirstExpression ()
 
ExpressionPtr getSecondExpression ()
 
 Binary (char op, Node *one, Node *two, Node *parent, bool neg, Node::Select s)
 
 Binary (EqnXMLParser &in, Node *parent)
 
virtual ~Binary ()
 
std::string toString () const
 
bool isLeaf () const
 
Node * findNode (int x, int y)
 
Node * findNode (const Box &b)
 
int numFactors () const
 
- Public Member Functions inherited from Node
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 ()
 
 Node (Node *parent=nullptr, bool fNeg=false, Select s=NONE)
 
 Node (EqnXMLParser &in, Node *parent)
 
virtual ~Node ()
 Abstract base class needs virtual desctructor.
 
virtual bool isFactor () const
 
virtual bool less (NodePtr b) const
 

Static Public Member Functions

static bool create (Equation &eqn)
 
- Static Public Member Functions inherited from Binary
static Node * parse (Parser &p, Node *one, Node *parent)
 
- Static Public Member Functions inherited from Node
static bool createNodeByName (std::string name, Equation &eqn)
 

Static Public Attributes

static const std::string name = "divide"
 Name of Divide class.
 
static const std::type_index type = typeid(Divide)
 Type of Divide class.
 
- Static Public Attributes inherited from Node
static const std::vector< std::string > select_tags = { "NONE", "START", "END", "ALL" }
 

Private Member Functions

Virtual Private Member Functions
Frame calcSize (UI::Graphics &gc)
 
void calcOrig (UI::Graphics &gc, int x, int y)
 
void drawNode (UI::Graphics &gc) const
 
Complex getNodeValue () const
 

Static Private Member Functions

static Node * normalize (Node *n)
 

Additional Inherited Members

- Public Types inherited from Node
enum  Select { NONE, START, END, ALL }
 
- Protected Attributes inherited from Binary
char m_op
 Character repesentation of operator.
 
NodePtr m_first
 First expression owned by this object.
 
NodePtr m_second
 Second expression owned by this object.
 
Box m_internal
 Bounding box of this node.
 

Detailed Description

Represents the division operator. Inherits from Binary class and is drawn with two expressions separated by a horizontal line.

Constructor & Destructor Documentation

Divide::Divide ( Node *  one,
Node *  two,
Node *  parent,
bool  neg = false,
Node::Select  s = Node::Select::NONE 
)
inline

Constructor for Divide class.

Parameters
oneFirst expression.
twoSecond expression.
parentParent node.
negIf true, node is negative.
sSelection state of node.
Divide::Divide ( EqnXMLParser &  in,
Node *  parent 
)
inline

XML constructor for Divide class. Read in XML for Divide class.

Parameters
inXML input stream.
parentParent node object.
Divide::~Divide ( )
inline

Abstract base class needs virtual destructor.

Member Function Documentation

void Divide::calcOrig ( UI::Graphics &  gc,
int  x,
int  y 
)
privatevirtual

Calculate origin of this node offset from the point (x,y) given it.

Parameters
gcGraphics context.
xHorizontal origin.
yVertical origin.

Implements Node.

Node::Frame Divide::calcSize ( UI::Graphics &  gc)
privatevirtual

Calculate size of this node in given graphics context.

Parameters
gcGraphics context.
Returns
Return frame containing size of this node.

Implements Node.

bool Divide::create ( Equation &  eqn)
static

Static helper function to create new Divide node object. Create a new divide node object at the eqn's current input.

Parameters
eqnEquation to create new divide object.
Returns
bool True, if divide object created.
void Divide::drawNode ( UI::Graphics &  gc) const
privatevirtual

Draw this node in the given graphical context.

Parameters
gcGraphical context.

Implements Node.

const std::string& Divide::getName ( ) const
inlinevirtual

Get name of this class.

Returns
Name of this class.

Implements Node.

Complex Divide::getNodeValue ( ) const
privatevirtual

Get value of this subtree.

Returns
Complex value of this subtree.

Implements Node.

std::type_index Divide::getType ( ) const
inlinevirtual

Get name of this class.

Returns
Name of this class.

Implements Node.

void Divide::normalize ( )
virtual

Refactor subtree to a standard form. For Divide class, replace a/b with ab^-1.

Reimplemented from Node.

Node * Divide::normalize ( Node *  n)
staticprivate

Static Helper function for Divide::normalize()

Parameters
nNode* containing a/b
Returns
Return expressoin ab^-1
bool Divide::simplify ( )
virtual

Attempt to algebraically simplify the subtree this node is the root.

Returns
True, if subtree was changed.

Reimplemented from Node.


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