Terms

Classes used for mathematical terms. More...

Classes

class  CASTerm
 Pure abstract class for implementing a term. More...
class  Product
 Implements a multi-term product. More...
class  Sum
 Implements an algebraic sum. More...

Functions

CASObjectSum::Absolute () const
 Returns the absolute representation of the Sum.
CASObjectProduct::Absolute () const
 Returns the absolute representation of the Product.
void Sum::AbsoluteIP ()
 Makes the Sum absolute in-place.
void Product::AbsoluteIP ()
 Makes the Product absolute in-place.
CASObjectSum::Add (const CASObject *addend) const
 Adds a CASObject to the Sum.
CASObjectProduct::Add (const CASObject *addend) const
 Adds a CASObject to the Product.
virtual void CASTerm::Append (const CASObject *a)
 Appends a CASObject to the operands vector.
 CASTerm::CASTerm ()
 Constructor.
CASObjectSum::Clone () const
 Clones the Sum.
CASObjectProduct::Clone () const
 Clones the Product.
CASObjectSum::Collect () const
 Collects operands in the Sum.
CASObjectProduct::Collect () const
 Collects in the Product.
CASObjectSum::CollectEqualOperands () const
 Collects operands of the same value and type.
CASObjectProduct::CollectEqualOperands () const
 Collects operands of the same value and type.
CASObjectSum::CollectNonSingleValues () const
 Collects in non-single values.
CASObjectProduct::CollectOther () const
 Collect all other (non-equal) operands.
CASObjectSum::CollectSingleValues () const
 Collects in single values.
CASObjectSum::Divide (const CASObject *divisor) const
 Divides the Sum by a CASObject.
CASObjectProduct::Divide (const CASObject *divisor) const
 Divides the Product by a CASObject.
CASObjectSum::Evaluate () const
 Evaluates the Sum.
CASObjectProduct::Evaluate () const
 Evaluates the Product.
CASObjectSum::Expand () const
 Expands the Sum.
CASObjectProduct::Expand () const
 Expands the Product.
void Product::ExplodeSumsIP ()
 Expands sums in place.
CASObjectSum::GCD (const CASObject *o) const
 Calculates the gcd of the Sum and a CASObject.
CASObjectProduct::GCD (const CASObject *o) const
 Calculates the gcd of the Product and a CASObject.
void Sum::Get (char *s, unsigned long size) const
 Gets the string representation of the Sum.
void Sum::Get (std::string &s) const
 Gets the string representation of the Sum.
void Product::Get (char *s, unsigned long size) const
 Gets the string representation of the Product.
void Product::Get (std::string &s) const
 Gets the string representation of the Product.
const CASObjectProduct::GetCoefficient () const
 Returns the pointer to the coefficient if any.
virtual void CASTerm::GetNonSingleValues (std::vector< const CASObject * > &lst) const
 Populates a vector with non single values.
void Product::GetNonSums (const std::vector< const CASObject * > &in, std::vector< const CASObject * > &out)
 Get all operands which are not of the CASType CT_SUM.
virtual void CASTerm::GetOperands (const CASTerm *t, std::vector< const CASObject * > &out) const
 Populates the vector with the operands of the given CASTerm.
void Product::GetOperandsWithoutCoefficient (std::vector< const CASObject * > &lst) const
 Returns a vector holding all operands not including the coefficient if any.
virtual void CASTerm::GetSingleValues (std::vector< const CASObject * > &lst) const
 Populates a vector with single values.
void Product::GetSums (const std::vector< const CASObject * > &in, std::vector< const CASObject * > &out)
 Get all operands of the CASType CT_SUM.
virtual bool CASTerm::HaveSameOperands (const CASObject *o) const
 Determines whether or not another CASObject has the same operands.
CASObjectSum::Invert () const
 Returns the inverted representation of the Sum.
CASObjectProduct::Invert () const
 Returns the inverted Product.
void Sum::InvertIP ()
 Inverts the Sum in-place.
void Product::InvertIP ()
 Inverts the Product in-place.
virtual bool CASTerm::IsEqual (const CASObject *o) const
 Indicates whether another CASObject is equal to this.
virtual bool CASTerm::IsGT (const CASObject *o) const
 Indicates whether another CASObject is greater than this.
virtual bool CASTerm::IsLT (const CASObject *o) const
 Indicates whether another CASObject is less than this.
bool Sum::IsOne () const
 Indicates whether or not the Sum is one.
bool Product::IsOne () const
 Indicates whether or not the Product is one.
virtual bool CASTerm::IsPureNumerical () const
 Indicates whether or not this object is a pure numerical.
