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

mcRadicalHelpers Class Reference

#include <Radical.h>

Inheritance diagram for mcRadicalHelpers:

Inheritance graph
[legend]
Collaboration diagram for mcRadicalHelpers:

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 56 of file Radical.h.

Public Member Functions

virtual int gui_GetSpaceAboveBelow () const
 The additional space added above and below the parentheses.
virtual int gui_GetSpaceLeftRight () const
 mcRadicalHelpers ()
virtual ~mcRadicalHelpers ()
int gui_GetVWidth () const
 Returns the width of the 'V' of the radical symbol.
bool math_hasIdx () const
mcPolynomialmath_GetIdx ()
const mcPolynomialmath_GetIdx () const
mcRealValue math_Evaluate () const
 Evaluates the numeric value of this element and then returns it.
mcMathType math_GetBaseMathType () const
mcExpSimRes math_SimplifyContents (long flags, mcElement *newelem)
mcExpSimRes math_ExpandContents (long flags, mcElement *newelem)
int math_GetOrderPos () const
 A mcRadical has a complexity/lenght of 1.0 that is, twice the lenght of an element with a.
bool io_isBeginTag (const wxXml2Node &tag) const
 Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise.
bool io_isBeginChar (const wxString &str) const
 Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise.
wxXml2Node io_GetMathML (bool bGetPresentation) const
 Returns the MathML tree which describes this element and, eventually, its exponent and its subscript.
wxXml2Node io_GetBaseMathML (bool bGetPresentation) const
 Returns a MathML tree with the presentation math markup language regarding the base.
bool io_ImportPresentationMathML (wxXml2Node tag, wxString &pErr)
 Imports presentation MathML reading the contents of the given XML node (without modifying it).
wxString io_GetInlinedExpr () const
 Returns the inlined expression for this element as a wxString.
wxString io_GetBaseInlinedExpr () const
bool io_ImportBaseInlinedExpr (const wxString &, int *, wxString &)
mcExpContainer overloaded functions
Functions which implements the mcExpContainer abstract functions modifyng the default behaviour of the exponent, transforming it in the index of the radical.

bool gui_isBeginKey (const mcKey &key) const
 Returns a positive value if the given character marks the begin of this element; FALSE otherwise.
void gui_DrawContainer (wxDC &, int x, int y, long flags, const wxPoint &) const
bool gui_isLeftPosEnabled () const
 The left position of a mcRadical depends from the presence of the index...
bool gui_isRightPosEnabled () const
 To insert something outside a mcRadical, you need to move the cursor out of the root symbol.
void gui_DoRecalcBaseSize ()
 Calculates (in the m_szBase variable) the size of the base only.
int gui_GetExpOffsetx () const
int gui_GetContentOffsetX () const
int gui_GetContentOffsetY () const
int gui_GetBaseOffsety () const
 VERY IMPORTANT: a mcRadical doesn't draw the base as mcExpElement normally expect; it draws the.

Static Public Member Functions

static bool io_isRadicalBeginChar (const wxString &str)

Static Public Attributes

static mcKeysgui_pNewRadical = NULL
 The key to use to create this element.
static int sgui_nSpaceAboveBelow = 2
static int sgui_nSpaceLeftRight = 4
static wxString sio_strSquareRoot = wxT("sqrt")
static wxString sio_strGenericRoot = wxT("root")

Private Member Functions

 mcDEFINE_REFERENCE_DATA (mcRadical, mcET_RADICAL)


Constructor & Destructor Documentation

mcRadicalHelpers::mcRadicalHelpers  )  [inline]
 

Definition at line 85 of file Radical.h.

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

Definition at line 93 of file Radical.h.


Member Function Documentation

void mcRadicalHelpers::gui_DoRecalcBaseSize  )  [virtual]
 

Calculates (in the m_szBase variable) the size of the base only.

It's very important not to modify the m_sz variable: m_sz is handled by mcExpElement functions: the base must modify ONLY *m_szBase*.

