Main Page | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

mcElementArrayHelpers Class Reference

#include <ElementArray.h>

Inheritance diagram for mcElementArrayHelpers:

Inheritance graph
[legend]
Collaboration diagram for mcElementArrayHelpers:

Collaboration graph
[legend]
List of all members.

Detailed Description

A little class containing the DATA, MATH, GUI and IO sections of this element (as instances and not pointers).

This is entirely defined & implemented through macros.

Definition at line 216 of file ElementArray.h.

INLINE CHECK functions

Fast and safe (in debug build) check functions.

bool data_isOp (int entry) const
 Returns TRUE if the specified entry is an operator.
bool data_isEmptyBox (int entry) const
 Returns TRUE if the specified entry is an empty box; an empty box can be placed anywhere in the array before the end.
bool data_isEmptyEntry (int entry) const
 Returns TRUE if the specified entry is an empty entry; empty entries can be placed only at the end of the array.
bool data_isAddSubOp (int entry) const
 Returns TRUE if the specified entry is an operator.
bool data_isMultDivOp (int entry) const
 Returns TRUE if the specified entry is an operator.
bool data_isArrayEmpty () const
 Returns TRUE if the array is empty or non allocated.
bool data_isValidElem (int entry) const
 Returns TRUE if the specified entry is valid.
static bool data_isValidElem (const mcElement &p)
 Checks if the given pointer is valid (it's not an empty box or an empty entry).

Public Member Functions

virtual int gui_GetSpaceBetweenRatio () const
 Returns the costant which is divided by the exponent depth of this element to get the number of pixels to leave among the elements.
 mcElementArrayHelpers ()
virtual ~mcElementArrayHelpers ()
bool io_isBeginTag (const wxXml2Node &tag) const
 Checks the given tag and, if it is an MROW, returns a null value (the ID of the first mcElementArray-derived class).
bool io_isBeginChar (const wxString &str) const
 Element arrays do not have a special begin/end character in inlined expressions...
wxString io_GetInlinedExpr () const
 Returns the inlined expression for this element as a wxString.
MISCELLANEOUS
Some miscellaneous functions.

void data_DeepCopy (const mcElementHelpers *p)
 Deep copies all the info contained in this class.
void data_AddProperty (int p, void *val1=NULL, void *val2=NULL)
  mcElementArray overloads this function to handle the mcElementArray-specific mcEP_ELEMENTARRAY_FILTER property.
int data_GetChildrenCount () const
 Returns the number of children attached to this tree node.
const mcElementdata_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_CheckArrayLimit ()
 Checks if the array is full; makes room if it is (the space added to the array is mcELEMENTARRAY_DEFAULT_ROOM.
void data_ChangeFilter (const mcFilter *p)
 Changes the filter associated with this array. See mcFilter.
void data_UpdateFilterFor (mcElement &p, const mcFilter *f)
 Updates the filter of the given element setting it to f.
bool data_isElementAllowed (mcElementType type) const
 Returns TRUE if the given type of element can be created.
bool data_isSameAs (const mcElementHelpers *p) const
 Checks all the children.
ARRAY HANDLER functions
Fast and safe (in debug build) array handlers functions.

virtual bool data_ScanArray (bool(*func)(const mcElement &), bool odd) const
 Checks that in this array, all the even (or odd) elements are okay.
virtual int data_AddElements (const mcElement *p, int num, int pos=-1, bool bOverwrite=FALSE, bool bForceCopy=FALSE)
 math_Adds one or more elements to the array.
virtual mcElementdata_AddNewElement (mcElementType t, bool bOverwrite=FALSE, int pos=-1)
 math_Adds a new element to the array and returns a pointer to it.
virtual mcElementdata_AddNewWrappedElement (mcElementType t, bool bOverwrite=FALSE, int pos=-1)
 Works like the #math_AddNewElement function but the new element is first wrapped in the appropriate structure: a mcPolynomial will wrap the new element in a mcMonomial while a mcMonomial will just call the #math_AddNewElement function.
void data_Merge (const mcElementArray &p, int n=0, bool bAddToEnd=TRUE)
 Merges the given array with this one, deep-copying the content and adding the new elements at the end of this array.
virtual void data_AddNewOp (mcElementType type, int pos=-1)
 math_Adds a new operator in the array.
virtual void data_AddNewEmptyBox (int pos=-1)
 math_Adds a new mcEmptyBox in the array, at the given position.
virtual void data_UpdateNeighbor (int n)
 Checks if the neighbors of the element n have the mcEP_NOTIFY_NEIGHBOR_CHANGE property set; if they have this function calls the mcElement::data_OnNeighborChange function of the neighbors of the element n.
virtual void data_Delete (int entry)
 Mark the requested entry as empty, that is, not containing a valid pointer value to an allocated element.
virtual bool data_Delete (const mcElement &elem)
 math_Finds the given element among the elements contained directly (that is, without any wrapper: this function is not recursive) and then deletes it from the array.
virtual void data_DeleteLast (int num)
 Deletes the last num elements decrementing also the element counter.
virtual void data_DeleteFirst (int num)
 Deletes the first num elements decrementing also the element counter.
virtual void data_DeleteAllElemType (mcElementType)
 Deletes all the occurrences of the elements of the given type, shifting the array each time...
mcElement data_Detach (int n)
 Detaches (that is, removes from array but doesn't delete) the n-th entry of the array and returns it.
mcElement data_DetachLastElem (int num)
 Detaches the last num elements decrementing the mdata_nElements counter.
mcElement data_DetachAll ()
 Detaches all the elements of the array.
void data_DeleteAll ()
 Deletes all the element in the array and marks all entries as empty; the array of pointers mdata_pElemArray is not deallocated.
void data_MoveElemRight (int start)
 Shifts elements in the array one position on the right (mdata_pElemArray[start] will be shifted right with all the following elements) and adds one unit from the elements counter (array grows).
void data_MoveElemLeft (int start)
 Shifts elements in the array one position on the left (mdata_pElemArray[start] will be replaced by the element on his right and so on) and subtracts one unit to the elements counter (array is shrinked).
void data_Move (int n, int k)
 Moves the n-th element of the array (and its preceding operator) to the position k.
int data_MoveAllElemType (mcElementType t, mcElementArray &m)
 Moves all the elements of type t from *this to the given array m (which must be of compatible with elements of type t !!).
void data_Swap (int index1, int index2)
 Swaps the element placed in index1 with the element placed in index2.
int data_QueueElemType (mcElementType t, int firstpos)
 Places the elements of the given type and subtype in the firstpos entry and following (swapping the element previously placed in the entries where the sequence of the t elements is created).
virtual void data_Repair ()
 Repairs the array, solving those problems which derive *not* from logic programming errors but from some assumptions taken in the algorithms.
virtual bool data_isWrappingOnly (mcElementType t) const
 Returns TRUE if this array is containing only an element of the given type.
virtual const mcElementdata_GetWrapped (mcElementType t) const
 Returns the element of type t wrapped by this element, if it does exist and it is the only element wrapped by this array; returns NULL otherwise.
GET functions
Fast and safe (in debug build) get functions.

void data_CheckIndex (int entry) const
 Use this as quick array and index check function; it stops the program if the given index is not a valid index for the current array (which must have been already created).
const mcElementdata_GetConst (int entry) const
 Returns a pointer to the element placed at the entry-th position in the array; it's better to use this function rather than accessing directly the array because this function (in debug mode), ensure some data checks.
const mcElementdata_Get (int entry) const
mcElementdata_Get (int entry)
int data_GetIndexOf (const mcElement &p) const
 Returns the index of the entry in the array which points to the given element.
const mcElementdata_GetLast () const
 Returns a pointer to the last element of the array.
mcElementdata_GetLast ()
mcElementdata_GetArray (int n=0) const
 Returns a pointer to the memory address where the pointer to the n-th element is stored.
int data_GetIndex (int id) const
 Returns the index of the element with the given ID; -1 if no elements with the given ID are stored in this expression.
int data_GetCount () const
 Returns the number of the elements stored in the mcPolynomial (takes in count also empty boxes).
int data_GetAvailableEntryCount () const
 Returns the number of the entries in the array (the array automatically grows if needed).
int data_GetNumOfElemType (mcElementType t) const
 Returns the number of the elements of type == t.
int data_GetOpCount () const
 Returns the number of the operators stored in the mcPolynomial.
mcElementdata_GetElemOfType (int n, mcElementType t) const
 Returns a pointer to the n-th occurrence of the element of type == t.
int data_GetElemIndexOfType (int n, mcElementType t) const
 Returns the index of the n-th occurrence of the element of type == t.
mcElementdata_GetNonOpElem (int n) const
 Returns a pointer to the n-th occurrence of a non mcOperator-derived class.
int data_GetNonOpElemIndex (int n) const
 Returns the index of the n-th occurrence of a non mcOperator-derived class.
mcOperatordata_GetOp (int n) const
 Returns a pointer to the n-th operator in the array.
int data_GetOpIndex (int n) const
 Returns the index of the n-th operator in the array.
mcElementType data_GetOpTypeBetween (int n1, int n2) const
 Returns the element type of the operator between...
mcElementType data_GetOpTypePreceding (int n) const
 Returns the operator type preceding the n-th element.
mcOperatordata_GetOpPreceding (int n) const
const mcElementdata_GetElemAtLeftOf (const mcElement &p) const
 Returns the element preceding the given pointer; this pointer must be a pointer to one element of the array of this class.
const mcElementdata_GetElemAtRightOf (const mcElement &p) const
 Returns a the element following the given pointer; this pointer must be a pointer to one element of the array of this class.
INLINE SET functions
Fast and safe (in debug build) set functions.

void data_Set (int i, const mcElement &value)
 Sets the i-th entry with the given value.
void data_SetAsEmptyEntry (int entry)
 Marks the given entry as empty but this function doesn't delete the eventually pre-existent element.
Filter functions
Functions which work on the mcFilter of this class.

void data_SetFilter (const mcFilter *p)
 (Re)sets the filter attached to this object.
mcFilterdata_GetFilter ()
 Returns the filter attached to this array; NULL if there are no filters set for this object.
const mcFilterdata_GetFilter () const
 The CONST version of the data_GetFilter.
bool data_isUsingFilter () const
 Returns TRUE if this class is using a filter.
Array handlers
Functions which manipulates the mcElementArray.

virtual int gui_AddNewElement (mcElementType type, const mcKey &key, int pos=-1)
 Creates a new element of the type & subtype, sends it the given start key and adds it to the array in the specified position.
void gui_AddNewEmptyBox (int pos=-1)
 Just to make easier the empty box creation.
void gui_AddNewOp (mcElementType nOpType, int pos=-1)
 math_Adds a new operator of the specified type at the specified position.
void gui_SetCursorOnElemBegin (int n)
 Sets the cursor at the beginning of the n-th element.
void gui_SetCursorOnElemEnd (int n)
 Sets the cursor at the end of the n-th element.
bool gui_isCursorOn (const mcElement &p) const
 Returns TRUE if the given element is contained in this monomial and it has the focus (that is, the cursor is placed on that element).
int gui_GetSelElemCount () const
 Returns the number of the selected elements in the expression.
int gui_GetSelElemCountOfType (mcElementType t) const
 Returns the number of the selected elements in the array of the given type and subtype.
int gui_GetSelElemIndex (int n) const
 Returns the index of the n-th selected element found inside the expression.
int gui_GetSelElemIndexOfType (int n, mcElementType t) const
 Returns the index of the n-th selected element found inside the expression, which match the given type and subtype.
const mcElementgui_GetSelElem (int n) const
 Returns a pointer to the n-th selected element found inside the expression.
const mcElementgui_GetSelElemOfType (int n, mcElementType t) const
int gui_GetSelStart () const
 Returns the index of the first selected element contained in the expression, or -1 if there is no selected element.
int gui_GetSelEnd () const
 Returns the index of the last selected element contained in the expression, or -1 if there is no selected element.
void gui_DeleteSelection ()
 Deletes all the selected elements of the array.
mcElementgui_ExGetActiveElem (int x, int y, const wxPoint &pt, int cl)
 Returns the currently active element of the array or NULL if there is no active element under the mouse cursor.
void gui_DeleteNextOp ()
 Deletes the operator which follows the currently focused element.
void gui_DeletePreviousOp ()
 Deletes the operator which precedes the currently focused element.
void gui_MoveCursorRight ()
 Moves cursor from the current position one step right, skipping elements which return FALSE to the gui_LetInCursor() function.
void gui_MoveCursorLeft ()
void gui_UpdateExpDepth ()
 Sets the exponent depth of all the elements contained to be the same of the exponent depth of *this.
bool gui_Insert (const mcElement &toinsert)
mcElement functions
Functions which implements some (the remaining abstract methods must be implemented by derived classes) abstract functions of mcElement.

virtual 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.
virtual void gui_SetCursorPos (const mcCursorPos &code)
 Sets the cursor position inside the element using Cursor Position flags.
virtual 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).
virtual 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).
virtual mcElement gui_GetSelection () const
 Returns the selected portion of this element.
virtual 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.
virtual void gui_GetCursorPos (mcCursorPos &) const
 Returns the cursor position as Cursor Position flag.
virtual mcCursorPos gui_GetCursorPos () const
 Returns the cursor position after creating mcCursorPos.
virtual int gui_GetYAnchor () const
 Returns the y amount of this mcElement to subtract from the center line to draw this element.
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.
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_MoveCursorUsingPoint (wxDC &dc, const wxPoint &pt)
 Moves the cursor inside this element in the closest available position to the given point.
mcElementgui_GetActiveElem (int x, int y, const wxPoint &pt)
Abstract mcElementArray functions
Pure virtual functions which must be implemented in mcElementArray derived classes to personalize array's behaviour.

virtual mcInputRes gui_BackInput (const mcKey &key, mcElement *pnewelem, int n)=0
 Replies to the return flag of the gui_Input() function of the subelement called by the mcElementArray::gui_Input() function.
virtual bool gui_isArrEndKey (const mcKey &ev) const =0
 Returns TRUE if the given key cannot be handled by the array.
virtual void gui_CheckCursorPos () const =0
 Checks that the cursor is in the right position; this function is called in critical points of the most complex mcElementArrayGUI routines to be sure that wrong cursor positions are immediately catched.
virtual void gui_DoSplit (mcElementType type, const mcKey &ev)=0
 gui_Splits the currently focused elements in two parts, inserting a new element of the given type and subtype between those two parts
Helper functions
Handy functions related to the graphical output; these functions are defined as virtual, so derived classes can override them.

virtual int gui_GetSpaceBetween () const
 Returns the number of pixels to leave among the elements of the array.
virtual int gui_GetCenterLine () const
 Returns the y value which is the half of the height of the tallest element in the array.
virtual int gui_ExDraw (wxDC &dc, int x, int y, long flags, const wxPoint &pt, int cl=-1, int begin=0, int end=-1, bool bgui_DrawSelected=FALSE) const
 gui_Draws all the elements contained in the array behaving exactly as mcElement::gui_Draw but requires some additional parameters.
virtual int gui_DrawSelectedElements (wxDC &dc, int x, int y, long flags, const wxPoint &pt, int cl=-1) const
 gui_Draws only the selected elements contained in the array.
virtual int gui_DrawSelection (wxDC &hDC, int x, int y, long flags, const wxPoint &pt, int cl=-1) const
 rectangle, mcDRW_NOACTIVEELEM otherwise: please note that this function could return mcDRW_NOACTIVEELEM even if an active element is present (but not inside the selection rectangle).
virtual void gui_ExOnSelect (wxDC &dc, wxRect &rc, int cl=-1)
 Behaves as mcElement::gui_OnSelect() function; the only difference is that this function allows the caller to specify a space to leave (in computations: this function doesn't draw anything) among the various elements.
virtual wxSize gui_CalcSizeOfFirst (int n, int cl=-1) const
 Returns the size of the first n elements in the array.
virtual wxSize gui_CalcSizeOfRange (int begin, int end, int cl=-1) const
 Returns the size of the bouding box of the given range of elements.
virtual wxRect gui_GetSelectionRect (wxDC &dc, int x, int y, int cl=-1) const
 Returns the selection rectangle in screen coordinates.
virtual wxPoint gui_GetOriginOfElem (int n, int cl=-1) const
 Returns the position of the upper-left coord.
virtual int gui_GetBB (int n, wxRect *rc, int yCenter=0, int w=0) const
 Returns the width of n-th element and its bounding box (in the pointer) in coord.
virtual int gui_ExGetRelCursorPos (wxDC &hDC, wxPoint *pt, int cl=-1) const
 Asks the currently focused element of the array for the cursor position; then, offsets it to the right position and return it in the given point pointer.
virtual int gui_ExMoveCursorUsingPoint (wxDC &hDC, const wxPoint &pt, int cl=-1)
 This function is typically used in response to a gui_MoveCursorUsingPoint() calls.
virtual int gui_GetActiveElemIndex (int x, int y, const wxPoint &pt, int cl=-1)
 Returns the index of the currently active element, or the index of the element which contains the current active element (this function cannot recursively search the index of the active element and it must stop to the first element, even if it's a container one).
mcElementMath abstract functions implementation
mcElementArrayMath implements various mcElementMath functions.

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".
mcExpSimRes math_Simplify (long flags)
 A mcElementArray will never use the argument of the standard mcElement::math_Simplify(long flags) function, because it will never return mcESR_REPLACE_THIS flag...
mcExpSimRes math_Expand (long flags)
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.
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.
bool math_CanBeMultWith (const mcElement &p) const
 Works like #math_CanBemath_AddeWith(), just for multiplication.
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.
virtual mcRealValue math_Evaluate () const
 Evaluates the numeric value of this element and then returns it.
virtual mcRealValue math_GetLenght () const
 An empty array must not be evaluated zero: in this way, the simp/exp algorithms know that an array, even if empty, adds a little bit of complexity...
Array access functions
Functions which work on the array in a similar way to mcElementArrayData.

const mcElementmath_Get (int n) const
 This should not be virtual because mcPolynomial will use its own Get() function with a different return type.
mcElementmath_Get (int n)
virtual int math_GetCount () const
int math_GetIndexOf (int occ, const mcElement &tofind) const
 Even if this function could seem similar to mcElementArray::data_GetIndexOf, it's not: while data_GetIndexOf works using for comparisons XX, math_GetIndexOf uses the mcElement math_NonRecursiveFindInChildren function which uses math_Compare and math_CompareThisOnly for comparisons.
mcElementType math_GetOpTypeBetween (int n1, int n2) const
mcElementType math_GetOpTypePreceding (int n) const
mcOperatormath_GetOpBetween (int n1, int n2) const
mcOperatormath_GetOpPreceding (int n) const
mcElementArrayMath-specific math functions
Functions implemented on the top of the abstract ones.

bool math_Remove (int n, bool bAddZero=TRUE)
 Remove the n-th element from the array, creating a mcNumber init with zero (if bmath_AddToZero == TRUE) or with one (if bmath_AddToZero == FALSE), if the expression would remain empty after the removal of the n-th element.
bool math_RemoveFactor (const mcArrayEntry &toremove)
virtual bool math_Delete (int n, const mcElement &elem, bool bAddZero=TRUE)
 math_Finds the given element among the elements contained directly (that is, without any wrapper: this function is not recursive) and then deletes it from the array.
void math_ApplyOp (mcElementType optype, mcElement res, const mcElement &factor, mcElement *)
 Creates a temporary operator of the given type and then applies it to the given two elements.
void math_ApplyOpSimple (mcElementType optype, mcElement res, const mcElement &factor)
 Works like #ApplyOp but uses the mcOperator::ApplySimple instead of the mcOperator::Apply function.
virtual bool math_CompareThisOnly (const mcElement &p, long flags) const
 Compares this element and the given one and then stops, unlike math_Compare() that compares children too.
virtual 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.
virtual bool math_isWrappingOnly (mcElementType t) const
 Returns TRUE if this array is containing only an element of the given type.
virtual const mcElementmath_GetWrapped (mcElementType t) const
 Returns the element of type t wrapped by this element, if it does exist and it is the only element wrapped by this array; returns NULL otherwise.
virtual mcArrayEntry math_WrapMonomial (const mcMonomial &)=0
virtual mcArrayEntry math_WrapSimple (const mcElement &)=0
virtual mcArrayEntry math_WrapSymbol (const mcSymbolProperties *sym)
virtual mcArrayEntry math_WrapNumber (const mcRealValue &val)
bool math_isWrappingNumOnly () const
 Returns TRUE if this array is containing only a mcNumber.
bool math_isWrappingSymOnly () const
 Returns TRUE if this array is containing only a mcSymbol.
mcRealValue math_GetWrappedNumber () const
 Returns the number which is wrapped by this array or NAN if this array does not contain a single mcNumber.
const mcSymbolPropertiesmath_GetWrappedSymbol () const
 Returns the symbol which is wrapped by this array or NULL if this array does not contain a single mcSymbol.
bool math_isWrappingOnly (const mcSymbolProperties *sym) const
bool math_isWrappingOnly (const mcRealValue &val) const
virtual void math_ResetToOne ()
virtual void math_ResetToZero ()
virtual void math_SimpleAdd (const mcElement &p, bool add=TRUE)
 Adds the given element to this element using the math_Add() function and then checking that the return value is mcBOR_REMOVE_OPERAND: that is, the operation was completed successfully and *this now contains the result of the operation.
virtual void math_SimpleMultiplyBy (const mcElement &p)
virtual void math_SimpleDivideBy (const mcElement &p)
mcArrayEntry math_EmbedInFraction (bool bAsDenominator=FALSE)
mcArrayEntry math_EmbedInBracket ()
mcArrayEntry math_EmbedInRadical ()
mcElementArrayMath abstract functions
Functions which must be implemented by derived classes.

virtual int math_DataToMathIdx (int dataindex) const =0
 Converts from data to math index.
virtual int math_MathToDataIdx (int mathindex) const =0
 Converts from math to data index.
virtual void math_PrepareForComparison (mcElementArray &p) const
virtual void math_PrepareForMathOperations (mcElementArray &p) const
virtual mcElementType math_GetNeutralOpType () const =0
virtual double math_GetNeutralValue () const =0
virtual mcPolynomial math_GetPolynomialWrapper () const =0
 Returns a new mcPolynomial containing *this array.
virtual mcElementArray math_CreateWrapperFor (const mcElement &p) const
 Returns a new mcElementArray element which wraps the given element.
virtual mcMonomial math_GetFactors () const
 Factores-out everything which can be factored out from this element.
void math_EmbedInBracketAndRaiseTo (const mcRealValue &n)
 Factores-out of the contained elements everything is possible.
void math_EmbedInBracketAndRaiseTo (const mcPolynomial &p)
void math_EmbedInRadicalAndRaiseTo (const mcPolynomial &p)

Static Public Attributes

static wxPen * sgui_pSelectionPen = NULL
 The pen used to draw the selection rectangle.
static bool sgui_bDrawSelectionInverting = TRUE
 If TRUE, then the selection will be drawn inverting the colours of the selected elements (this is the standard behaviour in all editing systems).

Protected Member Functions

void gui_Init ()
 Inits the GUI section of this element.
virtual int data_GetIdxFromEntry (const mcArrayEntry *p) const =0
virtual mcElementdata_GetRefFromEntry (const mcArrayEntry *p)=0
virtual mcExpSimRes math_HandleExpSimFlag (mcExpSimRes r, mcElement *newelem, int i)
 Handles the given simplification flag returned by the i-th element of this array.
virtual void math_HandleBasicOpRes (mcBasicOpRes res, mcElement r, int ridx)
 Handles the mcBasicOpRes flag returned by one of mcElementMath basic operations (+,-,*,/).
virtual int math_ReorderElements (mcElement *arr, int sz, int start=0, int toskip=1)
 Reorders the given array of the given size using the mcElement::math_isListedBeforeOf to perform comparisons.
virtual mcExpSimRes math_ExpandAll (long flags, mcElement *pp)
 Expands all the elements of the array.
virtual mcExpSimRes math_SimplifyAll (long flags, mcElement *pp)
 Simplifies all the elements of the array.
virtual mcExpSimRes math_SimplifyExp (long flags, mcElement *pp)
 Expands those elements which contain symbols in common.
virtual mcExpSimRes math_SimplifyRemoveNeutrals (long flags)
 Removes all the neutral elements from the array, using the #GetNeutralValue and the #GetNeutralOpType functions.
virtual mcExpSimRes math_SimplifySolveOp (long flags)
 Applies all the operators which can be applied on the elements of the array.
virtual mcExpSimRes math_Reorder ()=0
 Reorders the array.
virtual bool math_SimplifyNeedExp (long flags, int n) const
 Returns TRUE if the n-th element must be expanded in order to simplify this array.
virtual mcExpSimRes math_BeginSimSteps ()
virtual mcExpSimRes math_FinalSimSteps ()
virtual void math_EndSimSteps ()
 This routine is called when we're exiting from the math_Simplify(long flags) function (it's called even if we're exiting with a code different from mcESR_DONE).
virtual void math_EndExpSteps ()
 Like #EndSimSteps() just for expansion.

Protected Attributes

int mdata_nElements
 Number of mcElements currently inserted in the mdata_pElemArray array.
mcFiltermdata_pFilter
 The filter which is attached to this array.
int mgui_nCursorPos
 Index of the element which contains the cursor (mgui_nCursorPos cannot index an operator of the array, it must always index a non-operator element).

Private Attributes

mcElementmdata_pElemArray
 Pointer to the array of mcElements; double deference is required for special operations like array enlargment.
int mdata_nUpperBound
 Used to remember the upper bound of the m_pElem array and thus to avoid the use of non-allocated memory.

Friends

class mcArrayEntry


Constructor & Destructor Documentation

mcElementArrayHelpers::mcElementArrayHelpers  )  [inline]
 

Definition at line 289 of file ElementArray.h.

virtual mcElementArrayHelpers::~mcElementArrayHelpers  )  [inline, virtual]
 

Definition at line 298 of file ElementArray.h.

References mcSAFE_DELETE, and mcSAFE_DELETE_ARRAY.


Member Function Documentation

int mcElementArrayHelpers::data_AddElements const mcElement p,
int  num,
int  pos = -1,
bool  bOverwrite = FALSE,
bool  bForceCopy = FALSE
[virtual]
 

math_Adds one or more elements to the array.

Parameters:
p A pointer to the array of elements to add
num The number of the elements contained in the given array, that this function must add to the array
bOverwrite If TRUE the old elements won't be moved right: they will be deleted and replaced by the new elements
bCopy If TRUE the elements contained in the given array won't be directly inserted inside the array; the function will insert just a copy of the elements (obtained through mcElement::Clone)
pos The entry where the first element of the given array will be inserted, or -1 to insert the elements at the end of the array. Note that if you use -1 for this argument, the bOverwrite argument will be ignored.

Definition at line 479 of file ElementArray.cpp.

References data_CheckArrayLimit(), data_CheckIndex(), data_Delete(), data_GetCount(), mcElementHelpers::data_GetType(), mcElement::data_GetType(), data_isValidElem(), data_MoveElemRight(), data_Set(), mcASSERT, mcMATHLOG, mcTXT, and mdata_nElements.

Referenced by data_AddNewElement(), data_AddNewEmptyBox(), mcPolynomialHelpers::data_AddNewEmptyMonomial(), mcPolynomialHelpers::data_AddNewMonomialContaining(), data_AddNewOp(), data_DeepCopy(), data_Merge(), mcMonomialHelpers::data_TransformDivOp(), mcMonomialHelpers::gui_AddNewElement(), gui_AddNewElement(), mcPolynomialHelpers::gui_BackInput(), mcMonomialHelpers::gui_Replace(), mcMonomialHelpers::gui_ReplaceSymbolsWithFunction(), mcPolynomialHelpers::io_ImportInlinedExpr(), mcMonomialHelpers::io_ImportInlinedExpr(), mcPolynomialHelpers::io_ImportPresentationMathML(), mcMonomialHelpers::io_ImportPresentationMathML(), math_HandleBasicOpRes(), math_HandleExpSimFlag(), mcMonomialHelpers::math_SetCoeff(), mcMonomialHelpers::math_TransformDivOp(), mcPolynomialHelpers::math_WrapMonomial(), and mcMonomialHelpers::math_WrapSimple().

mcElement & mcElementArrayHelpers::data_AddNewElement mcElementType  t,
bool  bOverwrite = FALSE,
int  pos = -1
[virtual]
 

math_Adds a new element to the array and returns a pointer to it.

The new element is initialized with the given string (for more details, see mcElement::Init() function); it is built as a child of this element and it is placed in the n-th entry of this array, eventually overriding the previously present element.

Definition at line 435 of file ElementArray.cpp.

References data_AddElements(), data_Get(), and mcElementHelpers::data_NewElem().

Referenced by mcPolynomialHelpers::gui_Input(), and mcPolynomialHelpers::io_ImportInlinedExpr().

void mcElementArrayHelpers::data_AddNewEmptyBox int  pos = -1  )  [virtual]
 