bool Sum::IsSimilar (const CASObject *o) const
 Indicates whether or not the Sum is similar to a CASObject.
bool Product::IsSimilar (const CASObject *o) const
 Indicates whether or not the Product is similar to a CASObject.
bool Sum::IsZero () const
 Indicates whether or not the Sum is zero.
bool Product::IsZero () const
 Indicates whether or not the Product is zero.
unsigned long Sum::Length () const
 Returns the length of the string representation.
unsigned long Product::Length () const
 Returns the length of the string representation.
CASObjectSum::Modulo (const CASObject *divisor) const
 Calculates the modulus.
CASObjectProduct::Modulo (const CASObject *divisor) const
 Calculates the modulus.
CASObjectSum::Multiply (const CASObject *factor) const
 Multiplies the Sum by a CASObject.
CASObjectProduct::Multiply (const CASObject *factor) const
 Multiplies the Product by a CASObject.
unsigned long CASTerm::NumOperands () const
 Returns the number of operands in the vector.
const SumSum::operator= (const Sum &s)
 Assignment operator.
const ProductProduct::operator= (const Product &f)
 Assignment operator.
virtual CASObjectCASTerm::Power (const CASObject *exp) const
 Exponentiates the term.
void Sum::Print () const
 Prints the string representation to stdout.
void Product::Print () const
 Prints the string representation to the stdout.
 Product::Product (const Product &p)
 Copy constructor.
 Product::Product ()
 Constructor.
void Sum::RemoveNoOpElements ()
 Remove operands having no effect on the Sum.
void Product::RemoveNoOpElements ()
 Removes operands having no effect on the Product.
virtual void CASTerm::SetAllEvaluated ()
 Used to set all subobject into an evaluated state.
virtual void CASTerm::SetOperands (CASTerm *t, const std::vector< CASObject * > &in) const
 Populates the operands of the given CASTerm with the given vector.
virtual void CASTerm::SetOperands (CASTerm *t, const std::vector< const CASObject * > &in) const
 Populates the operands of the given CASTerm with the given vector.
virtual void CASTerm::Sort ()
 Sorts the operands.
virtual CASObjectCASTerm::SortWeight () const
 Returns the sort weight of the CASTerm.
CASObjectSum::Subtract (const CASObject *subtrahend) const
 Subtracts a CASObject from the Sum.
CASObjectProduct::Subtract (const CASObject *subtrahend) const
 Subtracts a CASObject from the Product.
 Sum::Sum (const Sum &s)
 Copy constructor.
 Sum::Sum ()
 Constructor.
virtual void CASTerm::UnsetAllEvaluated ()
 Used to set all subobjects into an unevaluated state.
SumSum::WithExponentOne () const
 Returns the Sum with an exponent of one.
virtual CASTerm::~CASTerm ()
 Destructor.
 Product::~Product ()
 Destructor.
 Sum::~Sum ()
 Destructor.

Detailed Description

Classes which represents mathematical terms.

Function Documentation

CASObject * Sum::Absolute (  )  const [virtual, inherited]

Returns a Sum representing the absolute value of this Sum. Therefor, it clones itself and makes all operands of the clone absolute in-place.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the absolute value of the Sum.

Implements CASObject.

Definition at line 644 of file sum.cc.

CASObject * Product::Absolute (  )  const [virtual, inherited]

Returns a Product representing the absolute value of this Product. Therefor, it clones itself and makes all operands of the clone absolute in-place.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the absolute value of the Product.

Implements CASObject.

Definition at line 738 of file product.cc.

void Sum::AbsoluteIP (  )  [virtual, inherited]

Makes the Sum absolute in-place. Therefor, it makes all operands absolute in place.

Returns:
void.

Implements CASObject.

Definition at line 662 of file sum.cc.

void Product::AbsoluteIP (  )  [virtual, inherited]

Makes the Product absolute in-place. Therefor, it makes all operands absolute in place.

Returns:
void.

Implements CASObject.

Definition at line 757 of file product.cc.

CASObject * Sum::Add ( const CASObject addend  )  const [virtual, inherited]

Adds a CASObject to the Sum. If the addend is a Sum, too, it checks whether or not it is equal to this Sum. If so, it returns a Product with the coefficient set to 2 and this Sum appended.

If the addend is not of the type CT_SUM, it clones itself and searches for a occurence of the type of the addend in the operands vector of the clone. If it finds an operand of the same type, it adds them together. However this is only done, if the exponent of clone is one, thus the exponent of this Sum is one.