Implements mcExpElementHelpers.

Definition at line 116 of file Radical.cpp.

References mcExpContainerHelpers::data_GetContent(), mcExpElementHelpers::gui_GetExpSubSize(), mcElement::gui_GetSize(), gui_GetSpaceAboveBelow(), gui_GetSpaceLeftRight(), mcElementHelpers::gui_GetThickness(), gui_GetVWidth(), and mcMAX.

void mcRadicalHelpers::gui_DrawContainer wxDC &  ,
int  x,
int  y,
long  flags,
const wxPoint & 
const [virtual]
 

Implements mcExpContainerHelpers.

Definition at line 132 of file Radical.cpp.

References mcExpElementHelpers::gui_GetBaseSize(), mcExpElementHelpers::gui_GetExpSubSize(), mcElementHelpers::gui_GetThickness(), gui_GetVWidth(), mcElementHelpers::gui_GetWidth(), and mcMAX.

int mcRadicalHelpers::gui_GetBaseOffsety  )  const [inline, virtual]
 

VERY IMPORTANT: a mcRadical doesn't draw the base as mcExpElement normally expect; it draws the.

Reimplemented from mcExpElementHelpers.

Definition at line 149 of file Radical.h.

int mcRadicalHelpers::gui_GetContentOffsetX  )  const [virtual]
 

Implements mcExpContainerHelpers.

Definition at line 98 of file Radical.cpp.

References mcExpElementHelpers::gui_GetExpSubSize(), gui_GetSpaceLeftRight(), gui_GetVWidth(), and mcMAX.

int mcRadicalHelpers::gui_GetContentOffsetY  )  const [virtual]
 

Implements mcExpContainerHelpers.

Definition at line 90 of file Radical.cpp.

References mcExpContainerHelpers::data_GetContent(), mcElement::gui_GetHeight(), mcElementHelpers::gui_GetHeight(), gui_GetSpaceAboveBelow(), and mcElementHelpers::gui_GetThickness().

int mcRadicalHelpers::gui_GetExpOffsetx  )  const
 

Definition at line 105 of file Radical.cpp.

virtual int mcRadicalHelpers::gui_GetSpaceAboveBelow  )  const [inline, virtual]
 

The additional space added above and below the parentheses.

Reimplemented from mcExpContainerHelpers.

Definition at line 69 of file Radical.h.

Referenced by gui_DoRecalcBaseSize(), and gui_GetContentOffsetY().

virtual int mcRadicalHelpers::gui_GetSpaceLeftRight  )  const [inline, virtual]
 

Reimplemented from mcExpContainerHelpers.

Definition at line 70 of file Radical.h.

Referenced by gui_DoRecalcBaseSize(), and gui_GetContentOffsetX().

int mcRadicalHelpers::gui_GetVWidth  )  const
 

Returns the width of the 'V' of the radical symbol.

Definition at line 111 of file Radical.cpp.

References mcExpElementHelpers::gui_GetExpSubSize(), and mcMAX.

Referenced by gui_DoRecalcBaseSize(), gui_DrawContainer(), and gui_GetContentOffsetX().

bool mcRadicalHelpers::gui_isBeginKey const mcKey key  )  const [virtual]
 

Returns a positive value if the given character marks the begin of this element; FALSE otherwise.

The begin character cannot be dependent from any variable; it must be always the same. The character is given both as ASCII code and as virtual key code.

Parameters:
ev The wxWidgets key event for the keypress. It contains the untraslated code for the input key; see wxWidgets KeyCodes for more info.
Returns:
A value identifying the subclass of this element that matched the given character; if the element has no subclasses it should return a null value when the given character is the begin character of the element. See MathCore::NewElem for more info.

Implements mcElementHelpers.

Definition at line 76 of file Radical.cpp.

References sgui_pNewRadical.

bool mcRadicalHelpers::gui_isLeftPosEnabled  )  const [virtual]
 