math_Adds a new mcEmptyBox in the array, at the given position.

Reimplemented in mcPolynomialHelpers.

Definition at line 226 of file ElementArray.cpp.

References data_AddElements(), mcElement::data_AddProperty(), and mcEP_INITIALIZED.

Referenced by mcMonomialHelpers::gui_BackInput(), and mcMonomialHelpers::gui_Replace().

void mcElementArrayHelpers::data_AddNewOp mcElementType  type,
int  pos = -1
[virtual]
 

math_Adds a new operator in the array.

This function is very different from mcElementArray::gui_math_AddNewOp: this function doesn't follow input rules, that is, if you try to add a mcAddOp in a mcMonomialData (this wouldn't be allowed by mcMonomial::gui_math_AddNewOp), no mcASSERTs will fail. Another example is that if you add a new operator at the end of the array, this function won't add any mcEmptyBox (which is the typical behaviour of mcElementGUI functions).

Definition at line 774 of file ElementArray.cpp.

References data_AddElements(), and mcElementHelpers::data_NewElem().

Referenced by mcPolynomialHelpers::data_CreateFirstOp(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::gui_DoSplit(), mcPolynomialHelpers::math_Add(), mcPolynomialHelpers::math_SetSign(), and mcMonomialHelpers::math_TransformDivOp().

virtual mcElement& mcElementArrayHelpers::data_AddNewWrappedElement mcElementType  t,
bool  bOverwrite = FALSE,
int  pos = -1
[inline, virtual]
 

Works like the #math_AddNewElement function but the new element is first wrapped in the appropriate structure: a mcPolynomial will wrap the new element in a mcMonomial while a mcMonomial will just call the #math_AddNewElement function.

Reimplemented in mcPolynomialHelpers.

Definition at line 423 of file ElementArray.h.

void mcElementArrayHelpers::data_AddProperty int  p,
void *  val1 = NULL,
void *  val2 = NULL
[inline, virtual]
 

mcElementArray overloads this function to handle the mcElementArray-specific mcEP_ELEMENTARRAY_FILTER property.

Reimplemented from mcElementHelpers.

Definition at line 343 of file ElementArray.h.

References mcEP_ELEMENTARRAY_FILTER.

void mcElementArrayHelpers::data_ChangeFilter const mcFilter p  ) 
 

Changes the filter associated with this array. See mcFilter.

Definition at line 694 of file ElementArray.cpp.

References mcFilter::DeepCopy(), mcSAFE_DELETE, and mdata_pFilter.

Referenced by data_SetFilter().

void mcElementArrayHelpers::data_CheckArrayLimit  ) 
 

Checks if the array is full; makes room if it is (the space added to the array is mcELEMENTARRAY_DEFAULT_ROOM.

Definition at line 318 of file ElementArray.cpp.

References data_GetCount(), mcELEMENTARRAY_DEFAULT_ROOM, mcEXTEND_ARRAY, mdata_nUpperBound, and mdata_pElemArray.

Referenced by data_AddElements(), and data_MoveElemRight().

void mcElementArrayHelpers::data_CheckIndex int  entry  )  const [inline]
 

Use this as quick array and index check function; it stops the program if the given index is not a valid index for the current array (which must have been already created).

Definition at line 569 of file ElementArray.h.

References mcASSERT.

Referenced by data_AddElements(), data_Delete(), data_Detach(), data_GetOpTypeBetween(), data_isOp(), data_Set(), data_Swap(), mcPolynomialHelpers::math_DataToMathIdx(), mcMonomialHelpers::math_DataToMathIdx(), and math_HandleExpSimFlag().

void mcElementArrayHelpers::data_DeepCopy const mcElementHelpers p  )  [virtual]
 

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.

Reimplemented in mcPolynomialHelpers.

Definition at line 665 of file ElementArray.cpp.

