org.rubato.math.module
Interface ModuleElement

All Superinterfaces:
java.lang.Cloneable, java.lang.Comparable<ModuleElement>, java.io.Serializable, XMLInputOutput<ModuleElement>
All Known Subinterfaces:
CFreeElement, FreeElement, ModularPolynomialFreeElement, PolynomialFreeElement, ProductFreeElement, QFreeElement, QStringFreeElement, RFreeElement, RStringFreeElement, ZFreeElement, ZnFreeElement, ZnStringFreeElement, ZStringFreeElement
All Known Implementing Classes:
CElement, CProperFreeElement, DirectSumElement, ModularPolynomialElement, ModularPolynomialProperFreeElement, PolynomialElement, PolynomialProperFreeElement, ProductElement, ProductProperFreeElement, ProperFreeElement, QElement, QProperFreeElement, QStringElement, QStringProperFreeElement, RElement, RestrictedElement, RingElement, RProperFreeElement, RStringElement, RStringProperFreeElement, StringElement, ZElement, ZnElement, ZnProperFreeElement, ZnStringElement, ZnStringProperFreeElement, ZProperFreeElement, ZStringElement, ZStringProperFreeElement

public interface ModuleElement
extends java.lang.Cloneable, java.io.Serializable, java.lang.Comparable<ModuleElement>, XMLInputOutput<ModuleElement>

The interface for elements in a module.

Author:
Gérard Milmeister
See Also:
Module

Method Summary
 void add(ModuleElement element)
          Adds element to this module element.
 ModuleElement cast(Module module)
          Tries to cast this element to an element in the given module.
 ModuleElement clone()
          Returns a deep copy of this module element.
 int compareTo(ModuleElement object)
          Compares this module element with object.
 ModuleElement difference(ModuleElement element)
          Returns the difference of this module element and element.
 boolean equals(java.lang.Object object)
          Returns true iff this element is equal to object.
 double[] fold(ModuleElement[] elements)
          Fold elements assuming they are of this same type.
 ModuleElement getComponent(int i)
          Returns the i-th component element.
 int getLength()
          Returns the length of the element.
 Module getModule()
          Returns the module that this module element is an element of.
 int hashCode()
          Returns the hash code for this module element.
 boolean isZero()
          Returns true iff this element is zero.
 void negate()
          Negate this module element.
 ModuleElement negated()
          Returns the negative of this module element.
 void scale(RingElement element)
          Multiplies this element with element.
 ModuleElement scaled(RingElement element)
          Returns the product of this element with element.
 java.lang.String stringRep(boolean... parens)
          Returns a string representation of this module element.
 void subtract(ModuleElement element)
          Subtracts element from this module element.
 ModuleElement sum(ModuleElement element)
          Returns the sum of this module element and element.
 java.lang.String toString()
          Returns a human readable string representation of this module element.
 
Methods inherited from interface org.rubato.xml.XMLInputOutput
fromXML, getElementTypeName, toXML
 

Method Detail

isZero

boolean isZero()
Returns true iff this element is zero.


scaled

ModuleElement scaled(RingElement element)
                     throws DomainException
Returns the product of this element with element.

Throws:
DomainException - if element is not in domain

scale

void scale(RingElement element)
           throws DomainException
Multiplies this element with element. This is a destructive operation.

Throws:
DomainException - if element is not in domain

getLength

int getLength()
Returns the length of the element.


getComponent

ModuleElement getComponent(int i)
Returns the i-th component element.


sum

ModuleElement sum(ModuleElement element)
                  throws DomainException
Returns the sum of this module element and element.

Throws:
DomainException - if element is not in domain

add

void add(ModuleElement element)
         throws DomainException
Adds element to this module element. This is a destructive operation.

Throws:
DomainException - if element is not in domain

difference

ModuleElement difference(ModuleElement element)
                         throws DomainException
Returns the difference of this module element and element.

Throws:
DomainException - if element is not in domain

subtract

void subtract(ModuleElement element)
              throws DomainException
Subtracts element from this module element. This is a destructive operation.

Throws:
DomainException - if element is not in domain

negated

ModuleElement negated()
Returns the negative of this module element.


negate

void negate()
Negate this module element. This is a destructive operation.


fold

double[] fold(ModuleElement[] elements)
Fold elements assuming they are of this same type.


getModule

Module getModule()
Returns the module that this module element is an element of.


cast

ModuleElement cast(Module module)
Tries to cast this element to an element in the given module.

Returns:
a new module element in the required module and null if the cast cannot be performed.

stringRep

java.lang.String stringRep(boolean... parens)
Returns a string representation of this module element. The representation is meant to be parseable. If the argument parens is present then the the representation is parenthesized if necessary.


toString

java.lang.String toString()
Returns a human readable string representation of this module element. The representation is not meant to be parseable.

Overrides:
toString in class java.lang.Object

equals

boolean equals(java.lang.Object object)
Returns true iff this element is equal to object.

Overrides:
equals in class java.lang.Object

compareTo

int compareTo(ModuleElement object)
Compares this module element with object.

Specified by:
compareTo in interface java.lang.Comparable<ModuleElement>

clone

ModuleElement clone()
Returns a deep copy of this module element.


hashCode

int hashCode()
Returns the hash code for this module element.

Overrides:
hashCode in class java.lang.Object