#include <Fraction.h>
Inheritance diagram for mcFractionHelpers:
This is entirely defined & implemented through macros.
Definition at line 55 of file Fraction.h.
Public Member Functions | |
mcFractionHelpers () | |
virtual | ~mcFractionHelpers () |
int | data_GetChildrenCount () const |
Returns the number of children attached to this tree node. | |
const mcElement & | data_GetConstChild (int n) const |
Returns the n-th tree node attached to this element. | |
void | data_SetChild (int n, const mcElement &newchild) |
math_Replaces the idx-th child of this element with a copy of the given one. | |
void | data_DeepCopy (const mcElementHelpers *p) |
Deep copies all the info contained in this class. | |
bool | data_isSameAs (const mcElementHelpers *p) const |
Performs a deep comparison of the data hold by this class and the data hold by the given mcElementHelpers object. | |
void | data_SetDen (const mcPolynomial &p) |
Copies the given polynomial, setting it as the denominator of the fraction. | |
void | data_SetNum (const mcPolynomial &p) |
Copies the given polynomial, setting it as the numerator of the fraction. | |
virtual void | data_AddElements (bool bNum, mcElement *p, int num, int pos=-1, bool bOverwrite=FALSE, bool bForceCopy=FALSE) |
math_Adds the given elements to the numerator/denominator. | |
mcPolynomial & | data_GetNum () |
mcPolynomial & | data_GetDen () |
const mcPolynomial & | data_GetNum () const |
const mcPolynomial & | data_GetDen () const |
void | math_Flip () |
Exchanges the numerator with the denominator. | |
bool | io_isBeginTag (const wxXml2Node &tag) const |
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. | |
bool | io_isBeginChar (const wxString &str) const |
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. | |
void | io_Set (const wxString &num, const wxString &den) |
Imports as inlined expressions the two given strings in the numerator and denominator. | |
void | io_SetNum (const wxString &num) |
void | io_SetDen (const wxString &den) |
wxXml2Node | io_GetMathML (bool bGetPresentation) const |
Returns the MathML code for this element as presentation markup (http://www.w3.org/TR/MathML2/chapter3.html) or as content markup (http://www.w3.org/TR/MathML2/chapter4.html). | |
wxString | io_GetInlinedExpr () const |
Returns the inlined expression for this element as a wxString. | |
bool | io_CheckBracketNeed (const mcPolynomial &p, const wxString &exp) const |
bool | io_ImportPresentationMathML (wxXml2Node tag, wxString &pErr) |
Imports presentation MathML reading the contents of the given XML node (without modifying it). | |
bool | io_ImportInlinedExpr (const wxString &str, int *count, wxString &pErr) |
Imports an inlined expression. | |
mcFraction-specific functions | |
wxPoint | gui_GetNumPos () const |
wxPoint | gui_GetDenPos () const |
void | gui_SetCursorOnDen (mcCursorPos cp=mcCP_END) |
void | gui_SetCursorOnNum (mcCursorPos cp=mcCP_END) |
mcElement abstract functions | |
void | gui_UpdateExpDepth () |
A mcFraction needs to change exponent depth of numerator and denominator. | |
bool | gui_isBeginKey (const mcKey &ev) const |
Returns a positive value if the given character marks the begin of this element; FALSE otherwise. | |
bool | gui_isEndKey (const mcKey &ev) const |
Returns TRUE if the given character marks the end of this element; this function is always called before calling ::gui_Input function. | |
mcInputRes | gui_Input (const mcKey &ev, mcElement *newelem) |
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). | |
mcInsertRes | gui_Insert (const mcElement &, mcElement *) |
Inserts the given element at the right of the cursor position. | |
mcMoveCursorRes | gui_MoveCursor (mcMoveCursorFlag flag, long modifiers) |
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). | |
void | gui_GetCursorPos (mcCursorPos &) const |
Returns the cursor position as Cursor Position flag. | |
int | gui_MoveCursorUsingPoint (wxDC &dc, const wxPoint &p) |
Moves the cursor inside this element in the closest available position to the given point. | |
int | gui_Draw (wxDC &dc, int x, int y, long flags, const wxPoint &pt) const |
element must be drawn with mcElementHelpers::sgui_m_pActivationBrush background brush; if this pointer is equal to mcDRW_NONACTIVE, the function must simply draw everything with default transparent mode; if the pointer is not one of the previous values, the function must use the pointer to find the subelement where it lies. | |
int | gui_GetRelCursorPos (wxDC &dc, wxPoint *pt) const |
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. | |
int | gui_GetYAnchor () const |
Returns the y amount of this mcElement to subtract from the center line to draw this element. | |
void | gui_SetCursorPos (const mcCursorPos &) |
Sets the cursor position inside the element using Cursor Position flags. | |
void | gui_OnSelect (wxDC &dc, wxRect &rc) |
This function is called when the bounding box of this element intersects with the selection rectangle created by the user with the mouse cursor. | |
void | gui_DoRecalcSize () |
This function is called by mcElement and non-mcElement functions when the internal size variable must be updated due to a change in the structure of the element. | |
mcElement | gui_GetSelection () const |
Returns the selected portion of this element. | |
void | gui_DeleteSelection () |
Deletes the selected children of this element, without breaking the integrity of this element: a data_Check() constcall after this function should throw no errors. | |
mcElementMath abstract functions | |
Implementation of abstract general math functions. | |
bool | math_CanBeMultWith (const mcElement &p) const |
Works like #math_CanBemath_AddeWith(), just for multiplication. | |
bool | math_CanBeAddedWith (const mcElement &p) const |
Returns TRUE if this element can be added with the given element. | |
bool | math_CanBeDivBy (const mcElement &p) const |
Works like #math_CanBemath_AddeWith(), just for divisions. | |
virtual mcBasicOpRes | math_Add (const mcElement &, mcElement *p, bool add) |
Sums or subtracts this element with the given e element. | |
virtual mcBasicOpRes | math_MultiplyBy (const mcElement &, mcElement *p) |
Multiplies two mcElements of the same type and stores the result in this object. | |
virtual mcBasicOpRes | math_DivideBy (const mcElement &, mcElement *p) |
Divides two mcElements of the same type and stores the result in this object. | |
mcRealValue | math_GetLenght () const |
Returns the 'lenght' of this element without taking in count its children. | |
int | math_GetOrderPos () const |
Returns the order position for this element. | |
mcMathType | math_GetMathType () const |
A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier. | |
mcBasicOpRes | math_MakeReciprocal (mcElement *) |
Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this. | |
mcExpSimRes | math_Simplify (long flags, mcElement *newelem) |
Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed. | |
mcExpSimRes | math_Expand (long flags, mcElement *newelem) |
Expands this element one "step". | |
bool | math_Compare (const mcElement &p, long flags) const |
Compares *this element with the given one and then compare the children of *this and the children of the given element, too. | |
mcRealValue | math_Evaluate () const |
Evaluates the numeric value of this element and then returns it. | |
void | math_SetExp (const mcPolynomial &p) |
Sets the exponent of this element to match the given polynomial. | |
mcBasicOpRes | math_RaiseTo (const mcPolynomial &p) |
Raises *this element to the given polynomial. | |
mcMonomial | math_GetLCM (const mcElement &) const |
Returns the LCM between *this and the given element. | |
mcMonomial | math_GetGCD (const mcElement &) const |
Static Public Attributes | |
static mcKey * | sgui_pNewFraction = NULL |
The key to use to create this element. | |
static int | sgui_nSpaceAboveBelow = 2 |
The space left above & below fraction. | |
static int | sgui_nSpaceBetween = 1 |
The space above and below fraction line. | |
static int | sgui_nAdditionalWidth = 4 |
The additional fraction line's lenght used to make it look better. | |
static int | sgui_nAdditionalSpace = 8 |
The space which is left empty on the left and on the right of the fraction line to make everything look better. | |
Protected Member Functions | |
void | gui_Init () |
Inits this section of the element. | |
mcExpSimRes | math_SimplifyFactors (long flags, mcElement *newelem) |
Protected Attributes | |
mcPolynomial | mdata_eNum |
The numerator. | |
mcPolynomial | mdata_eDen |
The denominator. | |
int | mgui_nCursorPos |
The current cursor location. | |
Private Member Functions | |
mcDEFINE_REFERENCE_DATA (mcFraction, mcET_FRACTION) |
|
Definition at line 107 of file Fraction.h. |
|
Definition at line 108 of file Fraction.h. |
|
math_Adds the given elements to the numerator/denominator.
Definition at line 79 of file Fraction.cpp. References mcElementArray::data_AddElements(), data_GetDen(), and data_GetNum(). |
|
Deep copies all the info contained in this class. The mcElement implementation should be enough because all the element's data should be contained inside the associated mcElementData derived class. In fact, mcElementData does not provide a standard implementation of the DeepCopy() function. mcElement-derived classes, instead, should not contain any other variable, so this function should be enough.... Reimplemented from mcElementHelpers. Definition at line 152 of file Fraction.h. References mcElementHelpers::data_DeepCopy(), mcElement::data_DeepCopy(), mdata_eDen, mdata_eNum, and mgui_nCursorPos. |
|
Returns the number of children attached to this tree node. This function can be used on *any* mcElement node because this is a virtual function which is overridden by container classes which thus return the correct number of children. This function is used by various mcElement functions like data_Check() const data_GetElemFromID(), ... which must call some standard mcElement functions on all nodes attached to this element. Reimplemented from mcElementHelpers. Definition at line 128 of file Fraction.h. References mcElementHelpers::data_GetChildrenCount(). |
|
Returns the n-th tree node attached to this element. You can use this function to traverse the entire tree:
mcElement rootnode = [...]; MyWalkerFnc(rootnode); void MyWalkerFnc(mcElement p) { // do what you want on the "p" node... for (int i=0; i < p.data_GetChildrenCount(); i++) MyWalkerFnc(p.data_GetChild(i)); }
Reimplemented from mcElementHelpers. Definition at line 134 of file Fraction.h. References mcEmptyElement, and mcRETURN_ELEMENT_CHILD. |
|
Definition at line 191 of file Fraction.h. |
|
|
Definition at line 190 of file Fraction.h. |
|
|
Performs a deep comparison of the data hold by this class and the data hold by the given mcElementHelpers object.
Reimplemented from mcElementHelpers. Definition at line 160 of file Fraction.h. References mdata_eDen, and mdata_eNum. |
|
math_Replaces the idx-th child of this element with a copy of the given one.
Reimplemented from mcElementHelpers. Definition at line 143 of file Fraction.h. References mcASSERT, mcET_POLYNOMIAL, and mcSET_ELEMENT_CHILD. |
|
Copies the given polynomial, setting it as the denominator of the fraction.
Definition at line 172 of file Fraction.h. References mcElement::data_Check(). Referenced by math_Add(). |
|
Copies the given polynomial, setting it as the numerator of the fraction.
Definition at line 179 of file Fraction.h. References mcElement::data_Check(). |
|
Deletes the selected children of this element, without breaking the integrity of this element: a data_Check() constcall after this function should throw no errors. The caller should first check if the element is entirely selected; if it is, the element should be deleted (by the caller) and this function should not be called. This is a recursive function. Reimplemented from mcElementHelpers. Definition at line 577 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcPolynomial::gui_AddNewEmptyMonomial(), mcElementHelpers::gui_DeleteSelection(), and mcElementHelpers::gui_RecalcSize(). |
|
This function is called by mcElement and non-mcElement functions when the internal size variable must be updated due to a change in the structure of the element. This function should be as fast and accurate as possible and it must store the new size in the mgui_sz variable.
Implements mcElementHelpers. Definition at line 160 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElementHelpers::gui_GetHeight(), mcElementHelpers::gui_GetWidth(), mcMAX, sgui_nAdditionalSpace, sgui_nAdditionalWidth, sgui_nSpaceAboveBelow, and sgui_nSpaceBetween. |
|
element must be drawn with mcElementHelpers::sgui_m_pActivationBrush background brush; if this pointer is equal to mcDRW_NONACTIVE, the function must simply draw everything with default transparent mode; if the pointer is not one of the previous values, the function must use the pointer to find the subelement where it lies. Then, only the subelement's gui_Draw() function must be called with the initial pointer. The subelements must be called with mcDRW_ALLACTIVE flag only for special reasons.
Implements mcElementHelpers. Definition at line 242 of file Fraction.cpp. References data_GetDen(), mcElementHelpers::data_GetID(), data_GetNum(), mcElement::gui_Draw(), gui_GetDenPos(), mcElement::gui_GetHeight(), gui_GetNumPos(), mcElementHelpers::gui_GetSize(), mcElementHelpers::gui_GetThickness(), mcElementHelpers::gui_GetWidth(), mcDRW_ALLOW_TOTAL_SELECTION, mcDRW_NOACTIVEELEM, mcDRW_NONACTIVE, mcDRW_USEPOINT, sgui_nAdditionalSpace, sgui_nSpaceAboveBelow, and sgui_nSpaceBetween. |
|
Returns the cursor position as Cursor Position flag. It must return mcCP_BEGIN if cursor is at the leftmost point of the element, mcCP_END if the cursor is at the rightmost point of the element, mcCP_INSIDE otherwise. When this function is called the cursor is always inside the element. Implements mcElementHelpers. Definition at line 542 of file Fraction.cpp. References mcCursorPos::gui_Push(), mcCP_BEGIN, mcCP_END, mcFRACTION_LEFTMOST, mcFRACTION_RIGHTMOST, and mgui_nCursorPos. |
|
Definition at line 181 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElementHelpers::gui_GetHeight(), mcElementHelpers::gui_GetWidth(), sgui_nSpaceAboveBelow, and sgui_nSpaceBetween. Referenced by gui_Draw(), gui_GetRelCursorPos(), gui_MoveCursorUsingPoint(), and gui_OnSelect(). |
|
Definition at line 174 of file Fraction.cpp. References data_GetNum(), mcElementHelpers::gui_GetWidth(), and sgui_nSpaceAboveBelow. Referenced by gui_Draw(), gui_GetRelCursorPos(), gui_MoveCursorUsingPoint(), and gui_OnSelect(). |
|
Returns the height of the cursor and the (x;y) position of the cursor (in the given pointer) relative to the top-left point of this element. The function must fill the wxPoint pointer using coordinates relative to the top-left point of its bounding rectangle. When this function is called, the cursor is always inside the element.
Implements mcElementHelpers. Definition at line 501 of file Fraction.cpp. References data_GetDen(), data_GetNum(), gui_GetDenPos(), gui_GetNumPos(), mcElement::gui_GetRelCursorPos(), mcElementHelpers::gui_GetSize(), mcFRACTION_INSIDEDEN, mcFRACTION_INSIDENUM, mcFRACTION_LEFTMOST, mcFRACTION_RIGHTMOST, and mgui_nCursorPos. |
|
Returns the selected portion of this element. If this element is entirely selected (this is the default for non-container elements), the entire element should be returned (this is what the default implementation does). Container elements should override this function returning only the selected elements (in mcMonomials, mcBrackets, mcPolynomials...) or the entire element itself if it is entirely selected. This functions returns an object and not a reference to an object (as for example does gui_GetActiveElem) because the selection cannot be modified through this function. Reimplemented from mcElementHelpers. Definition at line 552 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElement::gui_GetSelection(), mcElementHelpers::gui_isAllSelected(), mcElement::gui_isSelected(), and mcASSERT. |
|
Returns the y amount of this mcElement to subtract from the center line to draw this element.
Reimplemented from mcElementHelpers. Definition at line 153 of file Fraction.cpp. References data_GetNum(), mcElement::gui_GetHeight(), mcElementHelpers::gui_GetThickness(), sgui_nSpaceAboveBelow, and sgui_nSpaceBetween. |
|
Inits this section of the element. Acts like a constructor (it's called by mcElementHelpers). Reimplemented from mcElementHelpers. Definition at line 112 of file Fraction.h. References mcElementHelpers::gui_Init(), and mcFRACTION_INSIDENUM. |
|
This function is called when the cursor is inside the element and the user presses a key (which is not the element's end tag). The way the element should process the given character is dependent to the element type: a mcNumber will insert vk next to the cursor position if vk is a digit. If vk is not acceptable, the function should call the MathCore error-handler function, mcMathCore::Get()->SyntaxError. This function should return one of the values defined for mcInputRes: mcIR_OKAY, mcIR_DELETE_THIS, mcIR_DIRECT_DELETE, mcIR_DELETE_NEXT.
Implements mcElementHelpers. Definition at line 329 of file Fraction.cpp. References mcElementHelpers::data_AddProperty(), data_GetDen(), data_GetNum(), mcElementHelpers::data_hasProperty(), mcPolynomial::gui_AddNewEmptyMonomial(), mcElement::gui_Input(), mcElementHelpers::gui_RecalcSize(), mcASSERT, mcEP_INITIALIZED, mcFRACTION_INSIDEDEN, mcFRACTION_INSIDENUM, mcFRACTION_LEFTMOST, mcFRACTION_RIGHTMOST, mcIR_DELETE_NEXT, mcIR_DELETE_PREVIOUS, mcIR_DELETE_THIS, mcIR_OKAY, mgui_nCursorPos, and sgui_pNewFraction. |
|
Inserts the given element at the right of the cursor position.
Implements mcElementHelpers. Definition at line 386 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElement::gui_Insert(), mcASSERT, mcFRACTION_INSIDEDEN, mcFRACTION_INSIDENUM, mcINSR_OKAY, and mgui_nCursorPos. |
|
Returns a positive value if the given character marks the begin of this element; FALSE otherwise. The begin character cannot be dependent from any variable; it must be always the same. The character is given both as ASCII code and as virtual key code.
Implements mcElementHelpers. Definition at line 125 of file Fraction.cpp. References sgui_pNewFraction. |
|
Returns TRUE if the given character marks the end of this element; this function is always called before calling ::gui_Input function. isEndChar can return values dependent from the cursor position. The character is given both as ASCII code and as virtual key code
Implements mcElementHelpers. Definition at line 132 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcMathCore::Get(), mcElement::gui_isEndKey(), mcMathCore::m_pCancelKey, mcKey::MatchKey(), mcASSERT, mcFRACTION_INSIDEDEN, mcFRACTION_INSIDENUM, mcFRACTION_LEFTMOST, mcFRACTION_RIGHTMOST, and mgui_nCursorPos. |
|
This function is called to move the cursor which is inside the element, one 'step' left, right, up or down (when flag=mcMCF_LEFT/mcMCF_RIGHT/mcMCF_UP/mcMCF_DOWN). Elements which cannot move the cursor in the given direction, should call mcMathCore::Get()->SyntaxError() function. If the cursor must 'exit' the element (because its at the end, for example) the function must return mcMCR_SETFOCUS_PREVIOUS or mcMCR_SETFOCUS_NEXT. This function must always return the code mcMCR_SETFOCUS_* or mcMCR_OKAY. When this function is called, cursor is always inside the element.
Implements mcElementHelpers. Definition at line 404 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElement::gui_MoveCursor(), mcElement::gui_SetCursorPos(), mcCP_BEGIN, mcFRACTION_INSIDEDEN, mcFRACTION_INSIDENUM, mcFRACTION_LEFTMOST, mcFRACTION_RIGHTMOST, mcMCF_DOWN, mcMCF_LEFT, mcMCF_RIGHT, mcMCF_UP, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, and mgui_nCursorPos. |
|
Moves the cursor inside this element in the closest available position to the given point. The function must use the given point to set its internal cursor-position variables (when this function is called, the given point is always inside the bounding rectangle of the element, but maybe the cursor is not).
Implements mcElementHelpers. Definition at line 483 of file Fraction.cpp. References data_GetDen(), data_GetNum(), gui_GetDenPos(), gui_GetNumPos(), mcElementHelpers::gui_GetSize(), mcElement::gui_MoveCursorUsingPoint(), mcFRACTION_INSIDEDEN, mcFRACTION_INSIDENUM, mcMCR_OKAY, and mgui_nCursorPos. |
|
This function is called when the bounding box of this element intersects with the selection rectangle created by the user with the mouse cursor. The standard implementation just selects this element. If you are implementing a container element, you must override this function and check contained elements' bounding boxes and then call the gui_OnSelect() function of the contained elements whose bounding boxes intersect the given selection rectangle. Reimplemented from mcElementHelpers. Definition at line 190 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElementHelpers::gui_DeSelect(), gui_GetDenPos(), gui_GetNumPos(), mcElementHelpers::gui_GetSize(), mcElementHelpers::gui_isSelected(), mcElement::gui_OnSelect(), mcElementHelpers::gui_Select(), and mcElementHelpers::gui_SelectAll(). |
|
Definition at line 214 of file Fraction.h. References mcElement::gui_SetCursorPos(), and mcFRACTION_INSIDEDEN. |
|
Definition at line 219 of file Fraction.h. References mcElement::gui_SetCursorPos(), and mcFRACTION_INSIDENUM. |
|
Sets the cursor position inside the element using Cursor Position flags. When it's called to set the cursor at the end of the base, code==mcCP_END and data_hasProperty(mcEP_HASEXPONENT) == FALSE, when it's called to set the cursor at the beginning of the base, code==mcCP_BEGIN. The function doesnt need to care for the third Cursor Position flag: mcCP_INSIDE, actually this function will never be called with this code. Implements mcElementHelpers. Definition at line 532 of file Fraction.cpp. References mcASSERT, mcFRACTION_LEFTMOST, mcFRACTION_RIGHTMOST, and mgui_nCursorPos. |
|
A mcFraction needs to change exponent depth of numerator and denominator.
Reimplemented from mcElementHelpers. Definition at line 234 of file Fraction.h. References mcElement::gui_SetAtSameLevelOf(), and mcElementHelpers::gui_UpdateExpDepth(). |
|
Definition at line 624 of file Fraction.cpp. References mcElementArray::data_Get(), mcElementArray::data_GetCount(), mcElement::data_GetType(), mcEmptyElement, mcET_BRACKET, and mcET_MONOMIAL. Referenced by io_GetInlinedExpr(). |
|
Returns the inlined expression for this element as a wxString. "Inlined expression" means a math representation of the data in a single line: to allow such a restriction (everything must be on one text line), some standard conventions (and many brackets !!!) are used:
Implements mcElementHelpers. Definition at line 644 of file Fraction.cpp. References data_GetDen(), data_GetNum(), io_CheckBracketNeed(), and mcElement::io_GetInlinedExpr(). |
|
Returns the MathML code for this element as presentation markup (http://www.w3.org/TR/MathML2/chapter3.html) or as content markup (http://www.w3.org/TR/MathML2/chapter4.html).
Implements mcElementHelpers. Definition at line 600 of file Fraction.cpp. References data_GetDen(), data_GetNum(), and mcElement::io_GetMathML(). |
|
Imports an inlined expression.
"Inlined expression" means a string containing an encoded representation of math data: 234^2*ax+6y/2=0 is an inlined expression. This is the form which is used to input and output math data by a lot of math programs. Compability with these programs is crucial. However, because of the nature of this representation, the algorithm which recognizes (through io_isBeginChar functions) the elements to create, needs to know the lenght of the token which encodes this element; this is accomplished with the
Implements mcElementHelpers. Definition at line 693 of file Fraction.cpp. |
|
Imports presentation MathML reading the contents of the given XML node (without modifying it).
This function is called only if io_isBeginTag function returns a positive value for the name of parent tag of
Implements mcElementHelpers. Definition at line 660 of file Fraction.cpp. References data_GetDen(), data_GetNum(), and mcASSERT. |
|
Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same. Implements mcElementHelpers. Definition at line 329 of file Fraction.h. |
|
Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise. The begin tag cannot be dependent from any variable; it must be always the same.
Implements mcElementHelpers. Definition at line 323 of file Fraction.h. |
|
Imports as inlined expressions the two given strings in the numerator and denominator.
Definition at line 336 of file Fraction.h. |
|
Definition at line 715 of file Fraction.cpp. References data_GetDen(), and mcElement::io_ImportInlinedExpr(). |
|
Definition at line 706 of file Fraction.cpp. References data_GetNum(), and mcElement::io_ImportInlinedExpr(). |
|
Sums or subtracts this element with the given A unique function for add/subtract operations is used because the algorithms used to handle this two operations are usually almost identic and thus this avoids a lot of repetitions. If the two elements cannot be summed, then an ASSERT should fail since before using this function, the caller should always use the math_CanBeAddedWith() function.
The function returns one of mcBasicOpRes values, eventually using the Implements mcElementHelpers. Definition at line 812 of file Fraction.cpp. References mcPolynomial::data_AddNewMonomial(), mcElementArray::data_DeleteAll(), mcFraction::data_GetDen(), data_GetDen(), mcFraction::data_GetNum(), data_GetNum(), data_SetDen(), math_GetLCM(), mcElement::math_SimpleAdd(), mcElement::math_SimpleDivideBy(), mcElement::math_SimpleMultiplyBy(), mcElement::math_SimpleSubtract(), mcASSERT, mcBOR_REMOVE_OPERAND, mcET_BRACKET, mcET_FRACTION, mcET_FUNCTION, mcET_MONOMIAL, mcET_NUMBER, mcET_POLYNOMIAL, mcET_RADICAL, and mcET_SYMBOL. |
|
Returns TRUE if this element can be added with the given element. If the function returns TRUE, then the math_Add() function should return one of mcBOR_REMOVE_OPERAND, mcBOR_REPLACE_BOTH or mcBOR_REPLACE_OPERAND. Implements mcElementHelpers. Definition at line 804 of file Fraction.cpp. |
|
Works like #math_CanBemath_AddeWith(), just for divisions.
Implements mcElementHelpers. Definition at line 807 of file Fraction.cpp. |
|
Works like #math_CanBemath_AddeWith(), just for multiplication.
Implements mcElementHelpers. Definition at line 801 of file Fraction.cpp. |
|
Compares *this element with the given one and then compare the children of *this and the children of the given element, too. If they are the same, then the function returns TRUE; FALSE otherwise. This function is different from #math_hasSameContentOf() because it doesn't work on MaxSimply()ed copies. This function tipically uses the math_CompareThisOnly() function. Implements mcElementHelpers. Definition at line 744 of file Fraction.cpp. References mcFraction::data_GetDen(), data_GetDen(), mcFraction::data_GetNum(), data_GetNum(), mcElement::math_Compare(), and mcET_FRACTION. |
|
Divides two mcElements of the same type and stores the result in this object.
Implements mcElementHelpers. Definition at line 907 of file Fraction.cpp. References mcElement::data_Check(), data_GetDen(), mcFraction::math_Flip(), mcElement::math_SimpleMultiplyBy(), mcASSERT, mcBOR_REMOVE_OPERAND, mcBOR_REPLACE_OPERAND_AND_SET_MULTOP, and mcET_FRACTION. |
|
Evaluates the numeric value of this element and then returns it. The evaluation can proceed *only* if this element does _not_ contain any parameter or unknown; in case it contains one of these, then the returned value is *mcRealValue::pNAN. Implements mcElementHelpers. Definition at line 771 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcValue::isValid(), and mcElement::math_Evaluate(). |
|
Expands this element one "step". expanding means that the aim of this function is exactly the opposite of math_Simplify: instead making the function body shorter, it tries to make it as long as possible: (x - 2)^3 . first call to math_Expand x^3 - 6x^2 + 12x -8 Implements mcElementHelpers. Definition at line 1080 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElementArray::math_Expand(), mcESR_DONE, and mcESR_NOTFINISHED. |
|
Exchanges the numerator with the denominator.
Definition at line 785 of file Fraction.cpp. References data_GetDen(), and data_GetNum(). |
|
Implements mcElementHelpers. Definition at line 1112 of file Fraction.cpp. References mcFraction::data_GetDen(), data_GetDen(), mcFraction::data_GetNum(), data_GetNum(), mcFraction::data_SetDen(), mcFraction::data_SetNum(), and mcElement::math_GetGCD(). |
|
Returns the LCM between *this and the given element.
Implements mcElementHelpers. Definition at line 1099 of file Fraction.cpp. References mcFraction::data_GetDen(), data_GetDen(), mcFraction::data_GetNum(), data_GetNum(), mcFraction::data_SetDen(), mcFraction::data_SetNum(), and mcElement::math_GetLCM(). Referenced by math_Add(). |
|
Returns the 'lenght' of this element without taking in count its children. The wxT('lenght') of this element is the 'complexity' represented by the data placed in the mcElementData of this element. This is a key function for the simplify and expand routines of MathCore because through the use of this value, the system is able to decide if an operation determines a simplification or a complication. The simple example below shows how this can be done:
mcPolynomial mypol(NULL); mypol.Init("2^16"); mcRealValue n1 = mypol.math_GetTotalLenght(); */ (The math_GetTotalLenght() function works using this function !) The default implementation returns zero. This is a valid behaviour only for container elements, that is, for those elements where only the children carry information. For simple elements and for those containers which stand for an operation (like mcFraction which implies a division), the default implementation must be overridden. A lenght/complexity of 1 means that this element would require only a single byte of memory if stored in an ASCII string. An element long 2 units (like mcBracket) would require 2 bytes (one for the left parenthesis and one for the right one)... Implements mcElementHelpers. Definition at line 293 of file Fraction.h. |
|
A powerful recognizer function which automatically classifies the type of the math data contained in this class and returns the respective identifier.
Implements mcElementHelpers. Definition at line 755 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcMathType::m_tMath1, mcElementHelpers::math_ContainsUnknowns(), mcElement::math_GetMathType(), mcMathType::math_MultiplyBy(), and mcMTL1_RATIONAL. |
|
Returns the order position for this element.
Implements mcElementHelpers. Definition at line 294 of file Fraction.h. |
|
Calculates the reciprocal of this element; tipically, this function creates a mcFraction whose numerator is 1 and the denominator contains *this. This should be the default behaviour. A simple multiplication of the current exponent by -1 should be avoided when possible.
Reimplemented from mcElementHelpers. Definition at line 297 of file Fraction.h. References mcBOR_REMOVE_OPERAND. |
|
Multiplies two mcElements of the same type and stores the result in this object.
Implements mcElementHelpers. Definition at line 876 of file Fraction.cpp. References mcFraction::data_GetDen(), data_GetDen(), mcFraction::data_GetNum(), data_GetNum(), mcElement::math_SimpleMultiplyBy(), mcASSERT, mcBOR_REMOVE_OPERAND, and mcET_FRACTION. |
|
Raises *this element to the given polynomial. Returns mcBOR_INVALID if the operation could not be performed (this is typically because the base is negative), or mcBOR_REMOVE_OPERAND if the operation was okay.
Implements mcElementHelpers. Definition at line 1125 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcElement::math_SimpleRaiseTo(), and mcBOR_REMOVE_OPERAND. |
|
Sets the exponent of this element to match the given polynomial. As for math_RaiseTo, for elements which do not have an exponent by their own, this function should just call the children's math_SetExp functions. Reimplemented from mcElementHelpers. Definition at line 731 of file Fraction.cpp. References mcASSERT. |
|
Simplifies this element one "step"; that is, after one call to this function the element must be slightly changed. For example, this monomial requires three calls to math_Simplify to be completely reduced in a basic form: 12ax*3 + 4a/(x^-1) . first call to math_Simplify 36ax + 4a/(1/x) . second call 36ax + 4ax . third call 40ax
Implements mcElementHelpers. Definition at line 948 of file Fraction.cpp. References data_GetDen(), data_GetNum(), mcExpContainer::data_SetContent(), mcPolynomial::math_ChangeAllSigns(), mcElement::math_Evaluate(), mcPolynomial::math_isFactorized(), mcPolynomial::math_isFirstMonomialNegative(), mcElementArray::math_Simplify(), math_SimplifyFactors(), mcESR_CHANGE_SIGN, mcESR_DONE, mcESR_NOTFINISHED, and mcESR_REPLACE_THIS. |
|
|
|
|
The denominator.
Definition at line 66 of file Fraction.h. Referenced by data_DeepCopy(), and data_isSameAs(). |
|
The numerator.
Definition at line 63 of file Fraction.h. Referenced by data_DeepCopy(), and data_isSameAs(). |
|
The current cursor location.
Definition at line 76 of file Fraction.h. Referenced by data_DeepCopy(), gui_GetCursorPos(), gui_GetRelCursorPos(), gui_Input(), gui_Insert(), gui_isEndKey(), gui_MoveCursor(), gui_MoveCursorUsingPoint(), and gui_SetCursorPos(). |
|
The space which is left empty on the left and on the right of the fraction line to make everything look better.
Definition at line 63 of file Fraction.cpp. Referenced by gui_DoRecalcSize(), and gui_Draw(). |
|
The additional fraction line's lenght used to make it look better.
Definition at line 62 of file Fraction.cpp. Referenced by gui_DoRecalcSize(). |
|
The space left above & below fraction.
Definition at line 60 of file Fraction.cpp. Referenced by gui_DoRecalcSize(), gui_Draw(), gui_GetDenPos(), gui_GetNumPos(), and gui_GetYAnchor(). |
|
The space above and below fraction line.
Definition at line 61 of file Fraction.cpp. Referenced by gui_DoRecalcSize(), gui_Draw(), gui_GetDenPos(), and gui_GetYAnchor(). |
|
The key to use to create this element.
Definition at line 69 of file Fraction.cpp. Referenced by gui_Input(), and gui_isBeginKey(). |
[ Top ] |