org.rubato.math.module
Class ProductRing

java.lang.Object
  extended by org.rubato.math.module.Ring
      extended by org.rubato.math.module.ProductRing
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<Module>, FreeModule, Module, ProductFreeModule, XMLInputOutput<Module>

public final class ProductRing
extends Ring
implements ProductFreeModule

Products over rings. Product rings in this class always have at least 2 factors. This is ensured through the use of make constructors. If a product ring with one factor should be requested, the factor ring is returned instead.

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

Method Summary
 ProductElement cast(ModuleElement element)
          Casts element to an element in this module if possible.
 int compareTo(Module object)
          Compares this module with object.
 ProductElement createElement(java.util.List<ModuleElement> elements)
          Creates an element in this module from a list of module elements.
 boolean equals(java.lang.Object object)
          Returns true iff this module is equals to object.
 Module fromXML(XMLReader reader, org.w3c.dom.Element element)
          Reads XML representation from reader starting with element.
 java.lang.String getElementTypeName()
          Returns the value of the type attribute for this class.
 Ring getFactor(int i)
           
 int getFactorCount()
           
 Ring[] getFactors()
           
 ProductFreeModule getFreeModule(int dimension)
          Returns the corresponding free module of dimension dim.
 ModuleMorphism getIdentityMorphism()
          Returns the identity morphism in this module.
 ProductFreeModule getNullModule()
          Returns the null-module corresponding to this module.
 ProductElement getOne()
          Returns the unit element of this ring.
static XMLInputOutput<Module> getXMLInputOutput()
           
 ProductElement getZero()
          Returns the zero element of this ring.
 boolean hasElement(ModuleElement element)
          Returns true iff element is an element of this module.
 int hashCode()
          Returns the hash code for this module.
 boolean isField()
          Returns true if this ring is a field.
 boolean isVectorspace()
          Returns true if this free module is a vector space.
static ProductRing make(java.util.List<Ring> rings)
          Creates a new product ring from the factors in the specified collection.
static ProductRing make(Ring[] factors)
          Creates a new product ring from the factors in specified array.
static ProductRing make(Ring r1, Ring r2)
          Creates a new product ring r1xr2.
static ProductRing make(Ring r1, Ring r2, Ring r3)
          Creates a new product ring r1xr2xr3.
 ProductElement parseString(java.lang.String string)
          Creates an element in this module from a string representation.
static ProductRing product(ProductRing r1, ProductRing r2)
           
static ProductRing product(ProductRing r1, Ring r2)
           
static ProductRing product(Ring r1, ProductRing r2)
           
 java.lang.String toString()
          Returns a human readable string representation of this module.
 java.lang.String toVisualString()
          Returns a human readable string representation of this module.
 void toXML(XMLWriter writer)
          Outputs XML representation to writer.
 
Methods inherited from class org.rubato.math.module.Ring
getComponentModule, getDimension, getInjection, getProjection, getRing, getTranslation, getUnitElement, isNullModule, isRing
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.rubato.math.module.FreeModule
getInjection, getProjection, getUnitElement
 
Methods inherited from interface org.rubato.math.module.Module
getComponentModule, getDimension, getRing, getTranslation, isNullModule, isRing
 

Method Detail

make

public static ProductRing make(Ring r1,
                               Ring r2)
Creates a new product ring r1xr2.


make

public static ProductRing make(Ring r1,
                               Ring r2,
                               Ring r3)
Creates a new product ring r1xr2xr3.


make

public static ProductRing make(Ring[] factors)
Creates a new product ring from the factors in specified array.

Parameters:
factors - factors[i] must not be null
Throws:
java.lang.IllegalArgumentException - if there are less than 2 factors

make

public static ProductRing make(java.util.List<Ring> rings)
Creates a new product ring from the factors in the specified collection.


product

public static ProductRing product(ProductRing r1,
                                  ProductRing r2)

product

public static ProductRing product(ProductRing r1,
                                  Ring r2)

product

public static ProductRing product(Ring r1,
                                  ProductRing r2)

getZero