References data_AddElements(), mcElementHelpers::data_DeepCopy(), data_DeleteAll(), data_GetArray(), data_GetCount(), mdata_pElemArray, and mdata_pFilter.

Referenced by mcPolynomialHelpers::data_DeepCopy(), and mcMonomialHelpers::math_WrapMonomial().

bool mcElementArrayHelpers::data_Delete const mcElement elem  )  [virtual]
 

math_Finds the given element among the elements contained directly (that is, without any wrapper: this function is not recursive) and then deletes it from the array.

This function also shifts the array, thus decrementing the element counter. Returns TRUE if everything is okay; FALSE if the given pointer is not an element contained in this array.

Definition at line 242 of file ElementArray.cpp.

References data_Delete(), data_GetIndexOf(), and data_MoveElemLeft().

void mcElementArrayHelpers::data_Delete int  entry  )  [virtual]
 

Mark the requested entry as empty, that is, not containing a valid pointer value to an allocated element.

This function frees the memory used by an eventually pre-existent element in the specified position.

Definition at line 233 of file ElementArray.cpp.

References data_CheckIndex(), and data_SetAsEmptyEntry().

Referenced by data_AddElements(), data_Delete(), data_DeleteAll(), data_DeleteAllElemType(), data_DeleteFirst(), data_DeleteLast(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::data_ReplaceParentheses(), mcMonomialHelpers::data_TransformDivOp(), mcPolynomialHelpers::gui_BackInput(), mcMonomialHelpers::gui_BackInput(), gui_DeleteNextOp(), gui_DeletePreviousOp(), gui_DeleteSelection(), mcMonomialHelpers::gui_ReplaceSymbolsWithFunction(), mcMonomialHelpers::gui_Split(), mcPolynomialHelpers::math_DeleteFirstOp(), mcMonomialHelpers::math_DetachNonCommonFactors(), math_HandleBasicOpRes(), math_HandleExpSimFlag(), math_Remove(), and mcMonomialHelpers::math_RemoveAllOp().

void mcElementArrayHelpers::data_DeleteAll  ) 
 

Deletes all the element in the array and marks all entries as empty; the array of pointers mdata_pElemArray is not deallocated.

Definition at line 337 of file ElementArray.cpp.

References data_Delete(), mdata_nElements, mdata_nUpperBound, and mdata_pElemArray.

Referenced by data_DeepCopy(), mcMonomialHelpers::gui_AddNewElement(), mcPolynomialHelpers::io_ImportInlinedExpr(), mcMonomialHelpers::io_ImportInlinedExpr(), mcPolynomialHelpers::io_ImportPresentationMathML(), mcMonomialHelpers::io_ImportPresentationMathML(), math_EmbedInBracket(), math_EmbedInFraction(), math_EmbedInRadical(), mcMonomialHelpers::math_MultiplyBy(), math_ResetToOne(), math_ResetToZero(), and mcPolynomialHelpers::math_WrapMonomial().

void mcElementArrayHelpers::data_DeleteAllElemType mcElementType   )  [virtual]
 

Deletes all the occurrences of the elements of the given type, shifting the array each time...

Definition at line 268 of file ElementArray.cpp.

References data_Delete(), data_GetElemIndexOfType(), data_GetNumOfElemType(), and data_MoveElemLeft().

void mcElementArrayHelpers::data_DeleteFirst int  num  )  [virtual]
 

Deletes the first num elements decrementing also the element counter.

This function differs from Delete() because it also modifies the mdata_nElements counter.

Definition at line 260 of file ElementArray.cpp.

References data_Delete(), and data_MoveElemLeft().

Referenced by mcPolynomialHelpers::data_DeleteFirstOp().

void mcElementArrayHelpers::data_DeleteLast int  num  )  [virtual]
 

Deletes the last num elements decrementing also the element counter.

This function differs from Delete() because it also modifies the mdata_nElements counter.

Definition at line 252 of file ElementArray.cpp.

References data_Delete(), data_GetCount(), and mdata_nElements.

Referenced by mcMonomialHelpers::data_Repair().

mcElement mcElementArrayHelpers::data_Detach int  n  ) 
 

Detaches (that is, removes from array but doesn't delete) the n-th entry of the array and returns it.

Doesn't modify the mdata_nElements counter, so this function makes an "hole" in the array: BE CAREFUL not to forget to replace it.

Definition at line 280 of file ElementArray.cpp.

References data_CheckIndex(), data_Get(), and data_SetAsEmptyEntry().

Referenced by data_DetachAll(), mcPolynomialHelpers::data_DetachAndShiftMonomial(), data_DetachLastElem(), data_Move(), data_MoveAllElemType(), and mcPolynomialHelpers::math_DistributeBracket().

mcElement mcElementArrayHelpers::data_DetachAll  ) 
 

Detaches all the elements of the array.

VERY IMPORTANT: this could cause a very big memory leak if the detached elements are not deleted by something/someone.

Definition at line 351 of file ElementArray.cpp.

References data_Detach(), mcEmptyElement, mdata_nElements, mdata_nUpperBound, and mdata_pElemArray.

mcElement mcElementArrayHelpers::data_DetachLastElem int  num  ) 
 

Detaches the last num elements decrementing the mdata_nElements counter.

Definition at line 295 of file ElementArray.cpp.

References data_Detach(), data_GetCount(), mcEmptyElement, and mdata_nElements.

Referenced by mcMonomialHelpers::gui_Split().

mcElement& mcElementArrayHelpers::data_Get int  entry  )  [inline]
 

Definition at line 590 of file ElementArray.h.

const mcElement& mcElementArrayHelpers::data_Get int  entry  )  const [inline]
 

Definition at line 587 of file ElementArray.h.

Referenced by data_AddNewElement(), mcPolynomialHelpers::data_AddNewWrappedElement(), data_Detach(), mcPolynomialHelpers::data_DetachAndShiftMonomial(), mcPolynomialHelpers::data_FindMonomialContaining(), data_GetElemIndexOfType(), data_GetIndexOf(), data_GetNumOfElemType(), data_GetOpTypeBetween(), data_GetOpTypePreceding(), mcPolynomialHelpers::data_GetWrapped(), data_GetWrapped(), data_isOp(), mcPolynomialHelpers::data_isWrappingOnly(), data_isWrappingOnly(), data_QueueElemType(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::data_ReplaceParentheses(), data_ScanArray(), data_Swap(), mcMonomialHelpers::data_TransformDivOp(), data_UpdateNeighbor(), mcPolynomialHelpers::gui_BackInput(), mcMonomialHelpers::gui_BackInput(), gui_CalcSizeOfRange(), mcPolynomialHelpers::gui_CheckCursorPos(), gui_DeleteSelection(), mcPolynomialHelpers::gui_DoSplit(), mcMonomialHelpers::gui_DoSplit(), gui_ExDraw(), gui_ExGetRelCursorPos(), gui_ExMoveCursorUsingPoint(), mcPolynomialHelpers::gui_ExOnSelect(), gui_ExOnSelect(), gui_GetActiveElemIndex(), gui_GetBB(), gui_GetCenterLine(), gui_GetCursorPos(), gui_GetOriginOfElem(), gui_GetSelectionRect(), gui_Input(), mcPolynomialHelpers::gui_Insert(), mcMonomialHelpers::gui_Insert(), gui_isEndKey(), gui_MoveCursor(), gui_MoveCursorLeft(), gui_MoveCursorRight(), mcPolynomialHelpers::gui_ReplaceBracket(), mcMonomialHelpers::gui_ScanArrayForFunctions(), gui_SetCursorPos(), mcMonomialHelpers::gui_Split(), gui_UpdateExpDepth(), mcPolynomialHelpers::io_GetInlinedExpr(), io_GetInlinedExpr(), mcPolynomialHelpers::io_GetMathML(), mcMonomialHelpers::io_GetMathML(), mcMonomialHelpers::io_ImportPresentationMathML(), mcMonomialHelpers::math_CanBeAddedWith(), mcPolynomialHelpers::math_DeleteFirstOp(), mcMonomialHelpers::math_DetachNonCommonFactors(), mcPolynomialHelpers::math_DistributeBracket(), math_Evaluate(), mcMonomialHelpers::math_GetCoeff(), math_GetMathType(), mcPolynomialHelpers::math_GetSign(), mcPolynomialHelpers::math_HandleExpSimFlag(), math_isWrappingOnly(), mcMonomialHelpers::math_MultiplyBy(), math_Remove(), mcMonomialHelpers::math_RemoveCoeff(), mcMonomialHelpers::math_SetCoeff(), mcMonomialHelpers::math_SimplifyCoeff(), math_SimplifyRemoveNeutrals(), and mcMonomialHelpers::math_TransformDivOp().

mcElement* mcElementArrayHelpers::data_GetArray int  n = 0  )  const [inline]
 

Returns a pointer to the memory address where the pointer to the n-th element is stored.

Use with care.

Definition at line 608 of file ElementArray.h.

Referenced by data_DeepCopy(), mcPolynomialHelpers::data_ReplaceParentheses(), mcMonomialHelpers::data_TransformDivOp(), mcMonomialHelpers::gui_ScanArrayForFunctions(), mcMonomialHelpers::gui_Split(), mcMonomialHelpers::math_DetachNonCommonFactors(), mcPolynomialHelpers::math_Reorder(), and mcMonomialHelpers::math_Reorder().

int mcElementArrayHelpers::data_GetAvailableEntryCount  )  const [inline]
 

Returns the number of the entries in the array (the array automatically grows if needed).

Definition at line 634 of file ElementArray.h.

int mcElementArrayHelpers::data_GetChildrenCount  )  const [inline, virtual]
 

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 348 of file ElementArray.h.

References mcElementHelpers::data_GetChildrenCount().

const mcElement& mcElementArrayHelpers::data_GetConst int  entry  )  const [inline]
 

Returns a pointer to the element placed at the entry-th position in the array; it's better to use this function rather than accessing directly the array because this function (in debug mode), ensure some data checks.

If n is too high, an mcASSERT will fail; use #GetCount() to avoid it.

Warning:
This function can return an invalid pointer value if the requested element is an empty box or an empty entry (see ARR_EMPTYBOX and mcELEMENTARRAY_EMPTYENTRY).

Definition at line 582 of file ElementArray.h.

Referenced by mcPolynomialHelpers::gui_ReplaceBracket().

const mcElement& mcElementArrayHelpers::data_GetConstChild int  n  )  const [inline, virtual]
 

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));
     }

Parameters:
n The n-th child of this object.

Reimplemented from mcElementHelpers.

Definition at line 352 of file ElementArray.h.

References mcRETURN_ELEMENT_CHILD.

int mcElementArrayHelpers::data_GetCount  )  const [inline]
 

Returns the number of the elements stored in the mcPolynomial (takes in count also empty boxes).

Definition at line 628 of file ElementArray.h.

Referenced by data_AddElements(), mcPolynomialHelpers::data_AddNewEmptyMonomial(), data_CheckArrayLimit(), data_DeepCopy(), data_DeleteLast(), data_DetachLastElem(), mcPolynomialHelpers::data_FindMonomialContaining(), data_GetIndexOf(), mcPolynomialHelpers::data_isWrappingOnly(), data_isWrappingOnly(), data_MoveElemLeft(), data_QueueElemType(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::data_ReplaceParentheses(), data_ScanArray(), mcMonomialHelpers::data_TransformDivOp(), data_UpdateNeighbor(), mcPolynomialHelpers::gui_AddNewElement(), mcMonomialHelpers::gui_AddNewElement(), gui_AddNewElement(), mcPolynomialHelpers::gui_AddNewEmptyMonomial(), mcPolynomialHelpers::gui_BackInput(), mcMonomialHelpers::gui_BackInput(), mcPolynomialHelpers::gui_CheckCursorPos(), mcMonomialHelpers::gui_CheckCursorPos(), gui_DeleteNextOp(), gui_DoRecalcSize(), gui_DrawSelection(), gui_ExDraw(), gui_ExGetRelCursorPos(), gui_ExMoveCursorUsingPoint(), gui_ExOnSelect(), gui_GetActiveElemIndex(), gui_GetCenterLine(), gui_GetCursorPos(), mcPolynomialHelpers::gui_Input(), gui_Input(), mcPolynomialHelpers::gui_isArrayEmpty(), gui_isEndKey(), gui_MoveCursor(), gui_MoveCursorRight(), mcPolynomialHelpers::gui_ReplaceBracket(), mcMonomialHelpers::gui_ScanArrayForFunctions(), gui_SetCursorPos(), mcMonomialHelpers::gui_Split(), gui_UpdateExpDepth(), mcPolynomialHelpers::io_GetInlinedExpr(), io_GetInlinedExpr(), mcPolynomialHelpers::io_GetMathML(), mcMonomialHelpers::io_GetMathML(), mcMonomialHelpers::io_ImportPresentationMathML(), mcMonomialHelpers::math_DetachNonCommonFactors(), mcPolynomialHelpers::math_EmbedInBracket(), mcPolynomialHelpers::math_FactoreOut(), mcMonomialHelpers::math_GetCoeff(), mcMonomialHelpers::math_GetMaxDegreeForSymbolArray(), mcMonomialHelpers::math_RemoveAllOp(), mcPolynomialHelpers::math_Reorder(), mcMonomialHelpers::math_Reorder(), mcMonomialHelpers::math_SetCoeff(), math_SimplifyRemoveNeutrals(), and mcMonomialHelpers::math_TransformDivOp().

const mcElement& mcElementArrayHelpers::data_GetElemAtLeftOf const mcElement p  )  const [inline]
 

Returns the element preceding the given pointer; this pointer must be a pointer to one element of the array of this class.

If the given pointer is not valid, not a child of this class, or the previous element doesn't exist, returns NULL.

Definition at line 691 of file ElementArray.h.

References mcEmptyElement.

const mcElement& mcElementArrayHelpers::data_GetElemAtRightOf const mcElement p  )  const [inline]
 

Returns a the element following the given pointer; this pointer must be a pointer to one element of the array of this class.

If the given pointer is not valid, not a child of this class, or the following element doesn't exist, returns NULL.

Definition at line 700 of file ElementArray.h.

References mcEmptyElement.

int mcElementArrayHelpers::data_GetElemIndexOfType int  n,
mcElementType  t
const
 

Returns the index of the n-th occurrence of the element of type == t.

Parameters:
n The occurrence of the element of type t to return
t The type of the element to find

Definition at line 587 of file ElementArray.cpp.

References data_Get(), mcElementHelpers::data_GetType(), and SCAN_ARRAY_SEARCHING.

Referenced by data_DeleteAllElemType(), data_GetElemOfType(), data_MoveAllElemType(), and mcMonomialHelpers::math_SimplifyCoeff().

mcElement & mcElementArrayHelpers::data_GetElemOfType int  n,
mcElementType  t
const
 

Returns a pointer to the n-th occurrence of the element of type == t.

Parameters:
n The occurrence of the element of type t to return
t The type of the elementsto find (-1 if the element to find has no subtype ID because it's derived directly from mcElement or mcExpElement)

Definition at line 613 of file ElementArray.cpp.

References data_GetElemIndexOfType(), and RETURN_ELEM_FROM_INDEX.

Referenced by mcPolynomialHelpers::data_GetWrapped(), and mcPolynomialHelpers::io_ImportInlinedExpr().

const mcFilter* mcElementArrayHelpers::data_GetFilter  )  const [inline]
 

The CONST version of the data_GetFilter.

Definition at line 805 of file ElementArray.h.

mcFilter* mcElementArrayHelpers::data_GetFilter  )  [inline]
 

Returns the filter attached to this array; NULL if there are no filters set for this object.

Definition at line 802 of file ElementArray.h.

virtual int mcElementArrayHelpers::data_GetIdxFromEntry const mcArrayEntry p  )  const [protected, pure virtual]
 

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by mcArrayEntry::data_GetIdx().

int mcElementArrayHelpers::data_GetIndex int  id  )  const [inline]
 

Returns the index of the element with the given ID; -1 if no elements with the given ID are stored in this expression.

Warning:
This function will check only the elements in this array: it won't do any recursive search. If you need to find an element nested in the array, use the data_GetElemFromID() function.
Parameters:
id The ID of the element to search

Definition at line 619 of file ElementArray.h.

int mcElementArrayHelpers::data_GetIndexOf const mcElement p  )  const
 

Returns the index of the entry in the array which points to the given element.

Returns -1 if the given pointer does not points to an element in the array.

Definition at line 395 of file ElementArray.cpp.

References data_Get(), and data_GetCount().

