org.rubato.math.yoneda
Class SimpleDenotator

java.lang.Object
  extended by org.rubato.math.yoneda.AbstractConnectableYoneda
      extended by org.rubato.math.yoneda.Denotator
          extended by org.rubato.math.yoneda.SimpleDenotator
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<Denotator>, java.lang.Iterable<Denotator>, Connectable, Yoneda

public final class SimpleDenotator
extends Denotator

Simple denotator class.

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

Field Summary
 
Fields inherited from interface org.rubato.math.yoneda.Yoneda
COLIMIT, LIMIT, LIST, POWER, SIMPLE
 
Constructor Summary
SimpleDenotator(NameDenotator name, SimpleForm form, ModuleElement element)
          Constructs a simple null-addressed denotator of the specified form.
SimpleDenotator(NameDenotator name, SimpleForm form, Module address, ModuleElement element)
          Constructs a simple (constant) addressed denotator of the specified form.
SimpleDenotator(NameDenotator name, SimpleForm form, ModuleMorphism morphism)
          Constructs a simple addressed denotator of the specified form.
SimpleDenotator(NameDenotator name, SimpleForm form, ModuleMorphismMap map)
          Constructs a simple addressed denotator of the specified form.
 
Method Summary
 boolean _is_valid()
          Returns true iff this denotator is correctly built.
static SimpleDenotator _make_unsafe(NameDenotator name, SimpleForm form, Module address, ModuleElement element)
          Creates a new simple denotator without checking whatsoever.
static SimpleDenotator _make_unsafe(NameDenotator name, SimpleForm form, ModuleMorphism morphism)
          Creates a new simple denotator without checking whatsoever.
 Denotator at(ModuleElement element)
          returns a new denotator evaluated at address element, if this denotator is not null addressed, otherwise returns self, whatever element is.
 Denotator changeAddress(Module newAddress)
          Makes an address change.
 Denotator changeAddress(ModuleMorphism morphism)
          Makes an address change using a module morphism.
 boolean check()
          Returns true iff this denotator is consistent.
 int compareTo(Denotator object)
           
 int compareTo(SimpleDenotator other)
          Compares two simple denotators.
 SimpleDenotator copy()
          Returns a deep copy of this denotator.
 SimpleDenotator difference(SimpleDenotator d)
           
 boolean equals(java.lang.Object object)
          Checks for equality.
 boolean equals(SimpleDenotator other)
          Checks denotators of the same type for equality.
static SimpleDenotator fromXML(XMLReader reader, org.w3c.dom.Element element)
          Reads XML representation from reader starting with element.
 Complex getComplex()
          Returns the complex number contained in a CElement denotator.
 ModuleElement getElement()
          Returns the module element.
 ModuleElement getElement(ModuleElement element)
          Returns the module element.
 ModuleMorphism getFrameModuleMorphism()
          Returns the module morphism.
 ModuleMorphismMap getFrameModuleMorphismMap()
          Returns the module morphism map.
 int getInteger()
          Returns the integer contained in a ZElement denotator.
 int getModInteger()
          Returns the modular integer contained in a ZnElement denotator.
 ModuleMorphism getModuleMorphism()
          Returns the module morphism.
 ModuleMorphismMap getModuleMorphismMap()
          Returns the module morphism map.
 Rational getRational()
          Returns the rational contained in a QElement denotator.
 double getReal()
          Returns the double contained in an RElement denotator.
 SimpleForm getSimpleForm()
          Returns the simple form of the denotator.
 java.lang.String getString()
          Returns the string contained in a ZStringElement denotator.
 int getType()
          Returns the type of the denotator.
 ZString getZString()
          Returns the ZString contained in a ZStringElement denotator.
 boolean isConstant()
          Returns true iff this is ultimately a constant denotator, regardless of its address.
 java.util.Iterator<Denotator> iterator()
          Returns an iterator over the coordinate denotators.
 SimpleDenotator map(ModuleMorphism morphism)
          Maps the simple denotator using the given morphism.
 Denotator namedCopy(NameDenotator name)
          Makes a shallow copy this denotator and gives it the specified name.
 SimpleDenotator sum(SimpleDenotator d)
           
 void toXML(XMLWriter writer)
           
 