public ProductElement getZero()
Description copied from class: Ring
Returns the zero element of this ring.

Specified by:
getZero in interface Module
Specified by:
getZero in class Ring

getOne

public ProductElement getOne()
Description copied from class: Ring
Returns the unit element of this ring.

Specified by:
getOne in class Ring

getNullModule

public ProductFreeModule getNullModule()
Description copied from interface: Module
Returns the null-module corresponding to this module.

Specified by:
getNullModule in interface Module

getFactorCount

public int getFactorCount()
Specified by:
getFactorCount in interface ProductFreeModule

getFactors

public Ring[] getFactors()
Specified by:
getFactors in interface ProductFreeModule

getFactor

public Ring getFactor(int i)
Specified by:
getFactor in interface ProductFreeModule

isField

public boolean isField()
Description copied from class: Ring
Returns true if this ring is a field.

Specified by:
isField in class Ring

isVectorspace

public boolean isVectorspace()
Description copied from interface: FreeModule
Returns true if this free module is a vector space.

Specified by:
isVectorspace in interface FreeModule

getIdentityMorphism

public ModuleMorphism getIdentityMorphism()
Description copied from interface: Module
Returns the identity morphism in this module.

Specified by:
getIdentityMorphism in interface Module

hasElement

public boolean hasElement(ModuleElement element)
Description copied from interface: Module
Returns true iff element is an element of this module.

Specified by:
hasElement in interface Module

getFreeModule

public ProductFreeModule getFreeModule(int dimension)
Description copied from class: Ring
Returns the corresponding free module of dimension dim.

Specified by:
getFreeModule in class Ring

equals

public boolean equals(java.lang.Object object)
Description copied from interface: Module
Returns true iff this module is equals to object.

Specified by:
equals in interface Module
Overrides:
equals in class java.lang.Object

compareTo

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

Specified by:
compareTo in interface java.lang.Comparable<Module>
Specified by:
compareTo in interface Module
Overrides:
compareTo in class Ring

createElement

public ProductElement createElement(java.util.List<ModuleElement> elements)
Description copied from interface: Module
Creates an element in this module from a list of module elements.

Specified by:
createElement in interface Module
Returns:
null if no element in this module can be created from the arguments.

cast

public ProductElement cast(ModuleElement element)
Description copied from interface: Module
Casts element to an element in this module if possible.

Specified by:
cast in interface Module
Returns:
null if cast is not possible

toString

public java.lang.String toString()
Description copied from interface: Module
Returns a human readable string representation of this module. The representation is not meant to be parseable.

Specified by:
toString in interface Module
Overrides:
toString in class java.lang.Object

toVisualString

public java.lang.String toVisualString()
Description copied from interface: Module
Returns a human readable string representation of this module. The representation is not meant to be parseable. The string should be a short representation, possibly using Unicode characters.

Specified by:
toVisualString in interface Module

parseString

public ProductElement parseString(java.lang.String string)
Description copied from interface: Module
Creates an element in this module from a string representation.

Specified by:
parseString in interface Module
Specified by:
parseString in class Ring
Returns:
null if the string is in the wrong format

toXML

public void toXML(XMLWriter writer)
Description copied from interface: XMLInputOutput
Outputs XML representation to writer.

Specified by:
toXML in interface XMLInputOutput<Module>

fromXML

public Module fromXML(XMLReader reader,
                      org.w3c.dom.Element element)
Description copied from interface: XMLInputOutput
Reads XML representation from reader starting with element.

Specified by:
fromXML in interface XMLInputOutput<Module>
Returns:
an object of type T or null if parsing failed

getElementTypeName

public java.lang.String getElementTypeName()
Description copied from interface: XMLInputOutput
Returns the value of the type attribute for this class.

Specified by:
getElementTypeName in interface XMLInputOutput<Module>

getXMLInputOutput

public static XMLInputOutput<Module> getXMLInputOutput()

hashCode

public int hashCode()
Description copied from interface: Module
Returns the hash code for this module.

Specified by:
hashCode in interface Module
Overrides:
hashCode in class java.lang.Object