Product Class Reference
[Terms]

Implements a multi-term product. More...

#include <product.h>

Inheritance diagram for Product:

CASTerm CASObject List of all members.

Public Member Functions

CASObjectAbsolute () const
 Returns the absolute representation of the Product.
void AbsoluteIP ()
 Makes the Product absolute in-place.
CASObjectAdd (const CASObject *addend) const
 Adds a CASObject to the Product.
CASObjectClone () const
 Clones the Product.
CASObjectCollect () const
 Collects in the Product.
CASObjectDivide (const CASObject *divisor) const
 Divides the Product by a CASObject.
CASObjectEvaluate () const
 Evaluates the Product.
CASObjectExpand () const
 Expands the Product.
CASObjectGCD (const CASObject *o) const
 Calculates the gcd of the Product and a CASObject.
void Get (char *s, unsigned long size) const
 Gets the string representation of the Product.
void Get (std::string &s) const
 Gets the string representation of the Product.
CASType GetType () const
 Returns the CASType of the Product.
CASObjectInvert () const
 Returns the inverted Product.
void InvertIP ()
 Inverts the Product in-place.
bool IsOne () const
 Indicates whether or not the Product is one.
bool IsSimilar (const CASObject *o) const
 Indicates whether or not the Product is similar to a CASObject.
bool IsZero () const
 Indicates whether or not the Product 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 Product by a CASObject.
const Productoperator= (const Product &f)
 Assignment operator.
void Print () const
 Prints the string representation to the stdout.
 Product (const Product &p)
 Copy constructor.
 Product ()
 Constructor.
void RemoveNoOpElements ()
 Removes operands having no effect on the Product.
CASObjectSubtract (const CASObject *subtrahend) const
 Subtracts a CASObject from the Product.
 ~Product ()
 Destructor.

Private Member Functions

CASObjectCollectEqualOperands () const
 Collects operands of the same value and type.
CASObjectCollectOther () const
 Collect all other (non-equal) operands.
void ExplodeSumsIP ()
 Expands sums in place.
const CASObjectGetCoefficient () const
 Returns the pointer to the coefficient if any.
void GetNonSums (const std::vector< const CASObject * > &in, std::vector< const CASObject * > &out)
 Get all operands which are not of the CASType CT_SUM.
void GetOperandsWithoutCoefficient (std::vector< const CASObject * > &lst) const
 Returns a vector holding all operands not including the coefficient if any.
void GetSums (const std::vector< const CASObject * > &in, std::vector< const CASObject * > &out)
 Get all operands of the CASType CT_SUM.

Friends

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

Detailed Description

Implements a multi-term product. 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 product.h.


Member Function Documentation

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

Returns the CASType of the Product, which is always CT_PRODUCT.

Returns:
CT_PRODUCT.

Implements CASObject.

Definition at line 122 of file product.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 244 of file product.h.

void evaluate_operands ( Product  )  [friend]

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

void expand_operands ( Product  )  [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