org.rubato.rubettes.util
Class ObjectGenerator

java.lang.Object
  extended by org.rubato.rubettes.util.ObjectGenerator

public class ObjectGenerator
extends java.lang.Object

Author:
flo

Constructor Summary
ObjectGenerator()
           
 
Method Summary
 Denotator convertDenotatorIfCompatible(Denotator denotator)
           
 Denotator convertDenotatorIfNecessary(Denotator denotator, Form form)
           
 Denotator createEmptyScore()
           
 Denotator createObject(Form form, java.util.Map<DenotatorPath,java.lang.Double> pathsWithValues)
           
 java.util.List<Denotator> createObjects(Form objectForm, java.util.List<java.util.Map<DenotatorPath,java.lang.Double>> pathsWithValues)
           
 Denotator createStandardDenotator(Form form, double... values)
          creates the first denotator possible with the first coordinate for all colimits present
 Form getBaseForm()
           
 java.lang.Double getDoubleValue(Denotator denotator, DenotatorPath valuePath)
           
 java.lang.Double getDoubleValue(Denotator denotator, int valueIndex)
           
 int getIntegerValue(Denotator denotator, int valueIndex)
           
 boolean isFormCompatibleWithBaseForm(Form form)
           
 Denotator makeObjectAbsolute(Denotator object, Denotator referenceObject)
           
 Denotator makeObjectRelative(Denotator object, Denotator referenceObject)
           
 Denotator replaceValue(Denotator object, DenotatorPath valuePath, double value)
           
 void setBaseForm(Form baseForm)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectGenerator

public ObjectGenerator()
Method Detail

createEmptyScore

public Denotator createEmptyScore()

setBaseForm

public void setBaseForm(Form baseForm)

getBaseForm

public Form getBaseForm()

convertDenotatorIfCompatible

public Denotator convertDenotatorIfCompatible(Denotator denotator)
Returns:
a converted version of the given denotator if it is compatible with the baseForm, or the given denotator itself if it is of the same form and does not need to be converted. null if the forms are not compatible.

isFormCompatibleWithBaseForm

public boolean isFormCompatibleWithBaseForm(Form form)

createObjects

public java.util.List<Denotator> createObjects(Form objectForm,
                                               java.util.List<java.util.Map<DenotatorPath,java.lang.Double>> pathsWithValues)

createObject

public Denotator createObject(Form form,
                              java.util.Map<DenotatorPath,java.lang.Double> pathsWithValues)

createStandardDenotator

public Denotator createStandardDenotator(Form form,
                                         double... values)
creates the first denotator possible with the first coordinate for all colimits present


getIntegerValue

public int getIntegerValue(Denotator denotator,
                           int valueIndex)

getDoubleValue

public java.lang.Double getDoubleValue(Denotator denotator,
                                       int valueIndex)

getDoubleValue

public java.lang.Double getDoubleValue(Denotator denotator,
                                       DenotatorPath valuePath)

convertDenotatorIfNecessary

public Denotator convertDenotatorIfNecessary(Denotator denotator,
                                             Form form)
Returns:
if the denotator is not of the given form, the first instance of that form in the denotator's lower structure is returned. if there is none, the method checks if the object's form appears

makeObjectAbsolute

public Denotator makeObjectAbsolute(Denotator object,
                                    Denotator referenceObject)
Returns:
a copy of object where all simples in its lower structure have been made absolute with respect to the ones also present in referenceObject. if no simple of the same form is found in referenceObject at the same path as in object, the first simple of that form found is considered. if none is found, the one in object stays the same.

makeObjectRelative

public Denotator makeObjectRelative(Denotator object,
                                    Denotator referenceObject)
Returns:
a copy of object where all simples in its lower structure have been made relative of the ones also present in referenceObject. if no simple of the same form is found in referenceObject at the same path as in object, the first simple of that form found is considered. if none is found, the one in object stays absolute.

replaceValue

public Denotator replaceValue(Denotator object,
                              DenotatorPath valuePath,
                              double value)