As a last resort, it simply puts the addend and this Sum together in a new Sum.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
addend Pointer to a CASObject which is added to the Sum.
Returns:
a pointer to a CASObject representing the sum.

Implements CASObject.

Definition at line 722 of file sum.cc.

CASObject * Product::Add ( const CASObject addend  )  const [virtual, inherited]

Add a CASObject to the Product.

It first checks whether or not the CASObject is of the type CT_PRODUCT. If it is a product:

If the addend is not a CT_PRODUCT:

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
addend Pointer to a CASObject representing the addend.
Returns:
a pointer to a CASObject representing the sum.

Implements CASObject.

Definition at line 821 of file product.cc.

void CASTerm::Append ( const CASObject o  )  [virtual, inherited]

Appends a CASObject to the operands vector. The CASObject o will be cloned, so it does not have to be kept after calling Append().

Remarks:
The CASObject passed is cloned. The caller is responsible for freeing the memory occupied by that CASObject.
Parameters:
o Pointer to a CASObject which will be appended to the operands vector by cloning it first.
Returns:
void.

Definition at line 299 of file casterm.cc.

CASTerm::CASTerm (  )  [inherited]

Constructor. Sets the flag CASMetaInfo::singlevalue to false using CASMetaInfo::UnsetSingleValue().

Definition at line 232 of file casterm.cc.

CASObject * Sum::Clone (  )  const [virtual, inherited]

Clones the Sum by creating a new copy on in the memory.

Remarks:
The Sum returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the cloned Sum.

Implements CASObject.

Definition at line 452 of file sum.cc.

CASObject * Product::Clone (  )  const [virtual, inherited]

Clones the Product by creating a new copy on in the memory.

Remarks:
The Product returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the cloned Product.

Implements CASObject.

Definition at line 461 of file product.cc.

CASObject * Sum::Collect (  )  const [virtual, inherited]

Collects the Sum. This is done by

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the collected Sum.

Implements CASTerm.

Definition at line 1037 of file sum.cc.

CASObject * Product::Collect (  )  const [virtual, inherited]

Collects the Product. This is done by

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the collected form.

Implements CASTerm.

Definition at line 1204 of file product.cc.

CASObject * Sum::CollectEqualOperands (  )  const [private, inherited]

The Sum has to be sorted for collecting. Collecting is done by looping thru all operands and looking ahead if the next operand IsEqual() than the current one. If it is equal, it will be put in a separate vector. After all operands have been processed in this manner, the occurence of the equal objects is used as coefficient for each distinct group of equal objects. This gives a new vector, the final vector holding the objects with their coefficient. Then all the equal objects are destroyed.

The return value is a pointer to a CASObject, because it is not certain that the Sum stays a Sum. For instance, if we collect 'a+a' the result would be '2*a' which is not a Sum anymore.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the collected Sum.

Definition at line 75 of file sum.cc.

CASObject * Product::CollectEqualOperands (  )  const [private, inherited]

The Product has to be sorted for collecting. Collecting is done by looping thru all operands and looking ahead if the next operand IsEqual() than the current one. If it is equal, it will be put in a separate vector. After all operands have been processed in this manner, the occurence of the equal objects is used as exponent for each distinct group of equal objects. This gives a new vector, the final vector holding the objects with their exponents. Then all the equal objects are destroyed.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the collected Product.

Definition at line 103 of file product.cc.

CASObject * Sum::CollectNonSingleValues (  )  const [private, inherited]

Collects remaining non-single values which are not equal, thus have been left untouched by Sum::CollectEqualOperands(). It retrieves a vector holding the non-single values by calling CASTerm::GetNonSingleValues(). It then goes thru all the non-single values and looks for similar CASObject. If it finds similar CASObject, it sums them up replacing the old CASObject with the outcome.

The return value is a pointer to a CASObject, because it is not certain that the Sum stays a Sum. For instance, if we collect '2*a+3*a' the result would be '5*a' which is not a Sum anymore.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject in which all non-single values are collected.

Definition at line 286 of file sum.cc.

CASObject * Product::CollectOther (  )  const [private, inherited]

Collects operands not collected by Product::CollectEqualOperands().

It loops thru all operands and checks them for similarity with the other operands.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the collected Product.

Definition at line 231 of file product.cc.

CASObject * Sum::CollectSingleValues (  )  const [private, inherited]

Collects remaining single values which are not equal, thus have been left untouched by Sum::CollectEqualOperands(). It retrieves a vector holding the single values by calling CASTerm::GetSingleValues(). It then goes thru all the single values and looks for similar CASObject. If it finds similar CASObject, it sums them up replacing the old CASObject with the outcome.