Referenced by data_Delete(), and mcPolynomialHelpers::data_FindMonomialContaining().

mcElement& mcElementArrayHelpers::data_GetLast  )  [inline]
 

Definition at line 603 of file ElementArray.h.

const mcElement& mcElementArrayHelpers::data_GetLast  )  const [inline]
 

Returns a pointer to the last element of the array.

Definition at line 600 of file ElementArray.h.

Referenced by mcMonomialHelpers::gui_MergeWith().

mcElement & mcElementArrayHelpers::data_GetNonOpElem int  n  )  const
 

Returns a pointer to the n-th occurrence of a non mcOperator-derived class.

Parameters:
n The occurrence of the non-operator element to return

Definition at line 618 of file ElementArray.cpp.

References data_GetNonOpElemIndex(), and RETURN_ELEM_FROM_INDEX.

int mcElementArrayHelpers::data_GetNonOpElemIndex int  n  )  const
 

Returns the index of the n-th occurrence of a non mcOperator-derived class.

Parameters:
n The occurrence of the non-operator element to return

Definition at line 592 of file ElementArray.cpp.

References data_isOp(), and SCAN_ARRAY_SEARCHING.

Referenced by data_GetNonOpElem(), and mcMonomialHelpers::math_MathToDataIdx().

int mcElementArrayHelpers::data_GetNumOfElemType mcElementType  t  )  const
 

Returns the number of the elements of type == t.

Parameters:
t The type of the element to find

Definition at line 555 of file ElementArray.cpp.

References data_Get(), mcElementHelpers::data_GetType(), and SCAN_ARRAY_COUNTING.

Referenced by data_DeleteAllElemType(), data_isElementAllowed(), data_MoveAllElemType(), mcPolynomialHelpers::io_ImportInlinedExpr(), mcMonomialHelpers::math_GetCoeff(), mcMonomialHelpers::math_Reorder(), and mcMonomialHelpers::math_SimplifyCoeff().

mcOperator & mcElementArrayHelpers::data_GetOp int  n  )  const
 

Returns a pointer to the n-th operator in the array.

See the note of #GetOpIndex for more info. If n is too high, an mcASSERT will fail; use #GetOpCount() to avoid it.

Definition at line 623 of file ElementArray.cpp.

References data_GetOpIndex(), and RETURN_ELEM_FROM_INDEX.

int mcElementArrayHelpers::data_GetOpCount  )  const
 

Returns the number of the operators stored in the mcPolynomial.

Definition at line 560 of file ElementArray.cpp.

References data_isOp(), and SCAN_ARRAY_COUNTING.

int mcElementArrayHelpers::data_GetOpIndex int  n  )  const
 

Returns the index of the n-th operator in the array.

Note:
This function differs from Get() because the argument is not an index of the array; it must be the zero-based index of the operators in the array; for example, in the expression 12+34*567, if you want to get a pointer to the '*' operator, use GetOp(2) because the '*' operator is the second in the array. If n is too high, an mcASSERT will fail; use #GetOpCount() to avoid it.

Definition at line 597 of file ElementArray.cpp.

References data_isOp(), and SCAN_ARRAY_SEARCHING.

Referenced by data_GetOp().

mcOperator& mcElementArrayHelpers::data_GetOpPreceding int  n  )  const [inline]
 

Definition at line 684 of file ElementArray.h.

mcElementType mcElementArrayHelpers::data_GetOpTypeBetween int  n1,
int  n2
const
 

Returns the element type of the operator between...

Definition at line 726 of file ElementArray.cpp.

References data_CheckIndex(), data_Get(), mcElement::data_GetType(), math_GetNeutralOpType(), mcASSERT, and mcSWAP.

mcElementType mcElementArrayHelpers::data_GetOpTypePreceding int  n  )  const
 

Returns the operator type preceding the n-th element.

Definition at line 755 of file ElementArray.cpp.

References data_Get(), mcElement::data_GetType(), data_isOp(), math_GetNeutralOpType(), and mcASSERT.

virtual mcElement& mcElementArrayHelpers::data_GetRefFromEntry const mcArrayEntry p  )  [protected, pure virtual]
 

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

const mcElement & mcElementArrayHelpers::data_GetWrapped mcElementType  t  )  const [virtual]
 

Returns the element of type t wrapped by this element, if it does exist and it is the only element wrapped by this array; returns NULL otherwise.

Reimplemented in mcPolynomialHelpers.

Definition at line 219 of file ElementArray.cpp.

References data_Get(), data_isWrappingOnly(), and mcEmptyElement.

Referenced by mcMonomialHelpers::math_MultiplyBy().

bool mcElementArrayHelpers::data_isAddSubOp int  entry  )  const [inline]
 

Returns TRUE if the specified entry is an operator.

Definition at line 733 of file ElementArray.h.

References mcET_ADDOP, and mcET_SUBOP.

Referenced by mcPolynomialHelpers::math_DistributeBracket(), and mcPolynomialHelpers::math_GetSign().

bool mcElementArrayHelpers::data_isArrayEmpty  )  const [inline]
 

Returns TRUE if the array is empty or non allocated.

Definition at line 747 of file ElementArray.h.

Referenced by mcPolynomialHelpers::data_CreateFirstOp(), mcPolynomialHelpers::data_DeleteFirstOp(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::gui_BackInput(), mcPolynomialHelpers::gui_CheckCursorPos(), mcPolynomialHelpers::gui_isArrayEmpty(), gui_SetCursorPos(), mcPolynomialHelpers::io_ImportInlinedExpr(), mcPolynomialHelpers::math_DeleteFirstOp(), mcPolynomialHelpers::math_DivideBy(), math_Evaluate(), math_GetMathType(), mcPolynomialHelpers::math_MultiplyBy(), and math_Remove().

bool mcElementArrayHelpers::data_isElementAllowed mcElementType  type  )  const
 

Returns TRUE if the given type of element can be created.

Consults the current filter to give the result.

Definition at line 711 of file ElementArray.cpp.

References data_GetNumOfElemType(), mcFilter::isElementTypeAllowed(), and mdata_pFilter.

Referenced by gui_Input(), and mcMonomialHelpers::gui_Replace().

bool mcElementArrayHelpers::data_isEmptyBox int  entry  )  const [inline]
 

Returns TRUE if the specified entry is an empty box; an empty box can be placed anywhere in the array before the end.

Definition at line 720 of file ElementArray.h.

References mcET_EMPTYBOX.

bool mcElementArrayHelpers::data_isEmptyEntry int  entry  )  const [inline]
 

Returns TRUE if the specified entry is an empty entry; empty entries can be placed only at the end of the array.

Definition at line 727 of file ElementArray.h.

References mcEmptyElement.

Referenced by mcPolynomialHelpers::gui_CheckCursorPos().

bool mcElementArrayHelpers::data_isMultDivOp int  entry  )  const [inline]
 

Returns TRUE if the specified entry is an operator.

Definition at line 740 of file ElementArray.h.

References mcET_DIVOP, and mcET_MULTOP.

bool mcElementArrayHelpers::data_isOp int  entry  )  const
 

Returns TRUE if the specified entry is an operator.

Definition at line 768 of file ElementArray.cpp.

References data_CheckIndex(), data_Get(), mcElementHelpers::data_GetType(), and mcOperatorHelpers::data_isOp().

Referenced by mcPolynomialHelpers::data_CreateFirstOp(), mcPolynomialHelpers::data_DeleteFirstOp(), mcPolynomialHelpers::data_DetachAndShiftMonomial(), data_GetNonOpElemIndex(), data_GetOpCount(), data_GetOpIndex(), data_GetOpTypePreceding(), data_Move(), data_MoveAllElemType(), mcMonomialHelpers::data_Repair(), mcMonomialHelpers::data_TransformDivOp(), mcPolynomialHelpers::gui_AddNewElement(), mcMonomialHelpers::gui_AddNewElement(), mcPolynomialHelpers::gui_BackInput(), mcMonomialHelpers::gui_BackInput(), mcPolynomialHelpers::gui_CheckCursorPos(), mcMonomialHelpers::gui_CheckCursorPos(), gui_DeleteNextOp(), gui_DeletePreviousOp(), gui_ExMoveCursorUsingPoint(), mcPolynomialHelpers::gui_ExOnSelect(), gui_ExOnSelect(), gui_GetCursorPos(), mcPolynomialHelpers::gui_Input(), mcPolynomialHelpers::gui_isArrayEmpty(), gui_MoveCursor(), gui_SetCursorPos(), mcMonomialHelpers::io_GetMathML(), mcPolynomialHelpers::math_DataToMathIdx(), mcMonomialHelpers::math_DataToMathIdx(), mcPolynomialHelpers::math_DeleteFirstOp(), math_Evaluate(), math_HandleBasicOpRes(), mcPolynomialHelpers::math_MathToDataIdx(), math_Remove(), mcMonomialHelpers::math_RemoveAllOp(), mcPolynomialHelpers::math_SetSign(), and mcMonomialHelpers::math_SimplifyCoeff().

bool mcElementArrayHelpers::data_isSameAs const mcElementHelpers p  )  const [virtual]
 

Checks all the children.

Reimplemented from mcElementHelpers.

Definition at line 191 of file ElementArray.cpp.

References mdata_nElements.

bool mcElementArrayHelpers::data_isUsingFilter  )  const [inline]
 

Returns TRUE if this class is using a filter.

Definition at line 808 of file ElementArray.h.

bool mcElementArrayHelpers::data_isValidElem int  entry  )  const [inline]
 

Returns TRUE if the specified entry is valid.

Definition at line 760 of file ElementArray.h.

static bool mcElementArrayHelpers::data_isValidElem const mcElement p  )  [inline, static]
 

Checks if the given pointer is valid (it's not an empty box or an empty entry).

This function can be used without allocating any mcElementArray: it's a static function.

Definition at line 755 of file ElementArray.h.

References mcEmptyElement.

Referenced by data_AddElements(), data_UpdateNeighbor(), mcPolynomialHelpers::gui_CheckCursorPos(), and mcMonomialHelpers::gui_Replace().

bool mcElementArrayHelpers::data_isWrappingOnly mcElementType  t  )  const [virtual]
 

Returns TRUE if this array is containing only an element of the given type.

Reimplemented in mcPolynomialHelpers.

Definition at line 208 of file ElementArray.cpp.

References data_Get(), data_GetCount(), and mcElementHelpers::data_GetType().

Referenced by data_GetWrapped().

void mcElementArrayHelpers::data_Merge const mcElementArray p,
int  n = 0,
bool  bAddToEnd = TRUE
 

Merges the given array with this one, deep-copying the content and adding the new elements at the end of this array.

Parameters:
p The array to merge with this one.
n The number of elements (starting from the first of 'p') that should not be merged in this array
bAddToEnd If TRUE the given array is added to the end of this element, otherwise it is added to the begin.

Definition at line 426 of file ElementArray.cpp.

References data_AddElements().

Referenced by mcMonomialHelpers::gui_MergeWith(), mcPolynomialHelpers::gui_ReplaceBracket(), mcPolynomialHelpers::math_Add(), and mcMonomialHelpers::math_MultiplyBy().

void mcElementArrayHelpers::data_Move int  n,
int  k
 

Moves the n-th element of the array (and its preceding operator) to the position k.

VERY IMPORTANT: with mcMonomial you can use this function only when all mcDivOp have been removed.

Definition at line 780 of file ElementArray.cpp.

References data_Detach(), data_isOp(), data_MoveElemLeft(), data_MoveElemRight(), data_Set(), and mcASSERT.

int mcElementArrayHelpers::data_MoveAllElemType mcElementType  t,
mcElementArray m
 

Moves all the elements of type t from *this to the given array m (which must be of compatible with elements of type t !!).

Returns:
The number of elements which have been moved. VERY IMPORTANT: with mcMonomial you can use this function only when all mcDivOp have been removed.

Definition at line 811 of file ElementArray.cpp.

References data_Detach(), data_GetElemIndexOfType(), data_GetNumOfElemType(), data_isOp(), and data_MoveElemLeft().

void mcElementArrayHelpers::data_MoveElemLeft int  start  ) 
 

Shifts elements in the array one position on the left (mdata_pElemArray[start] will be replaced by the element on his right and so on) and subtracts one unit to the elements counter (array is shrinked).

Warning:
The mdata_pElemArray[start] entry will be overwritten but the content of that entry won't be deleted; to avoid memory leaks, delete the element located in the start entry and then call this function. A call to #DeleteElement cannot be inserted in this function because sometimes MoveElemLeft is called on dirty entries...

Definition at line 382 of file ElementArray.cpp.

References data_GetCount(), data_SetAsEmptyEntry(), mdata_nElements, and mdata_pElemArray.

Referenced by data_Delete(), data_DeleteAllElemType(), data_DeleteFirst(), mcPolynomialHelpers::data_DetachAndShiftMonomial(), data_Move(), data_MoveAllElemType(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::data_ReplaceParentheses(), mcMonomialHelpers::data_TransformDivOp(), mcPolynomialHelpers::gui_BackInput(), mcMonomialHelpers::gui_BackInput(), gui_DeleteNextOp(), gui_DeletePreviousOp(), gui_DeleteSelection(), mcMonomialHelpers::gui_ReplaceSymbolsWithFunction(), mcMonomialHelpers::gui_Split(), mcPolynomialHelpers::math_DeleteFirstOp(), mcMonomialHelpers::math_DetachNonCommonFactors(), mcPolynomialHelpers::math_DistributeBracket(), math_HandleExpSimFlag(), math_Remove(), and mcMonomialHelpers::math_RemoveAllOp().

void mcElementArrayHelpers::data_MoveElemRight int  start  ) 
 

Shifts elements in the array one position on the right (mdata_pElemArray[start] will be shifted right with all the following elements) and adds one unit from the elements counter (array grows).

Definition at line 368 of file ElementArray.cpp.

References data_CheckArrayLimit(), data_SetAsEmptyEntry(), mdata_nElements, and mdata_pElemArray.

Referenced by data_AddElements(), mcPolynomialHelpers::data_CreateFirstOp(), data_Move(), mcMonomialHelpers::data_Repair(), mcPolynomialHelpers::gui_AddNewElement(), mcMonomialHelpers::gui_AddNewElement(), mcPolynomialHelpers::gui_BackInput(), mcPolynomialHelpers::gui_DoSplit(), mcMonomialHelpers::gui_DoSplit(), gui_Input(), mcPolynomialHelpers::math_DistributeBracket(), math_HandleBasicOpRes(), math_Remove(), and mcPolynomialHelpers::math_SetSign().

int mcElementArrayHelpers::data_QueueElemType mcElementType  t,
int  firstpos
 

Places the elements of the given type and subtype in the firstpos entry and following (swapping the element previously placed in the entries where the sequence of the t elements is created).

Parameters:
t The class ID of the elements to queue.
subt The subtype or subclass ID of the elements to queue or -1 if the elements to queue have not a subtype ID.
firstpos The first entry where the first element to queue will be placed; all the following elements are placed in the following entries, swapping the array if necessary.
Returns:
The number of entry this function has processed.

Definition at line 629 of file ElementArray.cpp.

References data_Get(), data_GetCount(), mcElementHelpers::data_GetType(), and data_Swap().

virtual void mcElementArrayHelpers::data_Repair  )  [inline, virtual]
 

Repairs the array, solving those problems which derive *not* from logic programming errors but from some assumptions taken in the algorithms.

The default implementation does nothing.

Reimplemented in mcMonomialHelpers.

Definition at line 547 of file ElementArray.h.

Referenced by math_Simplify().

bool mcElementArrayHelpers::data_ScanArray bool(*)(const mcElement &)  func,
bool  odd
const [virtual]
 

Checks that in this array, all the even (or odd) elements are okay.

Parameters:
func The function which is called with the even (or odd) elements of the array which must be checked.
odd If TRUE, the function check the odd elements of the array; otherwise it checks the even elements.

Definition at line 309 of file ElementArray.cpp.

References data_Get(), and data_GetCount().

void mcElementArrayHelpers::data_Set int  i,
const mcElement value
 

Sets the i-th entry with the given value.

Be careful: this function does not free any memory used by the i-th element (eventually) present before the call to this function.

Definition at line 445 of file ElementArray.cpp.

References data_CheckIndex(), mcEP_NOTIFY_NEIGHBOR_CHANGE, and mdata_pElemArray.

Referenced by data_AddElements(), data_Move(), mcPolynomialHelpers::gui_DoSplit(), mcMonomialHelpers::gui_DoSplit(), mcPolynomialHelpers::math_DistributeBracket(), and math_Remove().

