Sum Class Reference
[Terms]

Implements an algebraic sum. More...

#include <sum.h>

Inheritance diagram for Sum:

CASTerm CASObject List of all members.

Public Member Functions

CASObjectAbsolute () const
 Returns the absolute representation of the Sum.
void AbsoluteIP ()
 Makes the Sum absolute in-place.
CASObjectAdd (const CASObject *addend) const
 Adds a CASObject to the Sum.
CASObjectClone () const
 Clones the Sum.
CASObjectCollect () const
 Collects operands in the Sum.
CASObjectDivide (const CASObject *divisor) const
 Divides the Sum by a CASObject.
CASObjectEvaluate () const
 Evaluates the Sum.
CASObjectExpand () const
 Expands the Sum.
CASObjectGCD (const CASObject *o) const
 Calculates the gcd of the Sum and a CASObject.
void Get (char *s, unsigned long size) const
 Gets the string representation of the Sum.
void Get (std::string &s) const
 Gets the string representation of the Sum.
CASType GetType () const
 Returns the CASType of the Sum.
CASObjectInvert () const
 Returns the inverted representation of the Sum.
void InvertIP ()
 Inverts the Sum in-place.
bool IsOne () const
 Indicates whether or not the Sum is one.
bool IsSimilar (const CASObject *o) const
 Indicates whether or not the Sum is similar to a CASObject.
bool IsZero () const
 Indicates whether or not the Sum is zero.
unsigned long Length () const
 Returns the length of the string representation.
CASObjectModulo (const CASObject *divisor) const
 Calculates the modulus.
CASObjectMultiply (const CASObject *factor) const
 Multiplies the Sum by a CASObject.
const Sumoperator= (const Sum &s)
 Assignment operator.
void Print () const
 Prints the string representation to stdout.
void RemoveNoOpElements ()
 Remove operands having no effect on the Sum.
CASObjectSubtract (const CASObject *subtrahend) const
 Subtracts a CASObject from the Sum.
 Sum (const Sum &s)
 Copy constructor.
 Sum ()
 Constructor.
 ~Sum ()
 Destructor.

Private Member Functions

CASObjectCollectEqualOperands () const
 Collects operands of the same value and type.
CASObjectCollectNonSingleValues () const
 Collects in non-single values.
CASObjectCollectSingleValues () const
 Collects in single values.
SumWithExponentOne () const
 Returns the Sum with an exponent of one.

Friends

class CASConvert
 Friend for converting to this CASType.
void evaluate_operands (Sum *)
 Friend for evaluating operands.
void expand_operands (Sum *)
 Friend for expanding operands.
void resolve_parentheses (CASObject *)
 Friend for resolving parentheses.

Detailed Description

Implements an algebraic sum. It is derived from CASTerm.

Objects can either be appended by calling Append() or they can be used as operands of the various arithmetic operations.

Definition at line 60 of file sum.h.


Member Function Documentation

CASType Sum::GetType (  )  const [inline, virtual]

Returns the CASType of the Sum, which is always CT_SUM.

Returns:
CT_SUM.

Implements CASObject.

Definition at line 104 of file sum.h.


Friends And Related Function Documentation

friend class CASConvert [friend]

CASConvert has to be the friend because it modifies private attributes directly when doing conversions.

Definition at line 224 of file sum.h.

void evaluate_operands ( Sum  )  [friend]

Friend for evaluating operands. It needs direct access to the operands vector.

void expand_operands ( Sum  )  [friend]

Friend for expanding operands. It needs direct access to the operands vector.

void resolve_parentheses ( CASObject o  )  [friend]

Note:
This template expects to be a friend of the class it resolves the parentheses.
Used to resolve parentheses of a certain type specified by the parameter T. The parameter T is used to determine when to stop parenthese resolution, e.g. if T specifies a Sum, the resolution is stopped when another type as Sum is encountered.

Resolving parentheses is done in the following manner:

It loops thru all operands of the CASObject and checks if they are of the same type as the object itself, if so, it appends their operands to the operands list of the object.

Parameters:
o Pointer to a CASObject of which the parentheses have to be resolved.
Returns:
void.

Definition at line 86 of file castemplates.h.


The documentation for this class was generated from the following files:
Generated on Sun Dec 31 01:57:37 2006 for ECAS by  doxygen 1.4.7