Methods inherited from class org.rubato.math.yoneda.Denotator
atNull, clone, display, display, formEquals, get, getAddress, getCoordinate, getDependencies, getElement, getForm, getFrameCoordinate, getModuleMorphism, getName, getNameString, hasForm, hashCode, map, nameCompareTo, nameEquals, nullAddressed, replace, resolveReferences, setName, setNameString, toString
 
Methods inherited from class org.rubato.math.yoneda.AbstractConnectableYoneda
getConnector, setConnector
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleDenotator

public SimpleDenotator(NameDenotator name,
                       SimpleForm form,
                       ModuleMorphism morphism)
                throws DomainException
Constructs a simple addressed denotator of the specified form. The address is the domain of the specified module morphism.

Parameters:
name - the name of the denotator
form - the form of the denotator, must be of type simple
morphism - the module morphism contained in the denotator
Throws:
DomainException - if the codomain of the module morphism is not equal to the codomain required by the form

SimpleDenotator

public SimpleDenotator(NameDenotator name,
                       SimpleForm form,
                       ModuleElement element)
                throws DomainException
Constructs a simple null-addressed denotator of the specified form.

Parameters:
name - the name of the denotator
form - the form of the denotator, must be of type simple
element - the module element contained in the denotator
Throws:
DomainException - if the element is not contained in the codomain required by the form

SimpleDenotator

public SimpleDenotator(NameDenotator name,
                       SimpleForm form,
                       Module address,
                       ModuleElement element)
                throws DomainException
Constructs a simple (constant) addressed denotator of the specified form.

Parameters:
name - the name of the denotator
form - the form of the denotator, must be of type simple
address - the address of the denotator
element - the module element contained in the denotator
Throws:
DomainException - if the element is not contained in the codomain required by the form

SimpleDenotator

public SimpleDenotator(NameDenotator name,
                       SimpleForm form,
                       ModuleMorphismMap map)
                throws DomainException
Constructs a simple addressed denotator of the specified form. The address is the domain of the specified module morphism map.

Parameters:
name - the name of the denotator
form - the form of the denotator, must be of type simple
map - the module morphism map contained in the denotator
Throws:
DomainException - if the codomain of the module morphism is not equal to the codomain required by the form
Method Detail

getType

public int getType()
Returns the type of the denotator.

Specified by:
getType in class Denotator
Returns:
type as an integer

getSimpleForm

public SimpleForm getSimpleForm()
Returns the simple form of the denotator.


namedCopy

public Denotator namedCopy(NameDenotator name)
Description copied from class: Denotator
Makes a shallow copy this denotator and gives it the specified name.

Specified by:
namedCopy in class Denotator

at

public Denotator at(ModuleElement element)
             throws MappingException
returns a new denotator evaluated at address element, if this denotator is not null addressed, otherwise returns self, whatever element is.

Specified by:
at in class Denotator
Parameters:
element - address
Returns:
evaluated denotator
Throws:
MappingException - if evaluation fails

changeAddress

public Denotator changeAddress(Module newAddress)
Description copied from class: Denotator
Makes an address change.

Specified by:
changeAddress in class Denotator
Parameters:
newAddress - the new address of the denotator
Returns:
a copy of this denotator with the new address or null if address change fails

changeAddress

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

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

map

public SimpleDenotator map(ModuleMorphism morphism)
                    throws RubatoException
Maps the simple denotator using the given morphism. If the denotator contains a module element, the new denotator contains the mapped element. If the denotator contains a morphism f, the new denotator contains the composed morphism f.morphism.