void mcElementArrayHelpers::data_SetAsEmptyEntry int  entry  )  [inline]
 

Marks the given entry as empty but this function doesn't delete the eventually pre-existent element.

If you specify an entry containing a valid pointer, the memory address of that element will be lost and the element will never be allocated: be careful !!!! If you want to set as empty an entry where an allocated element is currently placed, use DeleteElement() function.

Definition at line 784 of file ElementArray.h.

References mcEmptyElement.

Referenced by data_Delete(), data_Detach(), data_MoveElemLeft(), and data_MoveElemRight().

void mcElementArrayHelpers::data_SetChild int  n,
const mcElement newchild
[inline, virtual]
 

math_Replaces the idx-th child of this element with a copy of the given one.

Reimplemented from mcElementHelpers.

Definition at line 357 of file ElementArray.h.

References mcSET_ELEMENT_CHILD.

void mcElementArrayHelpers::data_SetFilter const mcFilter p  ) 
 

(Re)sets the filter attached to this object.

If p is NULL, then filter is disabled (as default).

Definition at line 685 of file ElementArray.cpp.

References data_ChangeFilter(), and data_UpdateFilterFor().

void mcElementArrayHelpers::data_Swap int  index1,
int  index2
 

Swaps the element placed in index1 with the element placed in index2.

Parameters:
index1 The index of the first element to swap.
index2 The index of the second element to swap.

Definition at line 406 of file ElementArray.cpp.

References data_CheckIndex(), data_Get(), and mdata_pElemArray.

Referenced by data_QueueElemType().

void mcElementArrayHelpers::data_UpdateFilterFor mcElement p,
const mcFilter f
 

Updates the filter of the given element setting it to f.

Definition at line 704 of file ElementArray.cpp.

References mcEP_ELEMENTARRAY_FILTER, mcET_MONOMIAL, and mcET_POLYNOMIAL.

Referenced by data_SetFilter().

void mcElementArrayHelpers::data_UpdateNeighbor int  n  )  [virtual]
 

Checks if the neighbors of the element n have the mcEP_NOTIFY_NEIGHBOR_CHANGE property set; if they have this function calls the mcElement::data_OnNeighborChange function of the neighbors of the element n.

Definition at line 417 of file ElementArray.cpp.

References data_Get(), data_GetCount(), mcElementHelpers::data_hasProperty(), data_isValidElem(), and mcEP_NOTIFY_NEIGHBOR_CHANGE.

int mcElementArrayHelpers::gui_AddNewElement mcElementType  type,
const mcKey key,
int  pos = -1
[virtual]
 

Creates a new element of the type & subtype, sends it the given start key and adds it to the array in the specified position.

Parameters:
type The class ID of the new element to add
subtype The subclass ID of the new element to add
key The first key the new element will receive
pos The position of the new element; the element (eventually) present in the pos-th entry of the array is deleted and then replaced by this new element. Use -1 to add the new element at the end of the array.
Returns:
The index of the new element in the array (this can be different from the given 'pos' variable).

Reimplemented in mcMonomialHelpers, and mcPolynomialHelpers.

Definition at line 883 of file ElementArray.cpp.

References data_AddElements(), data_GetCount(), mcElementHelpers::data_NewElem(), and mcElement::gui_Input().

Referenced by mcPolynomialHelpers::gui_AddNewElement(), mcMonomialHelpers::gui_AddNewElement(), gui_AddNewEmptyBox(), gui_AddNewOp(), and gui_Input().

void mcElementArrayHelpers::gui_AddNewEmptyBox int  pos = -1  ) 
 

Just to make easier the empty box creation.

The eventually pre-existent element at the given position is deleted. This function just calls math_AddNewElement with some fixed arguments.

Definition at line 904 of file ElementArray.cpp.

References gui_AddNewElement(), and mcET_EMPTYBOX.

Referenced by mcMonomialHelpers::gui_AddNewElement().

void mcElementArrayHelpers::gui_AddNewOp mcElementType  nOpType,
int  pos = -1
 

math_Adds a new operator of the specified type at the specified position.

Parameters:
nOpType One of the OP_*** flags
pos The position of the operator to add

Definition at line 1847 of file ElementArray.cpp.

References gui_AddNewElement().

virtual mcInputRes mcElementArrayHelpers::gui_BackInput const mcKey key,
mcElement pnewelem,
int  n
[pure virtual]
 

Replies to the return flag of the gui_Input() function of the subelement called by the mcElementArray::gui_Input() function.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by gui_Input().

wxSize mcElementArrayHelpers::gui_CalcSizeOfFirst int  n,
int  cl = -1
const [virtual]
 

Returns the size of the first n elements in the array.

Use gui_GetSize to get the size of the entire monomial.

Parameters:
n The index of the last element whose sie must be added to the size of the previous elements
cl The center line used to draw the array on the given DC (or -1)

Definition at line 970 of file ElementArray.cpp.

References gui_CalcSizeOfRange(), and gui_GetCenterLine().

Referenced by gui_DoRecalcSize(), gui_ExDraw(), gui_ExGetRelCursorPos(), gui_GetOriginOfElem(), and gui_GetSelectionRect().

wxSize mcElementArrayHelpers::gui_CalcSizeOfRange int  begin,
int  end,
int  cl = -1
const [virtual]
 

Returns the size of the bouding box of the given range of elements.

When begin = 0 and end = GetCount(), this function returns the size of the entire element.

Parameters:
begin The index of the first element of the range
end The index of the last element of the range
cl The center line used to draw the array on the given DC (or -1)
sb The space to leave between two elements

Definition at line 945 of file ElementArray.cpp.

References data_Get(), gui_GetCenterLine(), mcElement::gui_GetHeight(), gui_GetSpaceBetween(), mcElement::gui_GetWidth(), mcElement::gui_GetYAnchor(), and mcMAX.

Referenced by gui_CalcSizeOfFirst(), and gui_GetSelectionRect().

virtual void mcElementArrayHelpers::gui_CheckCursorPos  )  const [pure virtual]
 

Checks that the cursor is in the right position; this function is called in critical points of the most complex mcElementArrayGUI routines to be sure that wrong cursor positions are immediately catched.

If one of the checks fails, this function should stop program execution.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by gui_ExGetRelCursorPos(), gui_ExMoveCursorUsingPoint(), gui_Input(), and gui_MoveCursor().

void mcElementArrayHelpers::gui_DeleteNextOp  ) 
 

Deletes the operator which follows the currently focused element.

Definition at line 910 of file ElementArray.cpp.

References data_Delete(), data_GetCount(), data_isOp(), data_MoveElemLeft(), and mgui_nCursorPos.

Referenced by mcMonomialHelpers::gui_BackInput().

void mcElementArrayHelpers::gui_DeletePreviousOp  ) 
 

Deletes the operator which precedes the currently focused element.

Definition at line 920 of file ElementArray.cpp.

References data_Delete(), data_isOp(), data_MoveElemLeft(), and mgui_nCursorPos.

Referenced by mcMonomialHelpers::gui_BackInput().

void mcElementArrayHelpers::gui_DeleteSelection  )  [virtual]
 

Deletes all the selected elements of the array.

Reimplemented from mcElementHelpers.

Definition at line 1188 of file ElementArray.cpp.

References data_Delete(), data_Get(), data_MoveElemLeft(), mcElement::gui_DeleteSelection(), gui_GetSelElem(), gui_GetSelEnd(), gui_GetSelStart(), mcElementHelpers::gui_isAllSelected(), mcElement::gui_isAllSelected(), mcElementHelpers::gui_RecalcSize(), and mcASSERT.

Referenced by mcMathMngHelpers::gui_MoveSel(), and mcPolynomialHelpers::math_DeleteSelection().

void mcElementArrayHelpers::gui_DoRecalcSize  )  [virtual]
 

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.

Note:
It's very important, to maintain the size member updated, to call, in the other mcElement functions, gui_RecalcSize() every time size could have changed (for example, in gui_Input(), mcElementData setters...).

Implements mcElementHelpers.

Definition at line 1233 of file ElementArray.cpp.

References data_GetCount(), and gui_CalcSizeOfFirst().

virtual void mcElementArrayHelpers::gui_DoSplit mcElementType  type,
const mcKey ev
[pure virtual]
 

gui_Splits the currently focused elements in two parts, inserting a new element of the given type and subtype between those two parts

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by gui_Input().

int mcElementArrayHelpers::gui_Draw wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt
const [inline, virtual]
 

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.

Returns:
The ID of the element marked as active (the element which is drawn with mcElementHelpers::sgui_m_pActivationBrush as background), or mcDRW_NOACTIVEELEM flag if this element does not contain the mouse cursor.

Implements mcElementHelpers.

Reimplemented in mcMonomialHelpers, and mcPolynomialHelpers.

Definition at line 1037 of file ElementArray.h.

int mcElementArrayHelpers::gui_DrawSelectedElements wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt,
int  cl = -1
const [virtual]
 

gui_Draws only the selected elements contained in the array.

You should call this function with the same coordinates you gave to the gui_Draw() function (e.g.: if the first two elements of the array are not selected (while the third and fourth are), then, this function will draw the third and fourth elements beginning at x+CalcSizeOfRange(0, 3)). This function doesn't draw anything except selected elements; if you want to draw also the selection rectangle, use gui_DrawSelection().

Parameters:
dc The DC where the function will draw
x The x-coord where the first element will be drawn
y The y-coord where the first element will be drawn
pt The mouse cursor position or a mcDRW_*** flag
cl The center line to use to draw the elements or -1 to let the function calculate it

Definition at line 1009 of file ElementArray.cpp.

References gui_ExDraw(), gui_GetSelEnd(), and gui_GetSelStart().

Referenced by gui_DrawSelection().

int mcElementArrayHelpers::gui_DrawSelection wxDC &  hDC,
int  x,
int  y,
long  flags,
const wxPoint &  pt,
int  cl = -1
const [virtual]
 

rectangle, mcDRW_NOACTIVEELEM otherwise: please note that this function could return mcDRW_NOACTIVEELEM even if an active element is present (but not inside the selection rectangle).

Definition at line 1020 of file ElementArray.cpp.

References data_GetCount(), mcMathCore::Get(), gui_DrawSelectedElements(), gui_GetCenterLine(), gui_GetSelectionRect(), gui_GetSelElem(), gui_GetSelElemCount(), mcElement::gui_isAllSelected(), mcElementHelpers::gui_isAllSelected(), mcDRW_ALLACTIVE, mcDRW_ALLOW_TOTAL_SELECTION, mcDRW_NOACTIVEELEM, mcDRW_ONSELECTION, mcDRW_USEPOINT, mcGUILOG, mcTXTTHIS, sgui_bDrawSelectionInverting, and sgui_pSelectionPen.

Referenced by mcMonomialHelpers::gui_Draw(), and mcPolynomialHelpers::gui_ExDraw().

int mcElementArrayHelpers::gui_ExDraw wxDC &  dc,
int  x,
int  y,
long  flags,
const wxPoint &  pt,
int  cl = -1,
int  begin = 0,
int  end = -1,
bool  bgui_DrawSelected = FALSE
const [virtual]
 

gui_Draws all the elements contained in the array behaving exactly as mcElement::gui_Draw but requires some additional parameters.

Parameters:
dc The DC where the function will draw
x The x-coord where the first element will be drawn
y The y-coord where the first element will be drawn
pt The mouse cursor position or a mcDRW_*** flag
cl The center line to use to draw the elements or -1 to let the function calculate it
begin The index of the first element to draw
end The index of the last element to draw
bgui_DrawSelected TRUE if you want this function to draw also selected elements.

Definition at line 1252 of file ElementArray.cpp.

References data_Get(), data_GetCount(), gui_CalcSizeOfFirst(), mcElement::gui_Draw(), gui_GetBB(), gui_GetCenterLine(), mcElementHelpers::gui_GetWidth(), mcElementHelpers::gui_isSelected(), mcDRW_ALLACTIVE, mcDRW_ALLOW_TOTAL_SELECTION, mcDRW_NOACTIVEELEM, mcDRW_NONACTIVE, mcDRW_USEPOINT, mcGUILOG, mcTXT, and mcTXTTHIS.

Referenced by mcMonomialHelpers::gui_Draw(), gui_DrawSelectedElements(), and mcPolynomialHelpers::gui_ExDraw().

mcElement& mcElementArrayHelpers::gui_ExGetActiveElem int  x,
int  y,
const wxPoint &  pt,
int  cl
[inline]
 

Returns the currently active element of the array or NULL if there is no active element under the mouse cursor.

Definition at line 982 of file ElementArray.h.

References mcElement::gui_GetActiveElem(), mcDRW_NOACTIVEELEM, mcDRW_ONSELECTION, and mcEmptyElement.

int mcElementArrayHelpers::gui_ExGetRelCursorPos wxDC &  hDC,
wxPoint *  pt,
int  cl = -1
const [virtual]
 

Asks the currently focused element of the array for the cursor position; then, offsets it to the right position and return it in the given point pointer.

This function works as mcElement::gui_GetRelCursorPos function should work, but it can accept a center line and the space to leave among the elements, given by caller.

Definition at line 1330 of file ElementArray.cpp.

References data_Get(), data_GetCount(), gui_CalcSizeOfFirst(), gui_CheckCursorPos(), gui_GetCenterLine(), mcElement::gui_GetRelCursorPos(), mcElement::gui_GetYAnchor(), and mgui_nCursorPos.

int mcElementArrayHelpers::gui_ExMoveCursorUsingPoint wxDC &  hDC,
const wxPoint &  pt,
int  cl = -1
[virtual]
 

This function is typically used in response to a gui_MoveCursorUsingPoint() calls.

Parameters:
hDC The DC where the element was drawn last time.
pt The mouse cursor position, in ElementArray coord., that is, in coord. relative to the upper-left point of the bounding box of this element.
cl The center line for this monomial, or -1 to let the function calculate it

Definition at line 1650 of file ElementArray.cpp.

References data_Get(), data_GetCount(), data_isOp(), gui_CheckCursorPos(), gui_GetBB(), gui_GetCenterLine(), gui_GetSpaceBetween(), mcElement::gui_LetInCursor(), mcElement::gui_MoveCursorUsingPoint(), mcCP_END, mcMCR_CANNOT_SETFOCUS, mcMCR_OKAY, and mgui_nCursorPos.

void mcElementArrayHelpers::gui_ExOnSelect wxDC &  dc,
wxRect &  rc,
int  cl = -1
[virtual]
 

