org.rubato.math.module.morphism
Class ModuleMorphism

java.lang.Object
  extended by org.rubato.math.module.morphism.ModuleMorphism
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<ModuleMorphism>, XMLInputOutput<ModuleMorphism>
Direct Known Subclasses:
CAbstractMorphism, CanonicalMorphism, CastMorphism, CFreeAbstractMorphism, CompositionMorphism, ConjugationMorphism, ConstantMorphism, DifferenceMorphism, DirectSumAbstractMorphism, EmbeddingMorphism, FoldingMorphism, GenericAffineMorphism, GenericBasisMorphism, IdentityMorphism, ModuloMorphism, PolynomialMorphism, PowerMorphism, ProductMorphism, ProjectionMorphism, QAbstractMorphism, QFreeAbstractMorphism, RAbstractMorphism, ReorderMorphism, RFreeAbstractMorphism, ScaledMorphism, SplitMorphism, SumMorphism, TranslationMorphism, ZAbstractMorphism, ZFreeAbstractMorphism, ZnAbstractMorphism, ZnFreeAbstractMorphism

public abstract class ModuleMorphism
extends java.lang.Object
implements java.lang.Comparable<ModuleMorphism>, java.lang.Cloneable, java.io.Serializable, XMLInputOutput<ModuleMorphism>

The abstract base class for morphisms in modules. Any new type (subclass) of ModuleMorphism must be registered with a dispatcher for reading from XML (in the init method of Dispatcher).

Author:
Gérard Milmeister
See Also:
Serialized Form

Constructor Summary
ModuleMorphism(Module domain, Module codomain)
          Creates a new morphism with domain and codomain as indicated.
 
Method Summary
 ModuleElement atZero()
          Returns the value of the morphism evaluated at the zero of the domain.
 java.lang.Object clone()
          ModuleMorphism objects cannot be changed, so clone returns the object itself.
 int compareTo(ModuleMorphism morphism)
          Compares two module morphisms.
static boolean composable(ModuleMorphism f, ModuleMorphism g)
          Returns true iff the composition f*g is possible.
 ModuleMorphism compose(ModuleMorphism morphism)
          Returns the composition this*morphism.
 ModuleMorphism difference(ModuleMorphism morphism)
          Returns the difference of this module morphism and morphism.
abstract  boolean equals(java.lang.Object object)
          Returns true iff this morphism is equal to object.
 Module getCodomain()
          Returns the codomain of this morphism.
 ModuleMorphism getConstantMorphism(ModuleElement value)
          Returns a constant morphism with the domain of this morphism that returns the specified constant value.
static ModuleMorphism getConstantMorphism(Module module, ModuleElement value)
          Returns the constant value morphism in module.
 Module getDomain()
          Returns the domain of this morphism.
static ModuleMorphism getIdentityMorphism(Module module)
          Returns the identity morphism in module.
abstract  ModuleMorphism getRingMorphism()
          Returns the the ring morphism that transforms between the rings of the domain and codomain modules.
 boolean inDomain(ModuleElement x)
          Returns true iff element x is in the domain of the morphism.
 boolean isConstant()
          Returns true iff this morphism is constant.
 boolean isIdentity()
          Returns true iff this morphism is the identity morphism.
 boolean isLinear()
          Returns true iff this is a linear morphism.
 boolean isModuleHomomorphism()
          If true, then this is a module homomorphism.
 boolean isRingHomomorphism()
          If true, then this is a ring homomorphism.
 boolean isRingMorphism()
          If true, then this is a morphism between rings;
abstract  ModuleElement map(ModuleElement x)
          Maps the element x.
 ModuleMorphism power(int n)
          Returns this module morphism raise to the power n.
 ModuleMorphism scaled(RingElement element)
          Returns this module morphism scaled by element.
 ModuleMorphism sum(ModuleMorphism morphism)
          Returns the sum of this module morphism and morphism.
abstract  java.lang.String toString()
          Returns a string representation of this morphism.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.rubato.xml.XMLInputOutput
fromXML, getElementTypeName, toXML
 

Constructor Detail

ModuleMorphism

public ModuleMorphism(Module domain,
                      Module codomain)
Creates a new morphism with domain and codomain as indicated.

Method Detail

map

public abstract ModuleElement map(ModuleElement x)
                           throws MappingException
Maps the element x. This must be implemented for each specific morphism type.

Returns:
the result of mapping element x
Throws:
MappingException - if mapping of element fails

compose

public ModuleMorphism compose(ModuleMorphism morphism)
                       throws CompositionException
Returns the composition this*morphism.

Throws:
CompositionException - if composition could not be performed

sum

public ModuleMorphism sum(ModuleMorphism morphism)
                   throws CompositionException
Returns the sum of this module morphism and morphism.

Throws:
CompositionException - if sum could not be performed

difference

public ModuleMorphism difference(ModuleMorphism morphism)
                          throws CompositionException
Returns the difference of this module morphism and morphism.

Throws:
CompositionException - if difference could not be performed

scaled

public ModuleMorphism scaled(RingElement element)
                      throws CompositionException
Returns this module morphism scaled by element.

Throws:
CompositionException

atZero

public ModuleElement atZero()
Returns the value of the morphism evaluated at the zero of the domain.


power

public ModuleMorphism power(int n)
                     throws CompositionException
Returns this module morphism raise to the power n. The power must be non-negative and the domain must be equal to the codomain.

Throws:
CompositionException - if power could not be performed

getIdentityMorphism

public static ModuleMorphism getIdentityMorphism(Module module)
Returns the identity morphism in module.


getConstantMorphism

public static ModuleMorphism getConstantMorphism(Module module,
                                                 ModuleElement value)
Returns the constant value morphism in module.


getConstantMorphism

public ModuleMorphism getConstantMorphism(ModuleElement value)
Returns a constant morphism with the domain of this morphism that returns the specified constant value.


isIdentity

public boolean isIdentity()
Returns true iff this morphism is the identity morphism.


isConstant

public boolean isConstant()
Returns true iff this morphism is constant.


getDomain

public final Module getDomain()
Returns the domain of this morphism.


getCodomain

public final Module getCodomain()
Returns the codomain of this morphism.


isModuleHomomorphism

public boolean isModuleHomomorphism()
If true, then this is a module homomorphism.


isRingHomomorphism

public boolean isRingHomomorphism()
If true, then this is a ring homomorphism.


isRingMorphism

public boolean isRingMorphism()
If true, then this is a morphism between rings;


getRingMorphism

public abstract ModuleMorphism getRingMorphism()
Returns the the ring morphism that transforms between the rings of the domain and codomain modules.


isLinear

public boolean isLinear()
Returns true iff this is a linear morphism.


composable

public static final boolean composable(ModuleMorphism f,
                                       ModuleMorphism g)
Returns true iff the composition f*g is possible.


inDomain

public boolean inDomain(ModuleElement x)
Returns true iff element x is in the domain of the morphism.


compareTo

public int compareTo(ModuleMorphism morphism)
Compares two module morphisms. Checks first for equality. The default comparison is on names, subclasses may implement a more meaningful comparison.

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

equals

public abstract boolean equals(java.lang.Object object)
Returns true iff this morphism is equal to object. In general it is not possible to determine whether to functions are the same, so this returns true iff both morphisms have the same structure.

Overrides:
equals in class java.lang.Object

clone

public java.lang.Object clone()
ModuleMorphism objects cannot be changed, so clone returns the object itself.

Overrides:
clone in class java.lang.Object

toString

public abstract java.lang.String toString()
Returns a string representation of this morphism. This string is used for generic comparison.

Overrides:
toString in class java.lang.Object