org.rubato.rubettes.util
Class SimpleFormFinder

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

public class SimpleFormFinder
extends java.lang.Object

Searches the subforms of the given parent form for Simple forms and keeps track of their shortest possible paths, e.g. for Pitch in MacroScore: {0,1}.

Author:
Florian Thalmann

Constructor Summary
SimpleFormFinder()
           
SimpleFormFinder(PowerForm parentForm)
          Creates a SimpleFormFinder for the specified parent form.
SimpleFormFinder(PowerForm parentForm, int maxRecursion)
           
 
Method Summary
 int[][] getElementPaths()
           
 PowerForm getParentForm()
          Returns the parent form currently set.
 int[] getPath(SimpleForm form)
          Returns the path for the specified SimpleForm, if it has been found in the parent form's tree.
 int[] getPathForElement(SimpleForm form)
          Returns the path for the ModuleElement inside the specified SimpleForm, e.g.
 int[][] getSimpleFormArrayPaths()
           
 java.util.List<java.util.List<java.lang.Integer>> getSimpleFormPaths()
          Returns a List with the paths of the found SimpleForms.
 java.util.List<SimpleForm> getSimpleForms()
          Returns a List containing the found SimpleForms.
 int[] pathToArray(java.util.List<java.lang.Integer> listPath)
          Returns an array conversion of a List path
 void setMaxRecursion(int maxRecursion)
          Sets the maximum number of recursion levels to be searched to the specified value.
 void setParentForm(PowerForm parentForm)
          Sets a new parent form and searches its tree for Simple forms.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleFormFinder

public SimpleFormFinder()

SimpleFormFinder

public SimpleFormFinder(PowerForm parentForm)
Creates a SimpleFormFinder for the specified parent form.

Parameters:
parentForm - - the form, the tree of which has to be searched

SimpleFormFinder

public SimpleFormFinder(PowerForm parentForm,
                        int maxRecursion)
Method Detail

setParentForm

public void setParentForm(PowerForm parentForm)
Sets a new parent form and searches its tree for Simple forms.

Parameters:
parentForm - - the new parent form

getParentForm

public PowerForm getParentForm()
Returns the parent form currently set.


setMaxRecursion

public void setMaxRecursion(int maxRecursion)
Sets the maximum number of recursion levels to be searched to the specified value.

Parameters:
maxRecursion - - the maximum number of recursion levels

getSimpleForms

public java.util.List<SimpleForm> getSimpleForms()
Returns a List containing the found SimpleForms.


getSimpleFormPaths

public java.util.List<java.util.List<java.lang.Integer>> getSimpleFormPaths()
Returns a List with the paths of the found SimpleForms. Same order as getSimpleForms().


getSimpleFormArrayPaths

public int[][] getSimpleFormArrayPaths()

getElementPaths

public int[][] getElementPaths()

getPath

public int[] getPath(SimpleForm form)
Returns the path for the specified SimpleForm, if it has been found in the parent form's tree.

Parameters:
form - - the form to be found

getPathForElement

public int[] getPathForElement(SimpleForm form)
Returns the path for the ModuleElement inside the specified SimpleForm, e.g. {...,0}, if the form has been found in the parent form's tree.

Parameters:
form - the Simple form, the path of element of which has to be returned

pathToArray

public int[] pathToArray(java.util.List<java.lang.Integer> listPath)
Returns an array conversion of a List path