Behaves as mcElement::gui_OnSelect() function; the only difference is that this function allows the caller to specify a space to leave (in computations: this function doesn't draw anything) among the various elements.

Parameters:
dc The DC where the user created the selection rectangle
x The x position of this array on the given DC
y The y position of this array on the given DC
rc The selection rectangle created by the user
cl The center line used to draw the array on the given DC (or -1)

Reimplemented in mcPolynomialHelpers.

Definition at line 1354 of file ElementArray.cpp.

References data_Get(), data_GetCount(), data_isOp(), mcElement::gui_DeSelect(), mcElementHelpers::gui_DeSelect(), gui_GetBB(), gui_GetCenterLine(), gui_GetSelElemCount(), gui_GetSelEnd(), gui_GetSelStart(), mcElement::gui_OnSelect(), mcElementHelpers::gui_Select(), mcElement::gui_SelectAll(), mcMAX, and mcMIN.

Referenced by mcPolynomialHelpers::gui_ExOnSelect().

mcElement& mcElementArrayHelpers::gui_GetActiveElem int  x,
int  y,
const wxPoint &  pt
[inline]
 

Definition at line 1052 of file ElementArray.h.

int mcElementArrayHelpers::gui_GetActiveElemIndex int  x,
int  y,
const wxPoint &  pt,
int  cl = -1
[virtual]
 

Returns the index of the currently active element, or the index of the element which contains the current active element (this function cannot recursively search the index of the active element and it must stop to the first element, even if it's a container one).

Returns:
The index of the active element. If there is no element containing the mouse cursor, the function returns mcDRW_NOACTIVEELEM. If the active element is selected, then this function returns mcDRW_ONSELECTION.

Definition at line 1818 of file ElementArray.cpp.

References data_Get(), data_GetCount(), gui_GetBB(), gui_GetCenterLine(), mcElementHelpers::gui_isSelected(), mcDRW_NOACTIVEELEM, and mcDRW_ONSELECTION.

int mcElementArrayHelpers::gui_GetBB int  n,
wxRect *  rc,
int  yCenter = 0,
int  w = 0
const [virtual]
 

Returns the width of n-th element and its bounding box (in the pointer) in coord.

relative to the top-left point of the entire monomial. If you want to use a special center line, use a non-zero value for yCenter; otherwise let it to zero, the function will compute it using #GetCenterLine. If you want to specify the width of all the elements preceding the n-th element, use w with a non-zero value, otherwise the function will calculate it.

Parameters:
n The entry of the element whose bounding box will be returned
rc The wxRect where the bounding box will be stored
yCenter An optional center line to which the element bounding box will be centered vertically
w An optional value: the width of all preceding elements (if you use this function in a loop, just compute center line once and reuse widths)
Returns:
The width of the n-th element.

Definition at line 1161 of file ElementArray.cpp.

References data_Get(), gui_GetCenterLine(), mcElement::gui_GetHeight(), gui_GetOriginOfElem(), gui_GetSpaceBetween(), mcElement::gui_GetWidth(), and mcUNUSED.

Referenced by gui_ExDraw(), gui_ExMoveCursorUsingPoint(), gui_ExOnSelect(), and gui_GetActiveElemIndex().

int mcElementArrayHelpers::gui_GetCenterLine  )  const [virtual]
 

Returns the y value which is the half of the height of the tallest element in the array.

This function scans all the array and do a lot of comparisons: use it as less as possible.

Definition at line 1178 of file ElementArray.cpp.

References data_Get(), data_GetCount(), gui_GetYAnchor(), and mcMAX.

Referenced by gui_CalcSizeOfFirst(), gui_CalcSizeOfRange(), gui_DrawSelection(), gui_ExDraw(), gui_ExGetRelCursorPos(), gui_ExMoveCursorUsingPoint(), gui_ExOnSelect(), gui_GetActiveElemIndex(), gui_GetBB(), gui_GetOriginOfElem(), and gui_GetSelectionRect().

virtual mcCursorPos mcElementArrayHelpers::gui_GetCursorPos  )  const [inline, virtual]
 

Returns the cursor position after creating mcCursorPos.

This function uses the gui_GetCursorPos but it is a little slower since it allocates a mcCursorPos oject while the other overload uses an already existing object given by the caller.

Reimplemented from mcElementHelpers.

Definition at line 1025 of file ElementArray.h.

References mcElementHelpers::gui_GetCursorPos().

Referenced by mcPolynomialHelpers::gui_CheckCursorPos(), gui_GetCursorPos(), mcPolynomialHelpers::gui_Input(), mcPolynomialHelpers::gui_Insert(), mcMonomialHelpers::gui_Insert(), and gui_MoveCursor().

void mcElementArrayHelpers::gui_GetCursorPos mcCursorPos  )  const [virtual]
 

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 1701 of file ElementArray.cpp.

References data_Get(), data_GetCount(), data_isOp(), mcElement::gui_GetCursorPos(), gui_GetCursorPos(), mcCursorPos::gui_Push(), mcCursorPos::isBegin(), mcCursorPos::isBeginEnd(), mcCursorPos::isEnd(), mcCP_BEGIN, mcCP_BEGINEND, mcCP_END, and mgui_nCursorPos.

wxPoint mcElementArrayHelpers::gui_GetOriginOfElem int  n,
int  cl = -1
const [virtual]
 

Returns the position of the upper-left coord.

of the n-th element.

Parameters:
cl The center line for this monomial, or -1 to let the function calculate it

Definition at line 930 of file ElementArray.cpp.

References data_Get(), gui_CalcSizeOfFirst(), gui_GetCenterLine(), and mcElement::gui_GetYAnchor().

Referenced by gui_GetBB().

int mcElementArrayHelpers::gui_GetRelCursorPos wxDC &  dc,
wxPoint *  pt
const [inline, virtual]
 

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.

Parameters:
dc The device context where the element was drawn last time.
pt The coordinates, relative to the element (assume the element placed at 0;0), indicating the top-left point of the cursor.

Implements mcElementHelpers.

Definition at line 1042 of file ElementArray.h.

mcElement mcElementArrayHelpers::gui_GetSelection  )  const [virtual]
 

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 1775 of file ElementArray.cpp.

References mcElementArray::data_AddElements(), mcElementHelpers::data_GetType(), mcElement::data_GetType(), mcElement::data_MakePrivateCopy(), gui_GetSelElem(), gui_GetSelElemCount(), mcASSERT, mcEmptyElement, and mcET_POLYNOMIAL.

Referenced by mcMathMngHelpers::gui_AddSubSel(), and mcMathMngHelpers::gui_MoveSel().

wxRect mcElementArrayHelpers::gui_GetSelectionRect wxDC &  dc,
int  x,
int  y,
int  cl = -1
const [virtual]
 

Returns the selection rectangle in screen coordinates.

Parameters:
dc The DC to use to compute the center line if cl is -1
x The x-pos of the monomial on dc
y The y-pos of the monomial on dc
cl The center line for this monomial, or -1 to let the function calculate it

Definition at line 981 of file ElementArray.cpp.

References data_Get(), gui_CalcSizeOfFirst(), gui_CalcSizeOfRange(), gui_GetCenterLine(), gui_GetSelEnd(), gui_GetSelStart(), gui_GetSpaceBetween(), gui_GetYAnchor(), and mcMIN.

Referenced by gui_DrawSelection().

const mcElement& mcElementArrayHelpers::gui_GetSelElem int  n  )  const [inline]
 

Returns a pointer to the n-th selected element found inside the expression.

Parameters:
n The selected element to return; a null value means 'return first selected element', 1 means 'return second selected element'...
Returns:
A pointer to the internally stored selected element or NULL if there are no enough selected elements (see #GetSelElemCount).

Definition at line 939 of file ElementArray.h.

References mcEmptyElement.

Referenced by gui_DeleteSelection(), gui_DrawSelection(), and gui_GetSelection().

int mcElementArrayHelpers::gui_GetSelElemCount  )  const [inline]
 

Returns the number of the selected elements in the expression.

Definition at line 873 of file ElementArray.h.

Referenced by gui_DrawSelection(), mcPolynomialHelpers::gui_ExDraw(), gui_ExOnSelect(), and gui_GetSelection().

int mcElementArrayHelpers::gui_GetSelElemCountOfType mcElementType  t  )  const [inline]
 

Returns the number of the selected elements in the array of the given type and subtype.

Definition at line 879 of file ElementArray.h.

int mcElementArrayHelpers::gui_GetSelElemIndex int  n  )  const [inline]
 

Returns the index of the n-th selected element found inside the expression.

Parameters:
n The selected element whose index will be returned; zero means 'return first selected elementwxT('s index'), 1 means 'return second selected element's index'...
Returns:
The index of the internally stored selected element or -1 if there are no enough selected elements (see #GetSelElemCount).

Definition at line 895 of file ElementArray.h.

int mcElementArrayHelpers::gui_GetSelElemIndexOfType int  n,
mcElementType  t
const [inline]
 

Returns the index of the n-th selected element found inside the expression, which match the given type and subtype.

Parameters:
n The selected element whose index will be returned; zero means 'return first selected elementwxT('s index'), 1 means 'return second selected element's index'...
Returns:
The index of the internally stored selected element or -1 if there are no enough selected elements (see #GetSelElemCount).

Definition at line 919 of file ElementArray.h.

const mcElement& mcElementArrayHelpers::gui_GetSelElemOfType int  n,
mcElementType  t
const [inline]
 

Definition at line 949 of file ElementArray.h.

References mcEmptyElement.

int mcElementArrayHelpers::gui_GetSelEnd  )  const [inline]
 

Returns the index of the last selected element contained in the expression, or -1 if there is no selected element.

Definition at line 970 of file ElementArray.h.

Referenced by gui_DeleteSelection(), gui_DrawSelectedElements(), mcPolynomialHelpers::gui_ExOnSelect(), gui_ExOnSelect(), and gui_GetSelectionRect().

int mcElementArrayHelpers::gui_GetSelStart  )  const [inline]
 

Returns the index of the first selected element contained in the expression, or -1 if there is no selected element.

Definition at line 961 of file ElementArray.h.

Referenced by gui_DeleteSelection(), gui_DrawSelectedElements(), mcPolynomialHelpers::gui_ExOnSelect(), gui_ExOnSelect(), and gui_GetSelectionRect().

int mcElementArrayHelpers::gui_GetSpaceBetween  )  const [virtual]
 

Returns the number of pixels to leave among the elements of the array.

This functions takes by default the mcElementArray::gui_nSpaceBetween variables and divides it by the exponent depth of the array.

Definition at line 857 of file ElementArray.cpp.

References mcElementHelpers::gui_GetExpDepth(), and gui_GetSpaceBetweenRatio().

Referenced by gui_CalcSizeOfRange(), gui_ExMoveCursorUsingPoint(), gui_GetBB(), and gui_GetSelectionRect().

virtual int mcElementArrayHelpers::gui_GetSpaceBetweenRatio  )  const [inline, virtual]
 

Returns the costant which is divided by the exponent depth of this element to get the number of pixels to leave among the elements.

Derived classes should override this function to allow personalized values of the 'space between' customizable variable. In fact, if we would have defined here a STATIC INT nSpaceBetween variable, we would have forced the instance of all mcElementArrayGUI-derived classes to have the same 'space between' value.

Reimplemented in mcMonomialHelpers, and mcPolynomialHelpers.

Definition at line 274 of file ElementArray.h.

Referenced by gui_GetSpaceBetween().

virtual int mcElementArrayHelpers::gui_GetYAnchor  )  const [inline, virtual]
 

Returns the y amount of this mcElement to subtract from the center line to draw this element.

Reimplemented from mcElementHelpers.

Definition at line 1028 of file ElementArray.h.

Referenced by gui_GetCenterLine(), and gui_GetSelectionRect().

void mcElementArrayHelpers::gui_Init  )  [inline, protected, virtual]
 

Inits the GUI section of this element.

Reimplemented from mcElementHelpers.

Reimplemented in mcPolynomialHelpers.

Definition at line 308 of file ElementArray.h.

References mcElementHelpers::gui_Init().

Referenced by mcPolynomialHelpers::gui_Init().

mcInputRes mcElementArrayHelpers::gui_Input const mcKey ev,
mcElement newelem
[virtual]
 

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.

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.
newelem If the function returns mcIR_REPLACE_THIS, the caller will use this pointer as a substitute for this element (which will be deleted).

Implements mcElementHelpers.

Reimplemented in mcMonomialHelpers, and mcPolynomialHelpers.

Definition at line 1435 of file ElementArray.cpp.

References mcElementHelpers::data_Check(), data_Get(), data_GetCount(), data_isElementAllowed(), data_MoveElemRight(), mcMathCore::Get(), gui_AddNewElement(), gui_BackInput(), gui_CheckCursorPos(), gui_DoSplit(), mcElement::gui_GetCursorPos(), mcElement::gui_Input(), gui_isEndKey(), mcElementHelpers::gui_isKeyBeginKey(), mcElementHelpers::gui_RecalcSize(), gui_UpdateExpDepth(), mcCursorPos::isBegin(), mcCursorPos::isEnd(), mcCursorPos::isInside(), mcASSERT, mcCP_BEGIN, mcET_INVALID, mcGUILOG, mcIR_OKAY, mcTXTTHIS, mgui_nCursorPos, and mcMathCore::SyntaxError().

Referenced by mcPolynomialHelpers::gui_Input(), and mcMonomialHelpers::gui_Input().

bool mcElementArrayHelpers::gui_Insert const mcElement toinsert  ) 
 

virtual bool mcElementArrayHelpers::gui_isArrEndKey const mcKey ev  )  const [pure virtual]
 

Returns TRUE if the given key cannot be handled by the array.

This function is called by mcElementArray::gui_isEndChar() function only if the currently focused element in the array cannot handle it.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by gui_isEndKey().

bool mcElementArrayHelpers::gui_isCursorOn const mcElement p  )  const [inline]
 

Returns TRUE if the given element is contained in this monomial and it has the focus (that is, the cursor is placed on that element).

Definition at line 865 of file ElementArray.h.

bool mcElementArrayHelpers::gui_isEndKey const mcKey ev  )  const [virtual]
 

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

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.

Implements mcElementHelpers.

Definition at line 865 of file ElementArray.cpp.

References data_Get(), data_GetCount(), gui_isArrEndKey(), and mgui_nCursorPos.

Referenced by gui_Input().

mcMoveCursorRes mcElementArrayHelpers::gui_MoveCursor mcMoveCursorFlag  flag,
long  modifiers
[virtual]
 

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.

Parameters:
flag One of the Move Cursor flags (see MathTypes.h)

Implements mcElementHelpers.

Definition at line 1549 of file ElementArray.cpp.

References data_Get(), data_GetCount(), data_isOp(), gui_CheckCursorPos(), gui_GetCursorPos(), mcElementHelpers::gui_isSelected(), mcElement::gui_MoveCursor(), gui_MoveCursorLeft(), gui_MoveCursorRight(), mcElementHelpers::gui_Select(), mcMCF_LEFT, mcMCF_RIGHT, mcMCR_OKAY, mcMCR_SETFOCUS_ABOVE, mcMCR_SETFOCUS_BELOW, mcMCR_SETFOCUS_NEXT, mcMCR_SETFOCUS_PREVIOUS, and mgui_nCursorPos.

void mcElementArrayHelpers::gui_MoveCursorLeft  ) 
 

Definition at line 1529 of file ElementArray.cpp.

References data_Get(), mcElementHelpers::gui_LetInCursor(), mcCP_END, and mgui_nCursorPos.

Referenced by mcMonomialHelpers::gui_BackInput(), and gui_MoveCursor().

void mcElementArrayHelpers::gui_MoveCursorRight  ) 
 

Moves cursor from the current position one step right, skipping elements which return FALSE to the gui_LetInCursor() function.

Definition at line 1539 of file ElementArray.cpp.

References data_Get(), data_GetCount(), mcElementHelpers::gui_LetInCursor(), mcCP_BEGIN, and mgui_nCursorPos.

Referenced by mcMonomialHelpers::gui_BackInput(), and gui_MoveCursor().

int mcElementArrayHelpers::gui_MoveCursorUsingPoint wxDC &  dc,
const wxPoint &  pt
[inline, virtual]
 

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).

Parameters:
dc The device context where the element was drawn last time
p a valid pointer to a wxPoint (containing coord. relative to the top-left point of the element) which must be used to find the selected subelement; otherwise this is a NULL value

Implements mcElementHelpers.

Definition at line 1047 of file ElementArray.h.

void mcElementArrayHelpers::gui_OnSelect wxDC &  dc,
wxRect &  rc
[inline, virtual]
 

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.

Reimplemented in mcPolynomialHelpers.

Definition at line 1032 of file ElementArray.h.

void mcElementArrayHelpers::gui_SetCursorOnElemBegin int  n  )  [inline]
 

Sets the cursor at the beginning of the n-th element.

Definition at line 849 of file ElementArray.h.

References mcCP_BEGIN.

void mcElementArrayHelpers::gui_SetCursorOnElemEnd int  n  )  [inline]
 

Sets the cursor at the end of the n-th element.

Definition at line 856 of file ElementArray.h.

References mcCP_END.

void mcElementArrayHelpers::gui_SetCursorPos const mcCursorPos code  )  [virtual]
 

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.

Reimplemented in mcPolynomialHelpers.

Definition at line 1745 of file ElementArray.cpp.

References data_Get(), data_GetCount(), data_isArrayEmpty(), data_isOp(), mcElement::gui_SetCursorPos(), mcASSERT, mcCP_BEGIN, mcCP_END, and mgui_nCursorPos.

Referenced by mcMonomialHelpers::gui_BackInput().

void mcElementArrayHelpers::gui_UpdateExpDepth  )  [virtual]
 

Sets the exponent depth of all the elements contained to be the same of the exponent depth of *this.

Reimplemented from mcElementHelpers.

Definition at line 1240 of file ElementArray.cpp.

References data_Get(), data_GetCount(), mcElement::gui_SetAtSameLevelOf(), and mcElementHelpers::gui_UpdateExpDepth().

Referenced by gui_Input().

wxString mcElementArrayHelpers::io_GetInlinedExpr  )  const [virtual]
 

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:

  • "^" introduces an exponent
  • "_" introduces a subscript Some examples of inlined expressions are: "4x^2+5a*sin(x/4)", "cos^2(PI/2)+ (123ax+b)/c >= 0", ....

