org.rubato.math.yoneda
Class PowerDenotator

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

public final class PowerDenotator
extends Denotator
implements FactorDenotator

Power 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
PowerDenotator(NameDenotator name, Module address, PowerForm form, java.util.List<Denotator> cds)
          Creates a new power denotator.
PowerDenotator(NameDenotator name, PowerForm form, java.util.List<Denotator> cds)
          Creates a new power denotator that takes its address from the coordinates.
 
Method Summary
 boolean _is_valid()
          Returns true iff this denotator is correctly built.
static PowerDenotator _make_unsafe(NameDenotator name, Module address, PowerForm form, java.util.List<Denotator> denoList)
          Creates a new power denotator without checking whatsoever.
 void _normalize()
          Normalizes power denotator.
 boolean appendFactor(Denotator d)
          Appends a factor.
 Denotator at(ModuleElement element)
          If not null-addressed returns a new denotator evaluated at address element.
 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(PowerDenotator other)
          Compares two power denotators.
 boolean contains(Denotator d)
          Returns true iff this power denotator contains d.
 PowerDenotator copy()
          Returns a deep copy of this denotator.
 PowerDenotator difference(PowerDenotator d)
          Returns the set difference of this power denotator and d.
 boolean equals(java.lang.Object object)
          Checks for equality.
 boolean equals(PowerDenotator other)
          Checks denotators of the same form for equality.
static PowerDenotator fromXML(XMLReader reader, org.w3c.dom.Element element)
          Reads XML representation from reader starting with element.
 Denotator getFactor(int i)
          Returns the factor at position i.
 int getFactorCount()
          Returns the number of coordinates of the denotator.
 java.util.List<Denotator> getFactors()
          Returns a (new) list of the coordinates of the denotator.
 AutoListMorphismMap getFrameListMorphismMap()
           
 AutoListMorphismMap getListMorphismMap()
           
 PowerForm getPowerForm()
          Returns the form of this denotator.
 int getType()
          Returns the type of the denotator.
 int indexOf(Denotator d)
          Returns the internal index of denotator d.
 PowerDenotator intersection(PowerDenotator d)
          Returns the set intersection of this power denotator and d.
 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 coordinates.
 Denotator namedCopy(NameDenotator name)
          Makes a shallow copy this denotator and gives it the specified name.
 Denotator removeFactor(int index)
          Removes a factor.
 void replaceFactors(java.util.List<Denotator> denoList)
          Sets the factor list to a new list of denotators.
 void setFactor(int i, Denotator d)
          Sets the factor d at position i.
 boolean subset(PowerDenotator d)
          Returns true iff this power denotator is a subset of d.
 void toXML(XMLWriter writer)
           
 PowerDenotator union(PowerDenotator d)
          Returns the set union of this power denotator and d.
 
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

PowerDenotator

public PowerDenotator(NameDenotator name,
                      Module address,
                      PowerForm form,
                      java.util.List<Denotator> cds)
               throws RubatoException
Creates a new power denotator.

Parameters:
name - the name of the denotator, null if denotator is anomymous
address - the address of the denotator, null if null-addressed
form - the form of the denotator
cds - a list of coordinate denotators
Throws:
RubatoException

PowerDenotator

public PowerDenotator(NameDenotator name,
                      PowerForm form,
                      java.util.List<Denotator> cds)
               throws RubatoException
Creates a new power denotator that takes its address from the coordinates.

Parameters:
name - the name of the denotator, null if denotator is anomymous
form - the form of the denotator
cds - a list of coordinate denotators
Throws:
RubatoException
Method Detail

getType

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

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

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
If not null-addressed returns a new denotator evaluated at address element. If null-addressed, returns itself.

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

getPowerForm

public PowerForm getPowerForm()
Returns the form of this denotator.


getFactorCount

public int getFactorCount()
Returns the number of coordinates of the denotator.

Specified by:
getFactorCount in interface FactorDenotator
Returns:
number of coordinates

getFactor

public Denotator getFactor(int i)
Returns the factor at position i.

Specified by:
getFactor in interface FactorDenotator
Parameters:
i - denotator at position i

setFactor

public void setFactor(int i,
                      Denotator d)
               throws RubatoException
Sets the factor d at position i. This is a destructive operation; beware of aliasing.

Specified by:
setFactor in interface FactorDenotator
Throws:
RubatoException - if d is not of the required form or i is out of range

appendFactor

public boolean appendFactor(Denotator d)
                     throws RubatoException
Appends a factor. This is a destructive operation; beware of aliasing.

Specified by:
appendFactor in interface FactorDenotator
Returns:
true iff the append is successful
Throws:
RubatoException - if d is not of the required form

removeFactor

public Denotator removeFactor(int index)
Removes a factor. This is a destructive operation; beware of aliasing.


replaceFactors

public void replaceFactors(java.util.List<Denotator> denoList)
                    throws RubatoException
Sets the factor list to a new list of denotators.

Parameters:
denoList - the list of factor denotators
Throws:
RubatoException - the list of denotators doesn't match the form of the denotator.

getFactors

public java.util.List<Denotator> getFactors()
Returns a (new) list of the coordinates of the denotator.

Specified by:
getFactors in interface FactorDenotator

union

public PowerDenotator union(PowerDenotator d)
                     throws RubatoException
Returns the set union of this power denotator and d.

Throws:
RubatoException

intersection

public PowerDenotator intersection(PowerDenotator d)
                            throws RubatoException
Returns the set intersection of this power denotator and d.

Throws:
RubatoException

difference

public PowerDenotator difference(PowerDenotator d)
                          throws RubatoException
Returns the set difference of this power denotator and d.

Throws:
RubatoException

subset

public boolean subset(PowerDenotator d)
Returns true iff this power denotator is a subset of d.


contains

public boolean contains(Denotator d)
Returns true iff this power denotator contains d.


indexOf

public int indexOf(Denotator d)
Returns the internal index of denotator d.


iterator

public java.util.Iterator<Denotator> iterator()
Returns an iterator over the coordinates.

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

getListMorphismMap

public AutoListMorphismMap getListMorphismMap()

getFrameListMorphismMap

public AutoListMorphismMap getFrameListMorphismMap()

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

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(PowerDenotator other)
Compares two power denotators.


equals

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

Specified by:
equals in class Denotator

equals

public boolean equals(PowerDenotator other)
Checks denotators of the same form for equality.


copy

public PowerDenotator 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 PowerDenotator fromXML(XMLReader reader,
                                     org.w3c.dom.Element element)
Reads XML representation from reader starting with element.

Returns:
a power denotator or null if parsing failed

_normalize

@Internal
public void _normalize()
Normalizes power denotator. This ensures that, for a denotator of type power, the underlying list is sorted and contains no duplicates.


_make_unsafe

@Unsafe
@Internal
public static PowerDenotator _make_unsafe(NameDenotator name,
                                                          Module address,
                                                          PowerForm form,
                                                          java.util.List<Denotator> denoList)
Creates a new power 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.