The return value is a pointer to a CASObject, because it is not certain that the Sum stays a Sum. For instance, if we collect '2*a+a' the result would be '3*a' which is not a Sum anymore.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject in which all single values are collected.

Definition at line 195 of file sum.cc.

CASObject * Sum::Divide ( const CASObject divisor  )  const [virtual, inherited]

Divides this Sum by a CASObject. This will always result in a Fraction with this Sum as numerator and the divisor as denominator.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
divisor Pointer to a CASObject which is the divisor.
Returns:
a pointer to a CASObject representing the quotient.

Implements CASObject.

Definition at line 897 of file sum.cc.

CASObject * Product::Divide ( const CASObject divisor  )  const [virtual, inherited]

Divides this Product by a CASObject. The result is a Fraction with this Product as numerator and the CASObject as denominator.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
divisor Pointer to a CASObject representing the divisor.
Returns:
a pointer to a CASObject representing the quotient.

Implements CASObject.

Definition at line 1063 of file product.cc.

CASObject * Sum::Evaluate (  )  const [virtual, inherited]

Evaluates the Sum. This is done by

Further if the outcome of the evaluation is either zero or one, it returns the appropriate LongInt.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the evaluated form.

Implements CASObject.

Definition at line 971 of file sum.cc.

CASObject * Product::Evaluate (  )  const [virtual, inherited]

Evaluates the Product. This is done by:

Further if the outcome of the evaluation is either zero or one, it returns the appropriate LongInt.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the evaluated form.

Implements CASObject.

Definition at line 1137 of file product.cc.

CASObject * Sum::Expand (  )  const [virtual, inherited]

Todo:
Needs to be implemented more efficiently.
Bug:
Stupid as hell (try to expand (a+b)^20), slow as hell and eats up memory due to memory leaks. Does not deal with negative exponents.
Warning:
Before expanding, the Sum has to be evaluated. Otherwise a EEvaluateFirst exception is thrown.
Expands the Sum. Expansion is done only if

Expansion is done in the following fashion:

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the expaned Sum.

Implements CASTerm.

Definition at line 1098 of file sum.cc.

CASObject * Product::Expand (  )  const [virtual, inherited]

Todo:
Needs to be implemented more efficiently.
Bug:
Stupid as hell (try to expand (a+b)^20), slow as hell and eats up memory due to memory leaks. Does not deal with negative exponents.
Warning:
Before expanding, the Product has to be evaluated. Otherwise a EEvaluateFirst exception is thrown.
Expands the Product. Expansion is done only if the Product is already evaluated.

Expansion is done in the following fashion:

This is all done by while() loops. No intelligence is implemented. Therefore, a huge memory consumption is likely when expanding terms with huge exponents.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the expaned Sum.

Implements CASTerm.

Definition at line 1256 of file product.cc.

void Product::ExplodeSumsIP (  )  [private, inherited]

Todo:
Make it work with negative exponents as well.
Bug:
Will choke on negative exponents.
Eplode Sum in-place. It loops thru all operands and checks if they are of the type CT_SUM with an exponent not equal to one. If so, it puts the Sum in the operands vector as many times the exponent says.

Returns:
void.

Definition at line 296 of file product.cc.

CASObject * Sum::GCD ( const CASObject o  )  const [virtual, inherited]

Todo:
Has to be implemented properly. Returns 1 ('one') in any case.
Warning:
Not properly implemented. Returns 1 ('one') in any case.
Computes the greatest common divisor of this Sum and a CASObject.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
o Pointer to a CASObject.
Returns:
a pointer to a CASObject representing the gcd.

Implements CASObject.

Definition at line 943 of file sum.cc.

CASObject * Product::GCD ( const CASObject o  )  const [virtual, inherited]

Todo:
Has to be implemented properly. Returns 1 ('one') in any case.
Warning:
Not properly implemented. Returns 1 ('one') in any case.
Calculates the modulus of this Product and a CASObject.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
o Pointer to a CASObject representing the divisor.
Returns:
pointer to a CASObject representing the modulus.

Implements CASObject.

Definition at line 1109 of file product.cc.

void Sum::Get ( char *  s,
unsigned long  size 
) const [virtual, inherited]

Return the string representation of the Sum as a C-string. If the buffer is too small, a EBufTooSmall exception is thrown.

Remarks:
The buffer has to be freed by the caller.
Parameters:
s Buffer receiving the string representation.
size Size of the buffer. Has to be large enough to hold the string representation.
Returns:
void.

Implements CASObject.

Definition at line 523 of file sum.cc.

void Sum::Get ( std::string &  s  )  const [virtual, inherited]