Implements mcElementHelpers.

Reimplemented in mcPolynomialHelpers.

Definition at line 1884 of file ElementArray.cpp.

References data_Get(), data_GetCount(), and mcElement::io_GetInlinedExpr().

bool mcElementArrayHelpers::io_isBeginChar const wxString &  str  )  const [inline, virtual]
 

Element arrays do not have a special begin/end character in inlined expressions...

they are allocated using special rules and thus do not follow the standard mcElement rules. This is why this function always returns FALSE.

Implements mcElementHelpers.

Definition at line 1571 of file ElementArray.h.

bool mcElementArrayHelpers::io_isBeginTag const wxXml2Node &  tag  )  const [inline, virtual]
 

Checks the given tag and, if it is an MROW, returns a null value (the ID of the first mcElementArray-derived class).

Implements mcElementHelpers.

Definition at line 1561 of file ElementArray.h.

void mcElementArrayHelpers::math_ApplyOp mcElementType  optype,
mcElement  res,
const mcElement factor,
mcElement
 

Creates a temporary operator of the given type and then applies it to the given two elements.

Definition at line 2709 of file ElementArray.cpp.

References mcElementHelpers::data_NewElem(), mcOperator::math_Apply(), mcLOG, and mcTXT.

void mcElementArrayHelpers::math_ApplyOpSimple mcElementType  optype,
mcElement  res,
const mcElement factor
 

Works like #ApplyOp but uses the mcOperator::ApplySimple instead of the mcOperator::Apply function.

Definition at line 2700 of file ElementArray.cpp.

References mcElementHelpers::data_NewElem(), mcOperator::math_ApplySimple(), mcLOG, and mcTXT.

Referenced by mcMonomialHelpers::math_SimplifyCoeff().

virtual mcExpSimRes mcElementArrayHelpers::math_BeginSimSteps  )  [inline, protected, virtual]
 

Reimplemented in mcMonomialHelpers.

Definition at line 1329 of file ElementArray.h.

References mcESR_DONE.

Referenced by math_Simplify().

bool mcElementArrayHelpers::math_CanBeAddedWith const mcElement p  )  const [virtual]
 

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.

Reimplemented in mcMonomialHelpers.

Definition at line 2560 of file ElementArray.cpp.

References mcElementHelpers::data_GetType().

Referenced by math_CanBeDivBy(), and math_CanBeMultWith().

bool mcElementArrayHelpers::math_CanBeDivBy const mcElement p  )  const [virtual]
 

Works like #math_CanBemath_AddeWith(), just for divisions.

Implements mcElementHelpers.

Definition at line 2570 of file ElementArray.cpp.

References math_CanBeAddedWith().

bool mcElementArrayHelpers::math_CanBeMultWith const mcElement p  )  const [virtual]
 

Works like #math_CanBemath_AddeWith(), just for multiplication.

Implements mcElementHelpers.

Definition at line 2573 of file ElementArray.cpp.

References math_CanBeAddedWith().

bool mcElementArrayHelpers::math_Compare const mcElement p,
long  flags
const [virtual]
 

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 2783 of file ElementArray.cpp.

References mcElementArray::data_Get(), mcElementArray::data_GetCount(), mcElementArray::data_GetElemIndexOfType(), mcElementArray::data_GetNumOfElemType(), mcElementArray::data_GetOpTypePreceding(), mcElement::data_GetType(), mcElementHelpers::data_GetType(), mcElementArray::data_isOp(), mcElement::math_Compare(), math_PrepareForComparison(), mcFIND_STRICT, mcMATHLOG, mcSWAP, mcTXT, and mcTXTTHIS.

Referenced by mcMonomialHelpers::math_DetachNonCommonFactors(), and mcPolynomialHelpers::math_GetIndexOf().

bool mcElementArrayHelpers::math_CompareThisOnly const mcElement p,
long  flags
const [virtual]
 

Compares this element and the given one and then stops, unlike math_Compare() that compares children too.

Reimplemented from mcElementHelpers.

Definition at line 2896 of file ElementArray.cpp.

mcElementArray mcElementArrayHelpers::math_CreateWrapperFor const mcElement p  )  const [virtual]
 

Returns a new mcElementArray element which wraps the given element.

Reimplemented in mcPolynomialHelpers.

Definition at line 2576 of file ElementArray.cpp.

References mcElementArray::data_AddElements(), mcElementHelpers::data_GetType(), and mcElementHelpers::data_NewElem().

Referenced by mcPolynomialHelpers::math_CreateWrapperFor(), math_SimpleAdd(), math_SimpleDivideBy(), and math_SimpleMultiplyBy().

virtual int mcElementArrayHelpers::math_DataToMathIdx int  dataindex  )  const [pure virtual]
 

Converts from data to math index.

See #mcElementArrayMath general description for more info.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by mcArrayEntry::math_GetIdx(), math_GetIndexOf(), and math_SimplifyRemoveNeutrals().

bool mcElementArrayHelpers::math_Delete int  n,
const mcElement elem,
bool  bAddZero = TRUE
[virtual]
 

math_Finds the given element among the elements contained directly (that is, without any wrapper: this function is not recursive) and then deletes it from the array.

Unlike mcElementArray::data_Delete that matches only the elements with the same identity (the same ID or, it's the same, with the same pointer values), this function uses the #math_CompareWith() function to find the n-th element to delete. This function also shifts the array, thus decrementing the element counter. Returns TRUE if everything is okay; FALSE if the given pointer is not an element contained in this array.

Definition at line 2689 of file ElementArray.cpp.

References mcElementHelpers::math_NonRecursiveFindInChildren(), and math_Remove().

mcArrayEntry mcElementArrayHelpers::math_EmbedInBracket  ) 
 

Definition at line 1971 of file ElementArray.cpp.

References data_DeleteAll(), mcArrayEntry::data_GetRef(), mcElement::data_GetType(), mcExpContainer::data_SetContent(), math_GetPolynomialWrapper(), math_WrapSimple(), mcASSERT, and mcET_BRACKET.

Referenced by mcPolynomialHelpers::math_EmbedInBracket(), math_EmbedInBracketAndRaiseTo(), mcPolynomialHelpers::math_FactoreOut(), mcPolynomialHelpers::math_GetLCM(), and mcPolynomialHelpers::math_MultiplyBy().

void mcElementArrayHelpers::math_EmbedInBracketAndRaiseTo const mcPolynomial p  ) 
 

Definition at line 1906 of file ElementArray.cpp.

References mcArrayEntry::data_GetBracket(), math_EmbedInBracket(), and mcElement::math_RaiseTo().

void mcElementArrayHelpers::math_EmbedInBracketAndRaiseTo const mcRealValue n  ) 
 

Factores-out of the contained elements everything is possible.

For mcPolynomials, this means that the GCD among all the factors of the monomials (get through math_GetFactors) will be picked up. For mcMonomials, this means that all the children will be divided by the factors they returned with the math_GetFactors function.

Definition at line 1903 of file ElementArray.cpp.

References mcArrayEntry::data_GetBracket(), math_EmbedInBracket(), and mcElement::math_RaiseTo().

Referenced by mcPolynomialHelpers::math_RaiseTo().

mcArrayEntry mcElementArrayHelpers::math_EmbedInFraction bool  bAsDenominator = FALSE  ) 
 

Definition at line 2005 of file ElementArray.cpp.

References mcElementHelpers::data_Check(), data_DeleteAll(), mcArrayEntry::data_GetRef(), mcElement::data_GetType(), mcFraction::data_SetDen(), mcFraction::data_SetNum(), math_GetPolynomialWrapper(), math_WrapSimple(), mcASSERT, mcET_FRACTION, mcMATHLOG, and mcTXT.

Referenced by mcPolynomialHelpers::math_DivideBy(), mcMonomialHelpers::math_DivideBy(), and math_MakeReciprocal().

mcArrayEntry mcElementArrayHelpers::math_EmbedInRadical  ) 
 

Definition at line 1988 of file ElementArray.cpp.

References data_DeleteAll(), mcArrayEntry::data_GetRef(), mcElement::data_GetType(), mcExpContainer::data_SetContent(), math_GetPolynomialWrapper(), math_WrapSimple(), mcASSERT, and mcET_RADICAL.

Referenced by math_EmbedInRadicalAndRaiseTo().

void mcElementArrayHelpers::math_EmbedInRadicalAndRaiseTo const mcPolynomial p  ) 
 

Definition at line 1909 of file ElementArray.cpp.

References mcArrayEntry::data_GetBracket(), math_EmbedInRadical(), and mcElement::math_RaiseTo().

virtual void mcElementArrayHelpers::math_EndExpSteps  )  [inline, protected, virtual]
 

Like #EndSimSteps() just for expansion.

Reimplemented in mcPolynomialHelpers.

Definition at line 1337 of file ElementArray.h.

virtual void mcElementArrayHelpers::math_EndSimSteps  )  [inline, protected, virtual]
 

This routine is called when we're exiting from the math_Simplify(long flags) function (it's called even if we're exiting with a code different from mcESR_DONE).

Reimplemented in mcMonomialHelpers, and mcPolynomialHelpers.

Definition at line 1334 of file ElementArray.h.

mcRealValue mcElementArrayHelpers::math_Evaluate  )  const [virtual]
 

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 2038 of file ElementArray.cpp.

References data_Get(), data_isArrayEmpty(), data_isOp(), mcValue::isNAN(), mcValue::isValid(), mcOperator::math_Evaluate(), mcElement::math_Evaluate(), math_Get(), math_GetCount(), math_GetNeutralValue(), math_GetOpBetween(), mcMATHLOG, and mcTXTTHIS.

mcExpSimRes mcElementArrayHelpers::math_Expand long  flags  )  [inline]
 

Definition at line 1353 of file ElementArray.h.

References math_Expand.

mcExpSimRes mcElementArrayHelpers::math_Expand long  flags,
mcElement newelem
[virtual]
 

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.

virtual mcExpSimRes mcElementArrayHelpers::math_ExpandAll long  flags,
mcElement pp
[protected, virtual]
 

Expands all the elements of the array.

virtual mcExpSimRes mcElementArrayHelpers::math_FinalSimSteps  )  [inline, protected, virtual]
 

Definition at line 1330 of file ElementArray.h.

References mcESR_DONE.

Referenced by math_Simplify().

mcElement& mcElementArrayHelpers::math_Get int  n  )  [inline]
 

Reimplemented in mcPolynomialHelpers.

Definition at line 1384 of file ElementArray.h.

const mcElement& mcElementArrayHelpers::math_Get int  n  )  const [inline]
 

This should not be virtual because mcPolynomial will use its own Get() function with a different return type.

Reimplemented in mcPolynomialHelpers.

Definition at line 1382 of file ElementArray.h.

Referenced by mcMonomialHelpers::math_Add(), math_Evaluate(), math_GetFactors(), mcMonomialHelpers::math_GetGCD(), mcMonomialHelpers::math_GetLCM(), math_GetWrapped(), mcMonomialHelpers::math_RaiseTo(), mcMonomialHelpers::math_RemoveCoeff(), and math_SimplifySolveOp().

virtual int mcElementArrayHelpers::math_GetCount  )  const [inline, virtual]
 

Reimplemented in mcPolynomialHelpers.

Definition at line 1387 of file ElementArray.h.

Referenced by mcMonomialHelpers::math_Add(), mcMonomialHelpers::math_CanBeAddedWith(), math_Evaluate(), math_GetFactors(), mcMonomialHelpers::math_GetGCD(), mcMonomialHelpers::math_GetLCM(), math_GetMathType(), math_isWrappingOnly(), mcMonomialHelpers::math_MathToDataIdx(), mcMonomialHelpers::math_RaiseTo(), mcMonomialHelpers::math_RemoveCoeff(), and math_SimplifySolveOp().

mcMonomial mcElementArrayHelpers::math_GetFactors  )  const [virtual]
 

Factores-out everything which can be factored out from this element.

Returns a mcPolynomial containing a copy of those elements factored-out. This function is CONST since many times not all the factores which can be taken out will be used and thus is caller's duty the modification of this element, eventually calling the math_DivideBy function.

Reimplemented from mcElementHelpers.

Definition at line 2951 of file ElementArray.cpp.

References math_Get(), math_GetCount(), mcElement::math_GetFactors(), mcElement::math_GetGCD(), mcElementArray::math_ResetToOne(), mcMATHLOG, and mcTXT.

int mcElementArrayHelpers::math_GetIndexOf int  occ,
const mcElement tofind
const
 

Even if this function could seem similar to mcElementArray::data_GetIndexOf, it's not: while data_GetIndexOf works using for comparisons XX, math_GetIndexOf uses the mcElement math_NonRecursiveFindInChildren function which uses math_Compare and math_CompareThisOnly for comparisons.

Last difference: math_GetIndex returns a math index instead of a data index.

Definition at line 1912 of file ElementArray.cpp.

References math_DataToMathIdx(), and mcElementHelpers::math_NonRecursiveFindInChildren().

virtual mcRealValue mcElementArrayHelpers::math_GetLenght  )  const [inline, virtual]
 

An empty array must not be evaluated zero: in this way, the simp/exp algorithms know that an array, even if empty, adds a little bit of complexity...

Implements mcElementHelpers.

Definition at line 1369 of file ElementArray.h.

mcMathType mcElementArrayHelpers::math_GetMathType  )  const [virtual]
 

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 2718 of file ElementArray.cpp.

References data_Get(), data_isArrayEmpty(), mcMathType::math_ApplyOp(), math_GetCount(), mcElement::math_GetMathType(), math_GetOpTypeBetween(), mcMTL1_POLYNOMIAL, mcMTL2_ALGEBRAIC, and mcMTL3_CONSTANT.

virtual mcElementType mcElementArrayHelpers::math_GetNeutralOpType  )  const [pure virtual]
 

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by data_GetOpTypeBetween(), data_GetOpTypePreceding(), and math_Remove().

virtual double mcElementArrayHelpers::math_GetNeutralValue  )  const [pure virtual]
 

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by math_Evaluate(), and math_SimplifyRemoveNeutrals().

mcOperator & mcElementArrayHelpers::math_GetOpBetween int  n1,
int  n2
const
 

Definition at line 2739 of file ElementArray.cpp.

References mcElementHelpers::data_GetInstanceOf(), mcElement::data_GetType(), math_GetOpTypeBetween(), and mcASSERT.

Referenced by math_Evaluate().

mcOperator & mcElementArrayHelpers::math_GetOpPreceding int  n  )  const
 

Definition at line 2747 of file ElementArray.cpp.

References mcElementHelpers::data_GetInstanceOf(), mcElement::data_GetType(), math_GetOpTypePreceding(), and mcASSERT.

Referenced by mcPolynomialHelpers::math_SimplifySolveOp(), and math_SimplifySolveOp().

mcElementType mcElementArrayHelpers::math_GetOpTypeBetween int  n1,
int  n2
const [inline]
 

Definition at line 1398 of file ElementArray.h.

Referenced by math_GetMathType(), and math_GetOpBetween().

mcElementType mcElementArrayHelpers::math_GetOpTypePreceding int  n  )  const [inline]
 

Definition at line 1401 of file ElementArray.h.

Referenced by math_GetOpPreceding().

virtual mcPolynomial mcElementArrayHelpers::math_GetPolynomialWrapper  )  const [pure virtual]
 

Returns a new mcPolynomial containing *this array.

mcPolynomial returns a copy of themselves, mcMonomial returns a mcPolynomial containing itself.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by math_EmbedInBracket(), math_EmbedInFraction(), and math_EmbedInRadical().

const mcElement & mcElementArrayHelpers::math_GetWrapped mcElementType  t  )  const [virtual]
 

Returns the element of type t wrapped by this element, if it does exist and it is the only element wrapped by this array; returns NULL otherwise.

Reimplemented in mcPolynomialHelpers.

Definition at line 2172 of file ElementArray.cpp.

References math_Get(), math_isWrappingOnly(), and mcEmptyElement.

Referenced by math_GetWrappedNumber(), and math_GetWrappedSymbol().

mcRealValue mcElementArrayHelpers::math_GetWrappedNumber  )  const
 

Returns the number which is wrapped by this array or NAN if this array does not contain a single mcNumber.

Definition at line 1943 of file ElementArray.cpp.

References mcNumber::data_Get(), math_GetWrapped(), mcEmptyElement, and mcET_NUMBER.

const mcSymbolProperties * mcElementArrayHelpers::math_GetWrappedSymbol  )  const
 

