org.rubato.math.module
Class RingElement

java.lang.Object
  extended by org.rubato.math.module.RingElement
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<ModuleElement>, java.lang.Iterable<RingElement>, FreeElement, ModuleElement, XMLInputOutput<ModuleElement>
Direct Known Subclasses:
CElement, ModularPolynomialElement, PolynomialElement, ProductElement, QElement, RElement, StringElement, ZElement, ZnElement

public abstract class RingElement
extends java.lang.Object
implements FreeElement

The abstract base class for ring elements. Ring elements always have length 1.

Author:
Gérard Milmeister
See Also:
Ring, Serialized Form

Constructor Summary
RingElement()
           
 
Method Summary
abstract  RingElement clone()
          Returns a deep copy of this module element.
 int compareTo(ModuleElement object)
          Compares this module element with object.
 RingElement difference(RingElement element)
           
abstract  void divide(RingElement element)
          Replaces this by the solution x of element*x = this, if it exists, otherwise a DivisionException is thrown.
abstract  boolean divides(RingElement element)
          Return true iff the solution x of this*x = element exists.
 ModuleElement getComponent(int i)
          Returns the i-th component of this free element.
 int getLength()
          Returns the length of this ring element.
 Ring getRing()
          Returns the ring this element is a member of.
 RingElement getRingElement(int i)
          Returns the i-th ring component of this free element.
abstract  RingElement inverse()
          Returns the inverse of this ring element, if it has an inverse.
abstract  void invert()
          Inverts this ring element, if it has an inverse.
abstract  boolean isInvertible()
          Returns true if this ring element is invertible.
abstract  boolean isOne()
          Returns true if this ring element is one.
 java.util.Iterator<RingElement> iterator()
          Returns an iterator to the factors of the element.
abstract  void multiply(RingElement element)
          Multiplies this ring element with element.
 void multiplyCW(ModuleElement element)
          Multiply this module element componentwise with element.
 RingElement power(int n)
          Raises this ring element to the power n.
abstract  RingElement product(RingElement element)
          Returns the product of this ring element with element.
 ModuleElement productCW(ModuleElement element)
          Returns the componentwise product of this module element and element.
abstract  RingElement quotient(RingElement element)
          Returns the solution x of element*x = this, if it exists, otherwise a DivisionException is thrown.
abstract  java.lang.String stringRep(boolean... parens)
          Returns a string representation of this module element.
 RingElement sum(RingElement element)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.rubato.math.module.FreeElement
resize
 
Methods inherited from interface org.rubato.math.module.ModuleElement
add, cast, difference, equals, fold, getModule, hashCode, isZero, negate, negated, scale, scaled, subtract, sum, toString
 
Methods inherited from interface org.rubato.xml.XMLInputOutput
fromXML, getElementTypeName, toXML
 

Constructor Detail

RingElement

public RingElement()
Method Detail

isOne

public abstract boolean isOne()
Returns true if this ring element is one.


sum

public RingElement sum(RingElement element)
                throws DomainException
Throws:
DomainException

difference

public RingElement difference(RingElement element)
                       throws DomainException
Throws:
DomainException

product

public abstract RingElement product(RingElement element)
                             throws DomainException
Returns the product of this ring element with element.

Throws:
DomainException - if element is not in domain

multiply

public abstract void multiply(RingElement element)
                       throws DomainException
Multiplies this ring element with element.

Throws:
DomainException - if element is not in domain

productCW

public ModuleElement productCW(ModuleElement element)
                        throws DomainException
Description copied from interface: FreeElement
Returns the componentwise product of this module element and element.

Specified by:
productCW in interface FreeElement
Throws:
DomainException - if element is not in domain

multiplyCW

public void multiplyCW(ModuleElement element)
                throws DomainException
Description copied from interface: FreeElement
Multiply this module element componentwise with element. This is a destructive operation.

Specified by:
multiplyCW in interface FreeElement
Throws:
DomainException - if element is not in domain

isInvertible

public abstract boolean isInvertible()
Returns true if this ring element is invertible.


inverse

public abstract RingElement inverse()
Returns the inverse of this ring element, if it has an inverse.


invert

public abstract void invert()
Inverts this ring element, if it has an inverse.


quotient

public abstract RingElement quotient(RingElement element)
                              throws DomainException,
                                     DivisionException
Returns the solution x of element*x = this, if it exists, otherwise a DivisionException is thrown.

Throws:
DomainException
DivisionException

divide

public abstract void divide(RingElement element)
                     throws DomainException,
                            DivisionException
Replaces this by the solution x of element*x = this, if it exists, otherwise a DivisionException is thrown.

Throws:
DomainException
DivisionException

divides

public abstract boolean divides(RingElement element)
Return true iff the solution x of this*x = element exists.


power

public RingElement power(int n)
Raises this ring element to the power n.


getLength

public int getLength()
Returns the length of this ring element.

Specified by:
getLength in interface FreeElement
Specified by:
getLength in interface ModuleElement
Returns:
always 1

getComponent

public ModuleElement getComponent(int i)
Description copied from interface: FreeElement
Returns the i-th component of this free element.

Specified by:
getComponent in interface FreeElement
Specified by:
getComponent in interface ModuleElement

getRingElement

public RingElement getRingElement(int i)
Description copied from interface: FreeElement
Returns the i-th ring component of this free element.

Specified by:
getRingElement in interface FreeElement

iterator

public java.util.Iterator<RingElement> iterator()
Description copied from interface: FreeElement
Returns an iterator to the factors of the element.

Specified by:
iterator in interface java.lang.Iterable<RingElement>
Specified by:
iterator in interface FreeElement

getRing

public Ring getRing()
Returns the ring this element is a member of.


compareTo

public int compareTo(ModuleElement object)
Description copied from interface: ModuleElement
Compares this module element with object.

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

stringRep

public abstract java.lang.String stringRep(boolean... parens)
Description copied from interface: ModuleElement
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.

Specified by:
stringRep in interface ModuleElement

clone

public abstract RingElement clone()
Description copied from interface: ModuleElement
Returns a deep copy of this module element.

Specified by:
clone in interface ModuleElement
Overrides:
clone in class java.lang.Object