org.rubato.math.module.morphism
Class ZAffineMorphism

java.lang.Object
  extended by org.rubato.math.module.morphism.ModuleMorphism
      extended by org.rubato.math.module.morphism.ZAbstractMorphism
          extended by org.rubato.math.module.morphism.ZAffineMorphism
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<ModuleMorphism>, XMLInputOutput<ModuleMorphism>

public final class ZAffineMorphism
extends ZAbstractMorphism

Affine morphism in the Z. The morphism h is such that h(x) = a*x+b where a and b are integers.

Author:
Gérard Milmeister
See Also:
Serialized Form

Constructor Summary
ZAffineMorphism(int a, int b)
          Creates an affine morphism h(x) = a*x+b.
 
Method Summary
 ModuleElement atZero()
          Returns the value of the morphism evaluated at the zero of the domain.
 int compareTo(ModuleMorphism object)
          Compares two module morphisms.
 ModuleMorphism compose(ModuleMorphism morphism)
          Returns the composition this*morphism.
 ModuleMorphism difference(ModuleMorphism morphism)
          Returns the difference of this module morphism and morphism.
 boolean equals(java.lang.Object object)
          Returns true iff this morphism is equal to object.
 ModuleMorphism fromXML(XMLReader reader, org.w3c.dom.Element element)
          Reads XML representation from reader starting with element.
 int getA()
          Returns the linear part.
 int getB()
          Returns the translation part.
 java.lang.String getElementTypeName()
          Returns the value of the type attribute for this class.
static XMLInputOutput<ModuleMorphism> getXMLInputOutput()
           
 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.
 int mapValue(int x)
          The low-level map method.
 ModuleMorphism scaled(RingElement element)
          Returns this module morphism scaled by element.
 ModuleMorphism sum(ModuleMorphism morphism)
          Returns the sum of this module morphism and morphism.
 java.lang.String toString()
          Returns a string representation of this morphism.
 void toXML(XMLWriter writer)
          Outputs XML representation to writer.
 
Methods inherited from class org.rubato.math.module.morphism.ZAbstractMorphism
getRingMorphism, map
 
Methods inherited from class org.rubato.math.module.morphism.ModuleMorphism
clone, composable, getCodomain, getConstantMorphism, getConstantMorphism, getDomain, getIdentityMorphism, inDomain, isRingMorphism, power
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ZAffineMorphism

public ZAffineMorphism(int a,
                       int b)
Creates an affine morphism h(x) = a*x+b.

Method Detail

mapValue

public int mapValue(int x)
Description copied from class: ZAbstractMorphism
The low-level map method. This must be implemented in subclasses.

Specified by:
mapValue in class ZAbstractMorphism

isModuleHomomorphism

public boolean isModuleHomomorphism()
Description copied from class: ModuleMorphism
If true, then this is a module homomorphism.

Overrides:
isModuleHomomorphism in class ModuleMorphism

isRingHomomorphism

public boolean isRingHomomorphism()
Description copied from class: ModuleMorphism
If true, then this is a ring homomorphism.

Overrides:
isRingHomomorphism in class ModuleMorphism

isLinear

public boolean isLinear()
Description copied from class: ModuleMorphism
Returns true iff this is a linear morphism.

Overrides:
isLinear in class ModuleMorphism

isIdentity

public boolean isIdentity()
Description copied from class: ModuleMorphism
Returns true iff this morphism is the identity morphism.

Overrides:
isIdentity in class ModuleMorphism

isConstant

public boolean isConstant()
Description copied from class: ModuleMorphism
Returns true iff this morphism is constant.

Overrides:
isConstant in class ModuleMorphism

compose

public ModuleMorphism compose(ModuleMorphism morphism)
                       throws CompositionException
Description copied from class: ModuleMorphism
Returns the composition this*morphism.

Overrides:
compose in class ModuleMorphism
Throws:
CompositionException - if composition could not be performed

sum

public ModuleMorphism sum(ModuleMorphism morphism)
                   throws CompositionException
Description copied from class: ModuleMorphism
Returns the sum of this module morphism and morphism.

Overrides:
sum in class ModuleMorphism
Throws:
CompositionException - if sum could not be performed

difference

public ModuleMorphism difference(ModuleMorphism morphism)
                          throws CompositionException
Description copied from class: ModuleMorphism
Returns the difference of this module morphism and morphism.

Overrides:
difference in class ModuleMorphism
Throws:
CompositionException - if difference could not be performed

scaled

public ModuleMorphism scaled(RingElement element)
                      throws CompositionException
Description copied from class: ModuleMorphism
Returns this module morphism scaled by element.

Overrides:
scaled in class ModuleMorphism
Throws:
CompositionException

atZero

public ModuleElement atZero()
Description copied from class: ModuleMorphism
Returns the value of the morphism evaluated at the zero of the domain.

Overrides:
atZero in class ModuleMorphism

compareTo

public int compareTo(ModuleMorphism object)
Description copied from class: ModuleMorphism
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>
Overrides:
compareTo in class ModuleMorphism

equals

public boolean equals(java.lang.Object object)
Description copied from class: ModuleMorphism
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.

Specified by:
equals in class ModuleMorphism

toString

public java.lang.String toString()
Description copied from class: ModuleMorphism
Returns a string representation of this morphism. This string is used for generic comparison.

Specified by:
toString in class ModuleMorphism

toXML

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


fromXML

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

Returns:
an object of type T or null if parsing failed

getXMLInputOutput

public static XMLInputOutput<ModuleMorphism> getXMLInputOutput()

getElementTypeName

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


getA

public int getA()
Returns the linear part.


getB

public int getB()
Returns the translation part.