Parameters:
morphism - must have domain and codomain equal to the module of the denotator
Throws:
RubatoException

iterator

public java.util.Iterator<Denotator> iterator()
Returns an iterator over the coordinate denotators. There are no coordinate denotators in a simple denotator.

Specified by:
iterator in interface java.lang.Iterable<Denotator>
Specified by:
iterator in class Denotator

getElement

public ModuleElement getElement()
Returns the module element.


getElement

public ModuleElement getElement(ModuleElement element)
                         throws MappingException
Returns the module element. This is the case of a non-null addressed denotator.

Parameters:
element - the address
Throws:
MappingException

getInteger

public int getInteger()
Returns the integer contained in a ZElement denotator.


getModInteger

public int getModInteger()
Returns the modular integer contained in a ZnElement denotator.


getReal

public double getReal()
Returns the double contained in an RElement denotator.


getRational

public Rational getRational()
Returns the rational contained in a QElement denotator.


getComplex

public Complex getComplex()
Returns the complex number contained in a CElement denotator.


getZString

public ZString getZString()
Returns the ZString contained in a ZStringElement denotator.


getString

public java.lang.String getString()
Returns the string contained in a ZStringElement denotator.


sum

public SimpleDenotator sum(SimpleDenotator d)
                    throws DomainException
Throws:
DomainException

difference

public SimpleDenotator difference(SimpleDenotator d)
                           throws DomainException
Throws:
DomainException

getModuleMorphismMap

public ModuleMorphismMap getModuleMorphismMap()
Returns the module morphism map.


getFrameModuleMorphismMap

public ModuleMorphismMap getFrameModuleMorphismMap()
Returns the module morphism map. Uses the frame coordinate instead of the coordinate.


getModuleMorphism

public ModuleMorphism getModuleMorphism()
Returns the module morphism.


getFrameModuleMorphism

public ModuleMorphism getFrameModuleMorphism()
Returns the module morphism. Uses the frame coordinate instead of the coordinate.


compareTo

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

compareTo

public int compareTo(SimpleDenotator other)
Compares two simple denotators.


equals

public boolean equals(java.lang.Object object)
Checks for equality.

Specified by:
equals in class Denotator

equals

public boolean equals(SimpleDenotator other)
Checks denotators of the same type for equality.


isConstant

public boolean isConstant()
Description copied from class: Denotator
Returns true iff this is ultimately a constant denotator, regardless of its address.

Specified by:
isConstant in class Denotator

copy

public SimpleDenotator copy()
Description copied from class: Denotator
Returns a deep copy of this denotator. The copy is given the same name as the original.

Specified by:
copy in class Denotator

check

public boolean check()
Description copied from class: Denotator
Returns true iff this denotator is consistent. This can be used in assertions to validate a denotator, for example if its constructed using unsafe methods or changed inplace.

Specified by:
check in class Denotator

toXML

public void toXML(XMLWriter writer)
Specified by:
toXML in class Denotator

fromXML

public static SimpleDenotator fromXML(XMLReader reader,
                                      org.w3c.dom.Element element)
Reads XML representation from reader starting with element.

Returns:
a simple denotator or null if parsing failed

_make_unsafe

@Unsafe
@Internal
public static SimpleDenotator _make_unsafe(NameDenotator name,
                                                           SimpleForm form,
                                                           Module address,
                                                           ModuleElement element)
Creates a new simple denotator without checking whatsoever. The arguments must result in a correct denotator, otherwise there may be nasty consequences.


_make_unsafe

@Unsafe
@Internal
public static SimpleDenotator _make_unsafe(NameDenotator name,
                                                           SimpleForm form,
                                                           ModuleMorphism morphism)
Creates a new simple denotator without checking whatsoever. The arguments must result in a correct denotator, otherwise there may be nasty consequences.


_is_valid

@Internal
public boolean _is_valid()
Returns true iff this denotator is correctly built.