#include <ngrouppresentation.h>
Inheritance diagram for regina::NGroupExpression:
Public Member Functions | |
NGroupExpression () | |
Creates a new expression with no terms. | |
NGroupExpression (const NGroupExpression &cloneMe) | |
Creates a new expression that is a clone of the given expression. | |
std::list< NGroupExpressionTerm > & | getTerms () |
Returns the list of terms in this expression. | |
const std::list< NGroupExpressionTerm > & | getTerms () const |
Returns a constant reference to the list of terms in this expression. | |
unsigned long | getNumberOfTerms () const |
Returns the number of terms in this expression. | |
NGroupExpressionTerm & | getTerm (unsigned long index) |
Returns the term at the given index in this expression. | |
const NGroupExpressionTerm & | getTerm (unsigned long index) const |
Returns a constant reference to the term at the given index in this expression. | |
unsigned long | getGenerator (unsigned long index) const |
Returns the generator corresonding to the term at the given index in this expression. | |
long | getExponent (unsigned long index) const |
Returns the exponent corresonding to the term at the given index in this expression. | |
void | addTermFirst (const NGroupExpressionTerm &term) |
Adds the given term to the beginning of this expression. | |
void | addTermFirst (unsigned long generator, long exponent) |
Adds the given term to the beginning of this expression. | |
void | addTermLast (const NGroupExpressionTerm &term) |
Adds the given term to the end of this expression. | |
void | addTermLast (unsigned long generator, long exponent) |
Adds the given term to the end of this expression. | |
NGroupExpression * | inverse () const |
Returns a newly created expression that is the inverse of this expression. | |
NGroupExpression * | power (long exponent) const |
Returns a newly created expression that is this expression raised to the given power. | |
bool | simplify (bool cyclic=false) |
Simplifies this expression. | |
bool | substitute (unsigned long generator, const NGroupExpression &expansion, bool cyclic=false) |
Replaces every occurrence of the given generator with the given substite expression. | |
void | writeXMLData (std::ostream &out) const |
Writes a chunk of XML containing this expression. | |
void | writeToFile (NFile &out) const |
Writes this expression to the given old-style binary file. | |
virtual void | writeTextShort (std::ostream &out) const |
The text representation will be of the form g2^4 g13^-5 g4 . | |
Static Public Member Functions | |
NGroupExpression * | readFromFile (NFile &in) |
Reads an expression from the given old-style binary file. |
An expression is represented as a sequence of powers of generators all of which are multiplied in order. Each power of a generator corresponds to an individual NGroupExpressionTerm.
For instance, the expression g1^2 g3^-1 g6
contains the three terms g1^2
, g3^-1
and g6^1
in that order.
|
Creates a new expression with no terms.
|
|
Creates a new expression that is a clone of the given expression.
|
|
Adds the given term to the beginning of this expression.
|
|
Adds the given term to the beginning of this expression.
|
|
Adds the given term to the end of this expression.
|
|
Adds the given term to the end of this expression.
|
|
Returns the exponent corresonding to the term at the given index in this expression. Index 0 represents the first term, index 1 represents the second term and so on.
|
|
Returns the generator corresonding to the term at the given index in this expression. Index 0 represents the first term, index 1 represents the second term and so on.
|
|
Returns the number of terms in this expression.
|
|
Returns a constant reference to the term at the given index in this expression. Index 0 represents the first term, index 1 represents the second term and so on.
|
|
Returns the term at the given index in this expression. Index 0 represents the first term, index 1 represents the second term and so on.
|
|
Returns a constant reference to the list of terms in this expression.
|
|
Returns the list of terms in this expression. These are the actual terms stored internally; any modifications made to this list will show up in the expression itself.
|
|
Returns a newly created expression that is the inverse of this expression. The terms will be reversed and the exponents negated.
|
|
Returns a newly created expression that is this expression raised to the given power. Note that the given exponent may be positive, zero or negative.
|
|
Reads an expression from the given old-style binary file. The expression will be newly allocated, and responsibility for its destruction lies with the caller of this routine.
|
|
Simplifies this expression. Adjacent powers of the same generator will be combined, and terms with an exponent of zero will be removed. Note that it is not assumed that the underlying group is abelian.
You may declare that the expression is cyclic, in which case it is assumed that terms may be moved from the back to the front and vice versa. Thus expression
|
|
Replaces every occurrence of the given generator with the given substite expression. If the given generator was found, the expression will be simplified once the substitution is complete.
|
|
The text representation will be of the form
Implements regina::ShareableObject. |
|
Writes this expression to the given old-style binary file.
|
|
Writes a chunk of XML containing this expression.
|