Returns the string representation of the Sum.

Parameters:
s Reference to a std::string receiving the string representation.
Returns:
void.

Implements CASObject.

Definition at line 467 of file sum.cc.

void Product::Get ( char *  s,
unsigned long  size 
) const [virtual, inherited]

Return the string representation of the Product as a C-string. If the buffer is too small, a EBufTooSmall exception is thrown.

Remarks:
The buffer has to be freed by the caller.
Parameters:
s Buffer receiving the string representation.
size Size of the buffer. Has to be large enough to hold the string representation.
Returns:
void.

Implements CASObject.

Definition at line 546 of file product.cc.

void Product::Get ( std::string &  s  )  const [virtual, inherited]

Returns the string representation of the Product.

Parameters:
s Reference to a std::string receiving the string representation.
s Reference to a std::string.
Returns:
void.

Implements CASObject.

Definition at line 480 of file product.cc.

void CASTerm::GetNonSingleValues ( std::vector< const CASObject * > &  lst  )  const [protected, virtual, inherited]

Populates a vector with non single values, such as Sum and Product. Therefore, it uses std::for_each as well as CASExtractNonSingleValues.

Parameters:
lst A reference to a vector which will hold all non-single values.
Returns:
void.

Definition at line 69 of file casterm.cc.

void Product::GetNonSums ( const std::vector< const CASObject * > &  in,
std::vector< const CASObject * > &  out 
) [private, inherited]

Warning:
Pointers returned points to the operands of this Product. Modifications of those objects are reflected in the Product as well.
Returns all operands of a type not equal to CT_SUM in the operands vector of this Product. The vector returned contains the pointer to the objects in the operands vector. No cloning takes place. So, if the objects in the vector in are modified, this is reflected in the Product operands as well.

Parameters:
in Reference to a vector holding all operands.
out Reference to a vector which will be populated with the pointers to the non Sum objects.
Returns:
void.

Definition at line 385 of file product.cc.

void CASTerm::GetOperands ( const CASTerm t,
std::vector< const CASObject * > &  out 
) const [protected, virtual, inherited]

This method returns the operands of t in out. With this function, it is possible for the offsprings of CASTerm to access one others operands.

Warning:
The pointers to the CASObjects copied into the vector out point to the same objects as the pointers in t. So destroying those objects will result in a disaster.
Parameters:
t Pointer to a CASTerm from which the operands will be copied to the vector.
out Reference to a vector which will be populated with the pointers to the operands of t.
Returns:
void.

Definition at line 157 of file casterm.cc.

void Product::GetOperandsWithoutCoefficient ( std::vector< const CASObject * > &  lst  )  const [private, inherited]

Returns all operands excluding the coefficient if any. The vector returned holds the pointers to the operands in this object (this->operands). Therefore there is no need to destroy the objects pointed to by the returned vector.

Parameters:
lst Vector which will be populated with the operands.
Returns:
void.

Definition at line 67 of file product.cc.

void CASTerm::GetSingleValues ( std::vector< const CASObject * > &  lst  )  const [protected, virtual, inherited]

Populates a vector with non single values, such as Variable and LongInt. Therefore, it uses std::for_each as well as CASExtractNonSingleValues.

Parameters:
lst A reference to a vector which will hold all non-single values.
Returns:
void.

Definition at line 86 of file casterm.cc.

void Product::GetSums ( const std::vector< const CASObject * > &  in,
std::vector< const CASObject * > &  out 
) [private, inherited]

Warning:
Pointers returned points to the operands of this Product. Modifications of those objects are reflected in the Product as well.
Returns all Sum objects in the operands vector. The vector returned contains the pointer to the objects in the operands vector. No cloning takes place. So, if the objects in the vector in are modified, this is reflected in the Product operands as well.

Parameters:
in Reference to a vector holding all operands.
out Reference to a vector which will be populated with the pointers to the Sum object.
Returns:
void.

Definition at line 358 of file product.cc.

bool CASTerm::HaveSameOperands ( const CASObject o  )  const [protected, virtual, inherited]

Determines whether or not another CASObject has the same operands. They must be of the same type, so comparing a Sum with a Product does not work.

The two objects are first cloned and the sorted, in order to prepare them for use with std::equal. They further have to have the same amount of operands, of course.

Parameters:
o Pointer to a CASObject which will be compared to this object.
Returns:
true if the operands are the same, false otherwise.

Definition at line 107 of file casterm.cc.

CASObject * Sum::Invert (  )  const [virtual, inherited]

Inverts the Sum. Therefor, it clones itself and inverts all operands of the clone in-place.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the inverted Sum.