Returns the symbol which is wrapped by this array or NULL if this array does not contain a single mcSymbol.

Definition at line 1935 of file ElementArray.cpp.

References mcSymbol::data_GetProperties(), math_GetWrapped(), mcEmptyElement, and mcET_SYMBOL.

void mcElementArrayHelpers::math_HandleBasicOpRes mcBasicOpRes  res,
mcElement  r,
int  ridx
[protected, virtual]
 

Handles the mcBasicOpRes flag returned by one of mcElementMath basic operations (+,-,*,/).

Parameters:
res The flag to handle
r The replacement element for the element which was processed
ridx The math index of r

Definition at line 2364 of file ElementArray.cpp.

References data_AddElements(), mcElementHelpers::data_Check(), data_Delete(), data_isOp(), data_MoveElemRight(), mcElementHelpers::data_NewElem(), math_MathToDataIdx(), math_Remove(), mcASSERT, mcBOR_INVALID, mcBOR_REMOVE_OPERAND, mcBOR_REPLACE_OPERAND, mcBOR_REPLACE_OPERAND_AND_SET_ADDOP, mcBOR_REPLACE_OPERAND_AND_SET_DIVOP, mcBOR_REPLACE_OPERAND_AND_SET_MULTOP, mcBOR_REPLACE_OPERAND_AND_SET_SUBOP, mcEmptyElement, mcET_ADDOP, mcET_DIVOP, mcET_INVALID, mcET_MULTOP, mcET_SUBOP, mcMATHLOG, and mcTXTTHIS.

Referenced by mcPolynomialHelpers::math_SimplifySolveOp(), and math_SimplifySolveOp().

mcExpSimRes mcElementArrayHelpers::math_HandleExpSimFlag mcExpSimRes  r,
mcElement newelem,
int  i
[protected, virtual]
 

Handles the given simplification flag returned by the i-th element of this array.

Note:
Unlike almost all math functions, the given index i must be in DATA coord and not in MATH coordinates...
Returns:
The index of the next element to simplify (used by caller if simplifying the element in a cycle).

Reimplemented in mcMonomialHelpers, and mcPolynomialHelpers.

Definition at line 2187 of file ElementArray.cpp.

References data_AddElements(), data_CheckIndex(), data_Delete(), mcElementArray::data_DetachAll(), mcElementArray::data_GetArray(), mcElementArray::data_GetCount(), mcElementHelpers::data_GetType(), data_MoveElemLeft(), mcASSERT, mcESR_DELETE_THIS, mcESR_DISTRIBUTE, mcESR_DONE, mcESR_INVALID_DATA, mcESR_NOTFINISHED, and mcESR_REPLACE_THIS.

Referenced by mcPolynomialHelpers::math_HandleExpSimFlag(), and mcMonomialHelpers::math_HandleExpSimFlag().

bool mcElementArrayHelpers::math_isWrappingNumOnly  )  const [inline]
 

Returns TRUE if this array is containing only a mcNumber.

Definition at line 1475 of file ElementArray.h.

References mcET_NUMBER.

bool mcElementArrayHelpers::math_isWrappingOnly const mcRealValue val  )  const [inline]
 

Definition at line 1490 of file ElementArray.h.

bool mcElementArrayHelpers::math_isWrappingOnly const mcSymbolProperties sym  )  const [inline]
 

Definition at line 1488 of file ElementArray.h.

bool mcElementArrayHelpers::math_isWrappingOnly mcElementType  t  )  const [virtual]
 

Returns TRUE if this array is containing only an element of the given type.

Reimplemented in mcPolynomialHelpers.

Definition at line 2160 of file ElementArray.cpp.

References data_Get(), mcElementHelpers::data_GetType(), and math_GetCount().

Referenced by mcMonomialHelpers::math_GetGCD(), and math_GetWrapped().

bool mcElementArrayHelpers::math_isWrappingSymOnly  )  const [inline]
 

Returns TRUE if this array is containing only a mcSymbol.

Definition at line 1478 of file ElementArray.h.

References mcET_SYMBOL.

mcBasicOpRes mcElementArrayHelpers::math_MakeReciprocal mcElement  )  [virtual]
 

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.

Note:
The math_RaiseTo function could be used instead of this one but this function should be preferred over math_RaiseTo(mcPolynomial(-1)); because this function ?????????? FIXME

Reimplemented from mcElementHelpers.

Definition at line 2080 of file ElementArray.cpp.

References math_EmbedInFraction(), and mcBOR_REMOVE_OPERAND.

virtual int mcElementArrayHelpers::math_MathToDataIdx int  mathindex  )  const [pure virtual]
 

Converts from math to data index.

See #mcElementArrayMath general description for more info.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by math_HandleBasicOpRes(), and math_Remove().

void mcElementArrayHelpers::math_PrepareForComparison mcElementArray p  )  const [virtual]
 

Reimplemented in mcMonomialHelpers.

Definition at line 2771 of file ElementArray.cpp.

Referenced by math_Compare().

void mcElementArrayHelpers::math_PrepareForMathOperations mcElementArray p  )  const [virtual]
 

Definition at line 2755 of file ElementArray.cpp.

bool mcElementArrayHelpers::math_Remove int  n,
bool  bAddZero = TRUE
 

Remove the n-th element from the array, creating a mcNumber init with zero (if bmath_AddToZero == TRUE) or with one (if bmath_AddToZero == FALSE), if the expression would remain empty after the removal of the n-th element.

This function also removes the (eventually present) operator which follows the element. This function is designed to be used by math engine functions; if you want a function which simply removes an element, see #DeleteElement. This function, in fact, not only removes the n-th element; it shifts array left one position, too.

Returns:
TRUE if a mcNumber intialized with zero or one was added to the array to avoid to leave it empty; FALSE otherwise.

Definition at line 2619 of file ElementArray.cpp.

References data_Delete(), data_Get(), mcElementHelpers::data_GetType(), data_isArrayEmpty(), data_isOp(), data_MoveElemLeft(), data_MoveElemRight(), data_Set(), math_GetNeutralOpType(), math_MathToDataIdx(), math_WrapSimple(), mcASSERT, mcET_DIVOP, and mcET_MONOMIAL.

Referenced by math_Delete(), mcPolynomialHelpers::math_EmbedInBracket(), math_HandleBasicOpRes(), mcMathMngHelpers::math_Move(), mcMonomialHelpers::math_RemoveCoeff(), and math_SimplifyRemoveNeutrals().

bool mcElementArrayHelpers::math_RemoveFactor const mcArrayEntry toremove  ) 
 

virtual mcExpSimRes mcElementArrayHelpers::math_Reorder  )  [protected, pure virtual]
 

Reorders the array.

Tipically this operation requires one step only anth thus this function should return always mcESR_DONE, even if this is not required.

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by math_Simplify().

int mcElementArrayHelpers::math_ReorderElements mcElement arr,
int  sz,
int  start = 0,
int  toskip = 1
[protected, virtual]
 

Reorders the given array of the given size using the mcElement::math_isListedBeforeOf to perform comparisons.

Parameters:
start The start index for the reordering.
toskip The number of operators interleaved with the various elements of the array (could be one or two).
Returns:
The number of movements performed to reorder the array.

Definition at line 2088 of file ElementArray.cpp.

References mcElement::data_GetType(), mcElementHelpers::data_GetType(), mcElement::math_isListedBeforeOf(), mcASSERT, and mcEmptyElement.

Referenced by mcPolynomialHelpers::math_Reorder(), and mcMonomialHelpers::math_Reorder().

void mcElementArrayHelpers::math_ResetToOne  )  [virtual]
 

Definition at line 1951 of file ElementArray.cpp.

References data_DeleteAll(), math_WrapSimple(), and mcASSERT.

void mcElementArrayHelpers::math_ResetToZero  )  [virtual]
 

Definition at line 1961 of file ElementArray.cpp.

References data_DeleteAll(), math_WrapSimple(), and mcASSERT.

void mcElementArrayHelpers::math_SimpleAdd const mcElement p,
bool  add = TRUE
[virtual]
 

Adds the given element to this element using the math_Add() function and then checking that the return value is mcBOR_REMOVE_OPERAND: that is, the operation was completed successfully and *this now contains the result of the operation.

If the math_Add() function does not return mcBOR_REMOVE_OPERAND then an ASSERT fails: use math_SimpleXXXX functions only when you are sure that the operation can be performed without special operations.

Reimplemented from mcElementHelpers.

Definition at line 2603 of file ElementArray.cpp.

References math_CreateWrapperFor(), and mcElementHelpers::math_SimpleAdd().

Referenced by mcMathMngHelpers::gui_AddSubSel(), mcPolynomialHelpers::math_Add(), mcPolynomialHelpers::math_EmbedInBracket(), and mcMathMngHelpers::math_Move().

void mcElementArrayHelpers::math_SimpleDivideBy const mcElement p  )  [virtual]
 

Reimplemented from mcElementHelpers.

Definition at line 2597 of file ElementArray.cpp.

References math_CreateWrapperFor(), and mcElementHelpers::math_SimpleDivideBy().

void mcElementArrayHelpers::math_SimpleMultiplyBy const mcElement p  )  [virtual]
 

Reimplemented from mcElementHelpers.

Definition at line 2591 of file ElementArray.cpp.

References math_CreateWrapperFor(), and mcElementHelpers::math_SimpleMultiplyBy().

mcExpSimRes mcElementArrayHelpers::math_Simplify long  flags  )  [inline]
 

A mcElementArray will never use the argument of the standard mcElement::math_Simplify(long flags) function, because it will never return mcESR_REPLACE_THIS flag...

this little function helps to write readable code.

Reimplemented in mcPolynomialHelpers.

Definition at line 1352 of file ElementArray.h.

mcExpSimRes mcElementArrayHelpers::math_Simplify long  flags,
mcElement newelem
[virtual]
 

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

Returns:
Returns TRUE if the element is completely simplied and thus, the following calls to math_Simplify won't have effect.

Implements mcElementHelpers.

Reimplemented in mcPolynomialHelpers.

Definition at line 2473 of file ElementArray.cpp.

References mcElementHelpers::data_Check(), data_Repair(), math_BeginSimSteps(), math_FinalSimSteps(), math_Reorder(), math_SimplifyAll(), math_SimplifyExp(), math_SimplifyRemoveNeutrals(), math_SimplifySolveOp(), mcESR_DONE, mcMATHLOG, mcTXTTHIS, and SIMCHECK_EXIT.

Referenced by mcPolynomialHelpers::math_Simplify().

virtual mcExpSimRes mcElementArrayHelpers::math_SimplifyAll long  flags,
mcElement pp
[protected, virtual]
 

Simplifies all the elements of the array.

Referenced by math_Simplify().

virtual mcExpSimRes mcElementArrayHelpers::math_SimplifyExp long  flags,
mcElement pp
[protected, virtual]
 

Expands those elements which contain symbols in common.

Referenced by math_Simplify().

virtual bool mcElementArrayHelpers::math_SimplifyNeedExp long  flags,
int  n
const [protected, virtual]
 

Returns TRUE if the n-th element must be expanded in order to simplify this array.

This function works in data coord.

mcExpSimRes mcElementArrayHelpers::math_SimplifyRemoveNeutrals long  flags  )  [protected, virtual]
 

Removes all the neutral elements from the array, using the #GetNeutralValue and the #GetNeutralOpType functions.

Definition at line 2330 of file ElementArray.cpp.

References data_Get(), data_GetCount(), math_DataToMathIdx(), mcElementHelpers::math_EvaluatesTo(), math_GetNeutralValue(), math_Remove(), mcESR_DONE, mcESR_NOTFINISHED, mcLOG, and mcMATHLOG.

Referenced by math_Simplify().

mcExpSimRes mcElementArrayHelpers::math_SimplifySolveOp long  flags  )  [protected, virtual]
 

Applies all the operators which can be applied on the elements of the array.

Reimplemented in mcPolynomialHelpers.

Definition at line 2427 of file ElementArray.cpp.

References mcOperator::math_Apply(), math_Get(), math_GetCount(), math_GetOpPreceding(), math_HandleBasicOpRes(), mcBOR_INVALID, mcEmptyElement, mcESR_DONE, mcESR_NOTFINISHED, mcMATHLOG, mcTXT, and mcTXTTHIS.

Referenced by math_Simplify().

virtual mcArrayEntry mcElementArrayHelpers::math_WrapMonomial const mcMonomial  )  [pure virtual]
 

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

mcArrayEntry mcElementArrayHelpers::math_WrapNumber const mcRealValue val  )  [virtual]
 

Definition at line 1929 of file ElementArray.cpp.

References math_WrapSimple().

virtual mcArrayEntry mcElementArrayHelpers::math_WrapSimple const mcElement  )  [pure virtual]
 

Implemented in mcMonomialHelpers, and mcPolynomialHelpers.

Referenced by math_EmbedInBracket(), math_EmbedInFraction(), math_EmbedInRadical(), math_Remove(), math_ResetToOne(), math_ResetToZero(), math_WrapNumber(), and math_WrapSymbol().

mcArrayEntry mcElementArrayHelpers::math_WrapSymbol const mcSymbolProperties sym  )  [virtual]
 

Definition at line 1922 of file ElementArray.cpp.

References math_WrapSimple(), and mcASSERT.


Friends And Related Function Documentation

friend class mcArrayEntry [friend]
 

Definition at line 218 of file ElementArray.h.

Referenced by mcPolynomialHelpers::math_GetIndexOf(), mcPolynomialHelpers::math_WrapMonomial(), mcMonomialHelpers::math_WrapMonomial(), and mcMonomialHelpers::math_WrapSimple().


Member Data Documentation

int mcElementArrayHelpers::mdata_nElements [protected]
 

Number of mcElements currently inserted in the mdata_pElemArray array.

Definition at line 234 of file ElementArray.h.

Referenced by data_AddElements(), data_DeleteAll(), data_DeleteLast(), data_DetachAll(), data_DetachLastElem(), data_isSameAs(), data_MoveElemLeft(), and data_MoveElemRight().

int mcElementArrayHelpers::mdata_nUpperBound [private]
 

Used to remember the upper bound of the m_pElem array and thus to avoid the use of non-allocated memory.

Definition at line 229 of file ElementArray.h.

Referenced by data_CheckArrayLimit(), data_DeleteAll(), and data_DetachAll().

mcElement* mcElementArrayHelpers::mdata_pElemArray [private]
 

Pointer to the array of mcElements; double deference is required for special operations like array enlargment.

Definition at line 225 of file ElementArray.h.

Referenced by data_CheckArrayLimit(), data_DeepCopy(), data_DeleteAll(), data_DetachAll(), data_MoveElemLeft(), data_MoveElemRight(), data_Set(), and data_Swap().

mcFilter* mcElementArrayHelpers::mdata_pFilter [protected]
 

The filter which is attached to this array.

If NULL, filtering is disabled.

Definition at line 238 of file ElementArray.h.

Referenced by data_ChangeFilter(), data_DeepCopy(), and data_isElementAllowed().

int mcElementArrayHelpers::mgui_nCursorPos [protected]
 

Index of the element which contains the cursor (mgui_nCursorPos cannot index an operator of the array, it must always index a non-operator element).

Definition at line 251 of file ElementArray.h.

Referenced by gui_DeleteNextOp(), gui_DeletePreviousOp(), gui_ExGetRelCursorPos(), gui_ExMoveCursorUsingPoint(), gui_GetCursorPos(), gui_Input(), gui_isEndKey(), gui_MoveCursor(), gui_MoveCursorLeft(), gui_MoveCursorRight(), and gui_SetCursorPos().

bool mcElementArrayHelpers::sgui_bDrawSelectionInverting = TRUE [static]
 

If TRUE, then the selection will be drawn inverting the colours of the selected elements (this is the standard behaviour in all editing systems).

If FALSE, then the sgui_pSelectionPen and the mcElementHelpers::sgui_pSelectionBrush will be used to draw the border and the interior of the selection rectangle.

Definition at line 78 of file ElementArray.cpp.

Referenced by gui_DrawSelection().

wxPen * mcElementArrayHelpers::sgui_pSelectionPen = NULL [static]
 

The pen used to draw the selection rectangle.

By default, mcElementArrayGUI constructor builds a black pen.

Definition at line 77 of file ElementArray.cpp.

Referenced by gui_DrawSelection().


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

Documentation generated with Doxygen on Sun Feb 6 17:12:28 2005
Visit MathStudio home page for more info

[ Top ]