org.rubato.math.yoneda
Class IndexMorphismMap

java.lang.Object
  extended by org.rubato.math.yoneda.IndexMorphismMap
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<MorphismMap>, MorphismMap, XMLInputOutput<MorphismMap>

public final class IndexMorphismMap
extends java.lang.Object
implements MorphismMap

Morphism map containing a morphism and an index (for type colimit).

Author:
Gérard Milmeister, Stefan Müller, Stefan Göller
See Also:
Serialized Form

Constructor Summary
IndexMorphismMap()
          Creates an empty IndexMorphismMap.
IndexMorphismMap(int index, Denotator factor)
          Creates an IndexMorphismMap.
 
Method Summary
 MorphismMap at(ModuleElement element)
          Evaluates the map at an element.
 MorphismMap changeAddress(Module address)
          Makes an address change.
 MorphismMap changeAddress(ModuleMorphism morphism)
          Makes an address change using a module morphism.
 java.lang.Object clone()
          Returns a deep copy of this MorphismMap.
 int compareTo(IndexMorphismMap other)
           
 int compareTo(MorphismMap object)
           
 IndexMorphismMap copy()
          Returns a deep copy of this MorphismMap.
 boolean equals(IndexMorphismMap other)
           
 boolean equals(java.lang.Object object)
           
 MorphismMap fromXML(XMLReader reader, org.w3c.dom.Element element)
          Reads XML representation from reader starting with element.
 boolean fullEquals(MorphismMap map, java.util.IdentityHashMap<java.lang.Object,java.lang.Object> s)
           
 java.util.LinkedList<Denotator> getDenotatorDependencies(java.util.LinkedList<Denotator> list)
           
 java.lang.String getElementTypeName()
          Returns the value of the type attribute for this class.
 Denotator getFactor()
          Returns the factor contained in the map.
 java.util.LinkedList<Form> getFormDependencies(java.util.LinkedList<Form> list)
           
 int getIndex()
          Returns the index of the factor contained in the map.
 int hashCode()
          Every morphism map must have a hash function.
 boolean isConstant()
           
 boolean resolveReferences(RubatoDictionary dict, java.util.IdentityHashMap<?,?> history)
           
 void setFactor(int index, Denotator factor)
          Sets the factor with the given index in the map.
 void toXML(XMLWriter writer)
          Outputs XML representation to writer.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexMorphismMap

public IndexMorphismMap(int index,
                        Denotator factor)
Creates an IndexMorphismMap.


IndexMorphismMap

public IndexMorphismMap()
Creates an empty IndexMorphismMap.

Method Detail

getIndex

public int getIndex()
Returns the index of the factor contained in the map.


getFactor

public Denotator getFactor()
Returns the factor contained in the map.


setFactor

public void setFactor(int index,
                      Denotator factor)
Sets the factor with the given index in the map.


compareTo

public int compareTo(MorphismMap object)
Specified by:
compareTo in interface java.lang.Comparable<MorphismMap>
Specified by:
compareTo in interface MorphismMap

compareTo

public int compareTo(IndexMorphismMap other)

fullEquals

public boolean fullEquals(MorphismMap map,
                          java.util.IdentityHashMap<java.lang.Object,java.lang.Object> s)
Specified by:
fullEquals in interface MorphismMap

at

public MorphismMap at(ModuleElement element)
               throws MappingException
Description copied from interface: MorphismMap
Evaluates the map at an element. This applies when the morphism map is not null addressed. If it is null addressed, it is returned unchanged.

Specified by:
at in interface MorphismMap
Parameters:
element - evaluate at this element
Returns:
a new morphism map if there has been any change
Throws:
MappingException - if mapping fails

changeAddress

public MorphismMap changeAddress(Module address)
Description copied from interface: MorphismMap
Makes an address change.

Specified by:
changeAddress in interface MorphismMap
Parameters:
address - the new address of the denotator
Returns:
a copy of this morphism with address newAddress or null if address changed fails

changeAddress

public MorphismMap changeAddress(ModuleMorphism morphism)
Description copied from interface: MorphismMap
Makes an address change using a module morphism.

Specified by:
changeAddress in interface MorphismMap
Parameters:
morphism - the address changing morphism
Returns:
a copy of this morphism with the new address or null if address change fails

toXML

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

Specified by:
toXML in interface XMLInputOutput<MorphismMap>

fromXML

public MorphismMap 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<MorphismMap>
Returns:
an object of type T or null if parsing failed

getElementTypeName

public final 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<MorphismMap>

getFormDependencies

public java.util.LinkedList<Form> getFormDependencies(java.util.LinkedList<Form> list)
Specified by:
getFormDependencies in interface MorphismMap

getDenotatorDependencies

public java.util.LinkedList<Denotator> getDenotatorDependencies(java.util.LinkedList<Denotator> list)
Specified by:
getDenotatorDependencies in interface MorphismMap

resolveReferences

public boolean resolveReferences(RubatoDictionary dict,
                                 java.util.IdentityHashMap<?,?> history)
Specified by:
resolveReferences in interface MorphismMap

isConstant

public boolean isConstant()

clone

public java.lang.Object clone()
Description copied from interface: MorphismMap
Returns a deep copy of this MorphismMap.

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

copy

public IndexMorphismMap copy()
Description copied from interface: MorphismMap
Returns a deep copy of this MorphismMap.

Specified by:
copy in interface MorphismMap

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object

equals

public boolean equals(IndexMorphismMap other)

hashCode

public int hashCode()
Description copied from interface: MorphismMap
Every morphism map must have a hash function.

Specified by:
hashCode in interface MorphismMap
Overrides:
hashCode in class java.lang.Object
Returns:
the hashcode of this morphism map