The left position of a mcRadical depends from the presence of the index...

Implements mcExpContainerHelpers.

Definition at line 83 of file Radical.cpp.

References mcElementHelpers::data_hasProperty(), and mcEP_HASEXPONENT.

bool mcRadicalHelpers::gui_isRightPosEnabled  )  const [inline, virtual]
 

To insert something outside a mcRadical, you need to move the cursor out of the root symbol.

Implements mcExpContainerHelpers.

Definition at line 137 of file Radical.h.

wxString mcRadicalHelpers::io_GetBaseInlinedExpr  )  const [inline, virtual]
 

Implements mcExpElementHelpers.

Definition at line 208 of file Radical.h.

wxXml2Node mcRadicalHelpers::io_GetBaseMathML bool  bGetPresentation  )  const [virtual]
 

Returns a MathML tree with the presentation math markup language regarding the base.

This function should work exactly as the hononymous mcElement function.

Parameters:
bGetPresentation If TRUE, this function returns the presentation MathML, otherwise it returns the content markup.

Reimplemented from mcExpContainerHelpers.

Definition at line 180 of file Radical.cpp.

wxString mcRadicalHelpers::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", ....

Reimplemented from mcExpElementHelpers.

Definition at line 208 of file Radical.cpp.

References mcExpContainerHelpers::data_GetContent(), mcExpElementHelpers::data_GetExp(), mcElementHelpers::data_hasProperty(), mcElement::io_GetInlinedExpr(), mcEP_HASEXPONENT, sio_strGenericRoot, and sio_strSquareRoot.

wxXml2Node mcRadicalHelpers::io_GetMathML bool  bGetPresentation  )  const [virtual]
 

Returns the MathML tree which describes this element and, eventually, its exponent and its subscript.

Reimplemented from mcExpElementHelpers.

Definition at line 186 of file Radical.cpp.

References mcExpContainerHelpers::data_GetContent(), mcExpElementHelpers::data_GetExp(), mcElementHelpers::data_hasProperty(), and mcEP_HASEXPONENT.

bool mcRadicalHelpers::io_ImportBaseInlinedExpr const wxString &  ,
int *  ,
wxString & 
[virtual]
 

Implements mcExpElementHelpers.

Definition at line 233 of file Radical.cpp.

References mcExpElementHelpers::data_CreateExpSub(), mcExpContainerHelpers::data_GetContent(), mcExpElementHelpers::data_GetExp(), mcElementHelpers::data_hasProperty(), mcFunctionHelpers::io_ImportArgument(), mcExpElementHelpers::io_ImportInlinedExpr(), mcExpElementHelpers::math_GetExp(), mcElementArray::math_WrapNumber(), mcASSERT, mcEP_HASEXPONENT, sio_strGenericRoot, and sio_strSquareRoot.

bool mcRadicalHelpers::io_ImportPresentationMathML wxXml2Node  tag,
wxString &  pErr
[virtual]
 

Imports presentation MathML reading the contents of the given XML node (without modifying it).

This function is called only if io_isBeginTag function returns a positive value for the name of parent tag of pTag.

Parameters:
pTag The wxXML_***_NODE class to parse.
pErr The string where the error description is placed, if the function returns FALSE.
Returns:
TRUE on success (no mismatched or invalid tags).

Reimplemented from mcExpContainerHelpers.

Definition at line 228 of file Radical.cpp.

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

Returns a positive value if the given inlined expression marks the begin of this element; FALSE otherwise.

The begin tag cannot be dependent from any variable; it must be always the same.

Implements mcElementHelpers.

Definition at line 199 of file Radical.h.

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

Returns a positive value if the given MathML content tag marks the begin of this element; FALSE otherwise.

The begin tag cannot be dependent from any variable; it must be always the same.

Parameters:
tag The string containing the TAG to test.
Returns:
A value identifying the subclass of this element that matched the given character; if the element has no subclasses it should return a null value when the given character is the begin character of the element. See MathCore::NewElem for more info