Implements CASObject.

Definition at line 677 of file sum.cc.

CASObject * Product::Invert (  )  const [virtual, inherited]

Inverts the Product. Therefor, it clones itself and inverts all operands of the clone in-place.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a pointer to a CASObject representing the inverted Product.

Implements CASObject.

Definition at line 771 of file product.cc.

void Sum::InvertIP (  )  [virtual, inherited]

Inverts the Sum in-place. Therefor, it inverts all of its operands in-place.

Returns:
void.

Implements CASObject.

Definition at line 695 of file sum.cc.

void Product::InvertIP (  )  [virtual, inherited]

Inverts the Product in-place. Therefor, it inverts all of its operands in-place.

Returns:
void.

Implements CASObject.

Definition at line 789 of file product.cc.

bool CASTerm::IsEqual ( const CASObject o  )  const [virtual, inherited]

Indicates whether o is equal to this CASTerm. This means everything is compared for equalness, the type, the amount of operands, the exponent, and last but not least whether or not the operands are the same.

Remarks:
This object, and o have to be sorted, since std::equal is used.
Parameters:
o Pointer to a CASObject which will be compared to this.
Returns:
true if o is equal to this, false otherwise.

Implements CASObject.

Definition at line 318 of file casterm.cc.

bool CASTerm::IsGT ( const CASObject o  )  const [virtual, inherited]

Todo:
Implement properly. It simply uses GetType() for comparison.
Warning:
Not properly implemented.
Indicates whether o is greater than this object.

Parameters:
o Pointer to a CASObject which is compared to this object.
Returns:
true if this object is greater than o, false otherwise.

Implements CASObject.

Definition at line 380 of file casterm.cc.

bool CASTerm::IsLT ( const CASObject o  )  const [virtual, inherited]

Todo:
Implement properly. It simply uses GetType() for comparison.
Warning:
Not properly implemented.
Indicates whether o is less than this object.

Parameters:
o Pointer to a CASObject which is compared to this object.
Returns:
true if this object is less than o, false otherwise.

Implements CASObject.

Definition at line 359 of file casterm.cc.

bool Sum::IsOne (  )  const [virtual, inherited]

Todo:
Has to be implemented properly. Returns false in any case.
Warning:
Not properly implemented. Returns false in any case.
Indicates whether or not the Sum is one.

Returns:
true if it is one, false otherwise.

Implements CASObject.

Definition at line 606 of file sum.cc.

bool Product::IsOne (  )  const [virtual, inherited]

Indicates whether or not the Product is one. Therefor it checks if every operand is one.

Returns:
true if the Product is one, false otherwise.

Implements CASObject.

Definition at line 628 of file product.cc.

bool CASTerm::IsPureNumerical (  )  const [virtual, inherited]

Indicates whether or not this object is a pure numerical one. It does this by using std::for_each together with CASIsPureNumerical.

Returns:
true if it is a pure numerical object, false otherwise.

Implements CASObject.

Definition at line 406 of file casterm.cc.

bool Sum::IsSimilar ( const CASObject o  )  const [virtual, inherited]

Indicates whether or not a CASObject is similar to this Sum. It calls CASTerm::HaveSameOperands() to find out whether or not o is similar. The exponent is not checked.

Parameters:
o Pointer to a CASObject.
Returns:
true if o is similar, false otherwise.

Implements CASObject.

Definition at line 623 of file sum.cc.

bool Product::IsSimilar ( const CASObject o  )  const [virtual, inherited]

Indicates whether or not a CASObject is similar to this Product. If the CASObject is of type CT_PRODUCT it extracts all non-coefficient operands of both objects and converts the outcome to two Product objects. It then compares the two new Product object using IsEqual().

Parameters:
o Pointer to a CASObject which is tested for similarity.
Returns:
true if the objects are similar, false otherwise.

Implements CASObject.

Definition at line 655 of file product.cc.

bool Sum::IsZero (  )  const [virtual, inherited]

Indicates whether or not the Sum is zero. It is assumed to be zero, if all operands are zero.

Returns:
true if all operands are zero, false otherwise.

Implements CASObject.

Definition at line 580 of file sum.cc.

bool Product::IsZero (  )  const [virtual, inherited]

Indicates whether or not the Product is zero. It is assumed, that if one operand is zero, the entire Product is zero.

Returns:
true if the Product is zero, false otherwise.

Implements CASObject.

Definition at line 604 of file product.cc.

unsigned long Sum::Length (  )  const [virtual, inherited]

Returns the length of the string representation of the Sum.

