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

mcFraction Class Reference

#include <Fraction.h>

Inheritance diagram for mcFraction:

Inheritance graph
[legend]
Collaboration diagram for mcFraction:

Collaboration graph
[legend]
List of all members.

Detailed Description

Implements a simple fraction in the program, working as a simple container class of two mcPolynomial classes (to hold numerator and denominator).

The user can edit the fraction as any other element, switching from numerator to denominator using the up or right keys.

Definition at line 361 of file Fraction.h.

Public Member Functions

 mcFraction (const mcNumber &n, const mcNumber &d)
bool data_isValidContainerFor (mcElementType t) const
 Returns TRUE if this element can safely contain the given element type.
mcWRAPPER void data_SetDen (const mcPolynomial &p)
mcWRAPPER void data_SetNum (const mcPolynomial &p)
mcWRAPPER void data_AddElements (bool bNum, mcElement *p, int num, int pos=-1, bool bOverwrite=FALSE, bool bForceCopy=FALSE)
mcWRAPPER mcPolynomialdata_GetNum ()
mcWRAPPER mcPolynomialdata_GetDen ()
mcWRAPPER wxPoint gui_GetNumPos () const
mcWRAPPER wxPoint gui_GetDenPos () const
mcWRAPPER void gui_SetCursorOnDen (mcCursorPos cp=mcCP_END)
mcWRAPPER void gui_SetCursorOnNum (mcCursorPos cp=mcCP_END)
mcWRAPPER void math_Flip ()

Private Member Functions

 mcDEFINE_MAIN_CLASS (Fraction, mcElement)


Constructor & Destructor Documentation

mcFraction::mcFraction const mcNumber n,
const mcNumber d
[inline]
 

Definition at line 367 of file Fraction.h.

References data_SetDen(), data_SetNum(), and mcObject::data_SetRefData().


Member Function Documentation

mcWRAPPER void mcFraction::data_AddElements bool  bNum,
mcElement p,
int  num,
int  pos = -1,
bool  bOverwrite = FALSE,
bool  bForceCopy = FALSE
[inline]
 

Definition at line 378 of file Fraction.h.

References mcElementArray::data_AddElements(), and mcWRAPPER.

Referenced by mcMonomialHelpers::gui_AddNewElement().

mcWRAPPER mcPolynomial& mcFraction::data_GetDen  )  [inline]
 

Definition at line 383 of file Fraction.h.

References mcWRAPPER.

Referenced by mcMonomialHelpers::data_TransformDivOp(), mcMonomialHelpers::gui_AddNewElement(), mcFractionHelpers::math_Add(), mcFractionHelpers::math_Compare(), mcMonomialHelpers::math_DivideBy(), mcFractionHelpers::math_GetGCD(), mcFractionHelpers::math_GetLCM(), mcNumberHelpers::math_MakeReciprocal(), mcElementHelpers::math_MakeReciprocal(), mcFractionHelpers::math_MultiplyBy(), and mcNumberHelpers::math_TransformInFraction().

mcWRAPPER mcPolynomial& mcFraction::data_GetNum  )  [inline]
 

Definition at line 382 of file Fraction.h.

References mcWRAPPER.

Referenced by mcMonomialHelpers::data_TransformDivOp(), mcMonomialHelpers::gui_AddNewElement(), mcFractionHelpers::math_Add(), mcFractionHelpers::math_Compare(), mcFractionHelpers::math_GetGCD(), mcFractionHelpers::math_GetLCM(), mcElementHelpers::math_MakeReciprocal(), mcFractionHelpers::math_MultiplyBy(), and mcNumberHelpers::math_TransformInFraction().

bool mcFraction::data_isValidContainerFor mcElementType  t  )  const [inline, virtual]
 

Returns TRUE if this element can safely contain the given element type.

Without this function a lot of errors could be undetectable:

        mcPolynomial pol; // creates a new polynomial
        mcElement e(pol); // references it
        [...]    // the programmers forgots what "e" references
        mcFraction f(e);  // mcFraction wraps a mcPolynomialHelpers class !
        f.data_GetNum();  // CRASH

This function must be overridden by mcElement-derived classes in order to provide a list of the mcElementType it can safely contain.

Reimplemented from mcElement.

Definition at line 370 of file Fraction.h.

References mcET_FRACTION.

mcWRAPPER void mcFraction::data_SetDen const mcPolynomial p  )  [inline]
 

Definition at line 373 of file Fraction.h.

References mcWRAPPER.

Referenced by mcPolynomialHelpers::math_DivideBy(), mcElementArrayHelpers::math_EmbedInFraction(), mcFractionHelpers::math_GetGCD(), mcFractionHelpers::math_GetLCM(), mcBracketHelpers::math_MakeReciprocal(), and mcFraction().

mcWRAPPER void mcFraction::data_SetNum const mcPolynomial p  )  [inline]
 

Definition at line 375 of file Fraction.h.

References mcWRAPPER.

Referenced by mcElementArrayHelpers::math_EmbedInFraction(), mcFractionHelpers::math_GetGCD(), mcFractionHelpers::math_GetLCM(), mcNumberHelpers::math_MakeReciprocal(), and mcFraction().

mcWRAPPER wxPoint mcFraction::gui_GetDenPos  )  const [inline]
 

Definition at line 389 of file Fraction.h.

References mcWRAPPER.

mcWRAPPER wxPoint mcFraction::gui_GetNumPos  )  const [inline]
 

Definition at line 387 of file Fraction.h.

References mcWRAPPER.

mcWRAPPER void mcFraction::gui_SetCursorOnDen mcCursorPos  cp = mcCP_END  )  [inline]
 

Definition at line 392 of file Fraction.h.

References mcWRAPPER.

Referenced by mcMonomialHelpers::gui_AddNewElement().

mcWRAPPER void mcFraction::gui_SetCursorOnNum mcCursorPos  cp = mcCP_END  )  [inline]
 

Definition at line 394 of file Fraction.h.

References mcWRAPPER.

mcWRAPPER void mcFraction::math_Flip  )  [inline]
 

Definition at line 398 of file Fraction.h.

References mcWRAPPER.

Referenced by mcFractionHelpers::math_DivideBy().

mcFraction::mcDEFINE_MAIN_CLASS Fraction  ,
mcElement 
[private]
 


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

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

[ Top ]