Reimplemented from mcExpContainerHelpers.

Definition at line 185 of file Radical.h.

static bool mcRadicalHelpers::io_isRadicalBeginChar const wxString &  str  )  [inline, static]
 

Definition at line 192 of file Radical.h.

Referenced by mcMonomialHelpers::io_ImportInlinedExpr().

mcRealValue mcRadicalHelpers::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.

Reimplemented from mcExpElementHelpers.

Definition at line 302 of file Radical.cpp.

References mcElement::math_Evaluate(), mcExpContainerHelpers::math_EvaluateBase(), math_GetIdx(), math_hasIdx(), and mcRealValue::root().

mcExpSimRes mcRadicalHelpers::math_ExpandContents long  flags,
mcElement newelem
[virtual]
 

Implements mcExpContainerHelpers.

Definition at line 378 of file Radical.cpp.

References mcESR_DONE.

mcMathType mcRadicalHelpers::math_GetBaseMathType  )  const [virtual]
 

Reimplemented from mcExpContainerHelpers.

Definition at line 316 of file Radical.cpp.

References mcMathType::m_tMath1, mcElementHelpers::math_ContainsUnknowns(), mcExpContainerHelpers::math_GetBaseMathType(), math_GetIdx(), math_hasIdx(), and mcMTL1_RATIONAL.

const mcPolynomial& mcRadicalHelpers::math_GetIdx  )  const [inline]
 

Definition at line 163 of file Radical.h.

mcPolynomial& mcRadicalHelpers::math_GetIdx  )  [inline]
 

Definition at line 162 of file Radical.h.

Referenced by math_Evaluate(), math_GetBaseMathType(), and math_SimplifyContents().

int mcRadicalHelpers::math_GetOrderPos  )  const [inline, virtual]
 

A mcRadical has a complexity/lenght of 1.0 that is, twice the lenght of an element with a.

Implements mcElementHelpers.

Definition at line 176 of file Radical.h.

bool mcRadicalHelpers::math_hasIdx  )  const [inline]
 

Definition at line 161 of file Radical.h.

Referenced by math_Evaluate(), and math_GetBaseMathType().

mcExpSimRes mcRadicalHelpers::math_SimplifyContents long  flags,
mcElement newelem
[virtual]
 

Implements mcExpContainerHelpers.

Definition at line 332 of file Radical.cpp.

References mcExpContainerHelpers::data_GetContent(), mcExpElement::data_GetExp(), mcElement::data_GetType(), mcElement::math_EvaluatesTo(), mcElementArray::math_Get(), mcPolynomial::math_Get(), mcElementArray::math_GetCount(), math_GetIdx(), mcElement::math_SimpleDivideBy(), mcASSERT, mcESR_DONE, mcET_BRACKET, and mcET_NUMBER.

mcRadicalHelpers::mcDEFINE_REFERENCE_DATA mcRadical  ,
mcET_RADICAL 
[private]
 


Member Data Documentation

int mcRadicalHelpers::sgui_nSpaceAboveBelow = 2 [static]
 

Definition at line 57 of file Radical.cpp.

int mcRadicalHelpers::sgui_nSpaceLeftRight = 4 [static]
 

Definition at line 56 of file Radical.cpp.

mcKey * mcRadicalHelpers::sgui_pNewRadical = NULL [static]
 

The key to use to create this element.

Definition at line 66 of file Radical.cpp.

Referenced by gui_isBeginKey().

wxString mcRadicalHelpers::sio_strGenericRoot = wxT("root") [static]
 

Definition at line 59 of file Radical.cpp.

Referenced by io_GetInlinedExpr(), and io_ImportBaseInlinedExpr().

wxString mcRadicalHelpers::sio_strSquareRoot = wxT("sqrt") [static]
 

Definition at line 60 of file Radical.cpp.

Referenced by io_GetInlinedExpr(), and io_ImportBaseInlinedExpr().


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

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

[ Top ]