Returns:
a unsigned long indicating the length of the string representation.

Implements CASObject.

Definition at line 557 of file sum.cc.

unsigned long Product::Length (  )  const [virtual, inherited]

Returns the length of the string representation of the Product.

Returns:
a unsigned long indicating the length of the string representation.

Implements CASObject.

Definition at line 580 of file product.cc.

CASObject * Sum::Modulo ( const CASObject divisor  )  const [virtual, inherited]

Todo:
Has to be implemented properly. Returns 0 ('zero') in any case.
Warning:
Not properly implemented. Returns 0 ('zero') in any case.
Calculates the modulus of this Sum and a CASObject.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
divisor Pointer to a CASObject representing the divisor.
Returns:
pointer to a CASObject representing the modulus.

Implements CASObject.

Definition at line 918 of file sum.cc.

CASObject * Product::Modulo ( const CASObject divisor  )  const [virtual, inherited]

Todo:
Has to be implemented properly. Returns 0 ('zero') in any case.
Warning:
Not properly implemented. Returns 0 ('zero') in any case.
Calculates the modulus of this Product and a CASObject.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
divisor Pointer to a CASObject representing the divisor.
Returns:
pointer to a CASObject representing the modulus.

Implements CASObject.

Definition at line 1086 of file product.cc.

CASObject * Sum::Multiply ( const CASObject factor  )  const [virtual, inherited]

Multiplies this Sum by a CASObject. If the factor is of the same type, CT_SUM, then it checks whether or not the operands are the same, if so, it adds the exponent of the factor to the exponent of this Sum. Else, it simply creates a new Product by appending this and factor as factors.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
factor Pointer to a CASObject which is the factor.
Returns:
a pointer to a CASObject representing the product.

Implements CASObject.

Definition at line 860 of file sum.cc.

CASObject * Product::Multiply ( const CASObject factor  )  const [virtual, inherited]

Multiplies this Product by a CASObject. If the factor is of the type CT_PRODUCT, its operands are appended to the operands of this Product.

If the factor is a different type, it searches for an occurrence of the type of the factor in its operands. If there is a occurrence with the same type, it is multiplied by the factor. If there is no occurrence, the factor is appended to the operands vector and set as coefficient if appropriate.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
factor Pointer to a CASObject which is the factor.
Returns:
a pointer to a CASObject representing the product.

Implements CASObject.

Definition at line 989 of file product.cc.

unsigned long CASTerm::NumOperands (  )  const [inherited]

Returns the number of operands in the operands vector.

Returns:
unsigned long indicating the number of operands in the operands vector.

Definition at line 393 of file casterm.cc.

const Sum & Sum::operator= ( const Sum s  )  [inherited]

Assignment operator.

Parameters:
s Reference to a Sum.
Returns:
const reference to the Sum.

Definition at line 1182 of file sum.cc.

const Product & Product::operator= ( const Product p  )  [inherited]

Assignment operator.

Parameters:
p Reference to a Product.
Returns:
const reference to the Product.

Definition at line 1442 of file product.cc.

CASObject * CASTerm::Power ( const CASObject exp  )  const [virtual, inherited]

Raises the term to the exp-Power. The exisiting exponent will be multiplied by exp.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
exp Pointer to a CASObject, which denotes the exponent, which will be multiplied with the existing one.
Returns:
a pointer to the new CASObject representing the term with the new exponent.

Implements CASObject.

Definition at line 265 of file casterm.cc.

void Sum::Print (  )  const [virtual, inherited]

Prints the string representation to stdout.

Returns:
void.

Implements CASObject.

Definition at line 544 of file sum.cc.

void Product::Print (  )  const [virtual, inherited]

Prints the string representation to stdout.

Returns:
void.

Implements CASObject.

Definition at line 567 of file product.cc.

Product::Product ( const Product p  )  [inherited]

Copy constructor.

Parameters:
p Reference to the Product.

Definition at line 434 of file product.cc.

Product::Product (  )  [inherited]

Constructor. Initializes the Product with a zero length operands vector and sets the exponent to one.

Definition at line 407 of file product.cc.

void Sum::RemoveNoOpElements (  )  [virtual, inherited]

Removes operands which have no effect on the Sum. Zero is considered a noop. This is method is called for each operand as well.

Returns:
void.

Implements CASTerm.

Definition at line 1153 of file sum.cc.

void Product::RemoveNoOpElements (  )  [virtual, inherited]

Removes operands which have no effect on the Product. One is considered a noop. This is method is called for each operand as well.

Returns:
void.

Implements CASTerm.

Definition at line 1412 of file product.cc.

void CASTerm::SetAllEvaluated (  )  [virtual, inherited]

Sets all operands and their operands in turn into the evaluated state by calling CASMetaInfo::SetEvaluated().

Returns:
void.

Definition at line 478 of file casterm.cc.

void CASTerm::SetOperands ( CASTerm t,
const std::vector< CASObject * > &  in 
) const [protected, virtual, inherited]

Replaces the operands vector of t with the operands in in. It has the same purpose as CASTerm::GetOperands(), which is to give access to the offspring of CASTerm to give one others access to the operands.

The operands are cloned.

Parameters:
t Pointer to a CASTerm of which the operands are replaced.
in Reference to the vector which is used to replace the operands of t.
Returns:
void.

Definition at line 210 of file casterm.cc.

void CASTerm::SetOperands ( CASTerm t,
const std::vector< const CASObject * > &  in 
) const [protected, virtual, inherited]

Replaces the operands vector of t with the operands in in. It has the same purpose as CASTerm::GetOperands(), which is to give access to the offspring of CASTerm to give one others access to the operands.

The operands are cloned.

Parameters:
t Pointer to a CASTerm of which the operands are replaced.
in Reference to the vector which is used to replace the operands of t.
Returns:
void.

Definition at line 180 of file casterm.cc.

void CASTerm::Sort (  )  [virtual, inherited]

Sorts itself by calling Sort() for each of its operands and finally sorting the operands vector by calling std::sort. Eventually, it sets the CASMeta::sorted flag by calling CASMeta::SetSorted().

Returns:
void.

Implements CASObject.

Definition at line 438 of file casterm.cc.

CASObject * CASTerm::SortWeight (  )  const [virtual, inherited]

Calculates the sort weight of it. It sums up the sort weight of each of its operands and returns the sum.

Remarks:
The CASObject returned has to be freed by the caller.
Returns:
a CASObject which indicates the sort weight if it.

Implements CASObject.

Definition at line 421 of file casterm.cc.

CASObject * Sum::Subtract ( const CASObject subtrahend  )  const [virtual, inherited]

Subtracts a CASObject from this Sum. If the subtrahend is of the same type, hence CT_SUM, it appends all operands of the subtrahend in their inverted form.

If the subtrahend is a different type, it searches for an occurrence of that type in its operands and subtracts the subtrahend from that object, if any is found.

As last resort, it simply appends the inverted form of the subtrahend to a cloned Sum.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
subtrahend Pointer to a CASObject which is subtracted from this Sum.
Returns:
a pointer to a CASObject representing the sum.

Implements CASObject.

Definition at line 806 of file sum.cc.

CASObject * Product::Subtract ( const CASObject subtrahend  )  const [virtual, inherited]

Todo:
Implement completely in the same manner as Product::Add().
Warning:
Not fully implemented.
It creates a new Sum and apends this Product and the inverted form of the subtrahend.

Remarks:
The CASObject returned has to be freed by the caller.
Parameters:
subtrahend Pointer to a CASObject representing the subtrahend.
Returns:
a pointer to a CASObject representing the difference as a Sum.

Implements CASObject.

Definition at line 959 of file product.cc.

Sum::Sum ( const Sum s  )  [inherited]

Copy constructor.

Parameters:
s Reference to Sum.

Definition at line 412 of file sum.cc.

Sum::Sum (  )  [inherited]

Constructor. Initializes the Sum with a zero length operands vector and sets the exponent to one.

Definition at line 399 of file sum.cc.

void CASTerm::UnsetAllEvaluated (  )  [virtual, inherited]

Sets all operands and their operands in turn into the enevaluated state by calling CASMetaInfo::UnsetEvaluated().

Returns:
void.

Definition at line 458 of file casterm.cc.

Sum * Sum::WithExponentOne (  )  const [private, inherited]

Returns a copy of this Sum with the exponent set to 1 ('one').

Remarks:
The Sum returned has to be freed by the caller.
Returns:
pointer to a Sum.

Definition at line 373 of file sum.cc.

CASTerm::~CASTerm (  )  [virtual, inherited]

Destructor. Destroys all the operands.

Definition at line 239 of file casterm.cc.

Product::~Product (  )  [inherited]

Destructor. Destroys the exponent. Operands are destroyed by CASTerm::~CASTerm().

Definition at line 419 of file product.cc.

Sum::~Sum (  )  [inherited]

Destructor. Destroys the exponent. Operands are destroyed by CASTerm::~CASTerm().

Definition at line 429 of file sum.cc.


Generated on Sun Dec 31 01:57:29 2006 for ECAS by  doxygen 1.4.7